Misc. forgot all changes

Working on Cashier Checkout
This commit is contained in:
unknown committed 2011-02-05 01:00:55 +05:30
1 parent 0f323f8fab
commit 1400f42989
32 files changed
+4591 -255

No files matched your search

Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,7 @@ using System.Text;
namespace Tanshu.Accounts.Contracts
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class NotNullAttribute : Attribute
public class AllowNullAttribute : Attribute
{
private string message = string.Empty;
public string Message
@@ -9,9 +9,7 @@ namespace Tanshu.Accounts.Entities
public class Inventory
{
public virtual int InventoryID { get; set; }
[NotNull]
public virtual Voucher Voucher { get; set; }
[NotNull]
public virtual Product Product { get; set; }
private decimal quantity;
@@ -91,6 +89,13 @@ namespace Tanshu.Accounts.Entities
{ }
}
//public decimal DiscountAmount
//{
// get
// {
// return quantity * rate * (1 + tax) * (1 + serviceCharge) * discount;
// }
//}
protected void CalculateAmount()
{
amount = quantity * rate * (1 + tax) * (1 + serviceCharge) * (1 - discount);
@@ -8,9 +8,7 @@ namespace Tanshu.Accounts.Entities
public class InventoryModifier
{
public virtual int InventoryModifierID { get; set; }
[NotNull]
public virtual Inventory Inventory { get; set; }
[NotNull]
public virtual Modifier Modifier { get; set; }
}
}
@@ -11,7 +11,6 @@ namespace Tanshu.Accounts.Entities
public virtual int ModifierID { get; set; }
public virtual string Name { get; set; }
[NotNull]
public virtual IList<ProductGroupModifier> ProductGroupModifiers { get; set; }
public override int GetHashCode()
@@ -13,6 +13,7 @@ namespace Tanshu.Accounts.Entities
public virtual Customer Customer { get; set; }
public virtual SettleOption Settled { get; set; }
public virtual bool Void { get; set; }
[AllowNull]
public virtual string VoidReason { get; set; }
public virtual bool Printed { get; set; }
public virtual string KotID { get; set; }
-1
View File
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="connection" connectionString="Server=.;Initial Catalog=PeithoSales;User ID=sa;Password=123456" />
<add name="FluentCon" connectionString="Server=.;Initial Catalog=Pets;User ID=sa;Password=123456" />
</connectionStrings>
<appSettings>
@@ -368,6 +368,7 @@ namespace Tanshu.Accounts.PointOfSale
}
}
bill.Remove(new BillItemKey(billInventory.ProductID, billInventory.Printed == 0));
bill.ReCompact();
ShowAmount();
}
+1 -1
View File
@@ -5,6 +5,7 @@ using System.Windows.Forms;
using System.Threading;
using Tanshu.Accounts.Helpers;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.PointOfSale
{
@@ -17,7 +18,6 @@ namespace Tanshu.Accounts.PointOfSale
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//log.Warn("Application Started");
Application.Run(new MainForm());
//log.Warn("Application Closed");
+87 -25
View File
@@ -65,12 +65,16 @@
this.txtAdvanceReceived = new System.Windows.Forms.TextBox();
this.txtReceipts = new System.Windows.Forms.TextBox();
this.txtOpening = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.NC = new System.Windows.Forms.Label();
this.txtBillToCompany = new System.Windows.Forms.TextBox();
this.txtNC = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(12, 380);
this.label18.Location = new System.Drawing.Point(12, 432);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(68, 13);
this.label18.TabIndex = 71;
@@ -78,9 +82,10 @@
//
// txtClosingCash
//
this.txtClosingCash.Location = new System.Drawing.Point(99, 377);
this.txtClosingCash.Location = new System.Drawing.Point(99, 429);
this.txtClosingCash.Name = "txtClosingCash";
this.txtClosingCash.ReadOnly = true;
this.txtClosingCash.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtClosingCash.Size = new System.Drawing.Size(200, 20);
this.txtClosingCash.TabIndex = 55;
//
@@ -103,7 +108,7 @@
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(12, 276);
this.label17.Location = new System.Drawing.Point(12, 328);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(85, 13);
this.label17.TabIndex = 67;
@@ -112,7 +117,7 @@
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(12, 302);
this.label16.Location = new System.Drawing.Point(12, 354);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(81, 13);
this.label16.TabIndex = 68;
@@ -121,7 +126,7 @@
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(12, 354);
this.label15.Location = new System.Drawing.Point(12, 406);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(53, 13);
this.label15.TabIndex = 70;
@@ -130,7 +135,7 @@
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(12, 406);
this.label14.Location = new System.Drawing.Point(12, 458);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(82, 13);
this.label14.TabIndex = 72;
@@ -139,7 +144,7 @@
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(12, 432);
this.label13.Location = new System.Drawing.Point(12, 484);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(37, 13);
this.label13.TabIndex = 73;
@@ -148,7 +153,7 @@
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(12, 328);
this.label12.Location = new System.Drawing.Point(12, 380);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(62, 13);
this.label12.TabIndex = 69;
@@ -156,7 +161,7 @@
//
// btnCalculate
//
this.btnCalculate.Location = new System.Drawing.Point(12, 455);
this.btnCalculate.Location = new System.Drawing.Point(12, 507);
this.btnCalculate.Name = "btnCalculate";
this.btnCalculate.Size = new System.Drawing.Size(287, 23);
this.btnCalculate.TabIndex = 39;
@@ -166,7 +171,7 @@
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(12, 484);
this.btnPrint.Location = new System.Drawing.Point(12, 536);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(287, 23);
this.btnPrint.TabIndex = 40;
@@ -176,7 +181,7 @@
//
// txtStatus
//
this.txtStatus.Location = new System.Drawing.Point(99, 429);
this.txtStatus.Location = new System.Drawing.Point(99, 481);
this.txtStatus.Name = "txtStatus";
this.txtStatus.ReadOnly = true;
this.txtStatus.Size = new System.Drawing.Size(200, 20);
@@ -184,25 +189,28 @@
//
// txtSales
//
this.txtSales.Location = new System.Drawing.Point(99, 351);
this.txtSales.Location = new System.Drawing.Point(99, 403);
this.txtSales.Name = "txtSales";
this.txtSales.ReadOnly = true;
this.txtSales.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtSales.Size = new System.Drawing.Size(200, 20);
this.txtSales.TabIndex = 54;
this.txtSales.TextChanged += new System.EventHandler(this.txtSales_TextChanged);
//
// txtDeposited
//
this.txtDeposited.Location = new System.Drawing.Point(99, 403);
this.txtDeposited.Location = new System.Drawing.Point(99, 455);
this.txtDeposited.Name = "txtDeposited";
this.txtDeposited.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtDeposited.Size = new System.Drawing.Size(200, 20);
this.txtDeposited.TabIndex = 38;
//
// txtPending
//
this.txtPending.Location = new System.Drawing.Point(99, 325);
this.txtPending.Location = new System.Drawing.Point(99, 377);
this.txtPending.Name = "txtPending";
this.txtPending.ReadOnly = true;
this.txtPending.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtPending.Size = new System.Drawing.Size(200, 20);
this.txtPending.TabIndex = 53;
//
@@ -237,7 +245,7 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(12, 250);
this.label8.Location = new System.Drawing.Point(12, 302);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(81, 13);
this.label8.TabIndex = 66;
@@ -246,7 +254,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(12, 224);
this.label7.Location = new System.Drawing.Point(12, 276);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(82, 13);
this.label7.TabIndex = 65;
@@ -255,7 +263,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 198);
this.label6.Location = new System.Drawing.Point(12, 250);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(53, 13);
this.label6.TabIndex = 64;
@@ -264,7 +272,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 172);
this.label5.Location = new System.Drawing.Point(12, 224);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(73, 13);
this.label5.TabIndex = 63;
@@ -308,17 +316,19 @@
//
// txtPayments
//
this.txtPayments.Location = new System.Drawing.Point(99, 195);
this.txtPayments.Location = new System.Drawing.Point(99, 247);
this.txtPayments.Name = "txtPayments";
this.txtPayments.ReadOnly = true;
this.txtPayments.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtPayments.Size = new System.Drawing.Size(200, 20);
this.txtPayments.TabIndex = 48;
//
// txtAdvanceAdjusted
//
this.txtAdvanceAdjusted.Location = new System.Drawing.Point(99, 169);
this.txtAdvanceAdjusted.Location = new System.Drawing.Point(99, 221);
this.txtAdvanceAdjusted.Name = "txtAdvanceAdjusted";
this.txtAdvanceAdjusted.ReadOnly = true;
this.txtAdvanceAdjusted.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtAdvanceAdjusted.Size = new System.Drawing.Size(200, 20);
this.txtAdvanceAdjusted.TabIndex = 47;
//
@@ -327,38 +337,43 @@
this.txtCCReceipts.Location = new System.Drawing.Point(99, 143);
this.txtCCReceipts.Name = "txtCCReceipts";
this.txtCCReceipts.ReadOnly = true;
this.txtCCReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtCCReceipts.Size = new System.Drawing.Size(200, 20);
this.txtCCReceipts.TabIndex = 46;
//
// txtAdditionalVoids
//
this.txtAdditionalVoids.Location = new System.Drawing.Point(99, 221);
this.txtAdditionalVoids.Location = new System.Drawing.Point(99, 273);
this.txtAdditionalVoids.Name = "txtAdditionalVoids";
this.txtAdditionalVoids.ReadOnly = true;
this.txtAdditionalVoids.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtAdditionalVoids.Size = new System.Drawing.Size(200, 20);
this.txtAdditionalVoids.TabIndex = 49;
//
// txtVoidsInSystem
//
this.txtVoidsInSystem.Location = new System.Drawing.Point(99, 247);
this.txtVoidsInSystem.Location = new System.Drawing.Point(99, 299);
this.txtVoidsInSystem.Name = "txtVoidsInSystem";
this.txtVoidsInSystem.ReadOnly = true;
this.txtVoidsInSystem.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtVoidsInSystem.Size = new System.Drawing.Size(200, 20);
this.txtVoidsInSystem.TabIndex = 50;
//
// txtDiscounts
//
this.txtDiscounts.Location = new System.Drawing.Point(99, 273);
this.txtDiscounts.Location = new System.Drawing.Point(99, 325);
this.txtDiscounts.Name = "txtDiscounts";
this.txtDiscounts.ReadOnly = true;
this.txtDiscounts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtDiscounts.Size = new System.Drawing.Size(200, 20);
this.txtDiscounts.TabIndex = 51;
//
// txtRates
//
this.txtRates.Location = new System.Drawing.Point(99, 299);
this.txtRates.Location = new System.Drawing.Point(99, 351);
this.txtRates.Name = "txtRates";
this.txtRates.ReadOnly = true;
this.txtRates.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtRates.Size = new System.Drawing.Size(200, 20);
this.txtRates.TabIndex = 52;
//
@@ -367,6 +382,7 @@
this.txtAdvanceReceived.Location = new System.Drawing.Point(99, 117);
this.txtAdvanceReceived.Name = "txtAdvanceReceived";
this.txtAdvanceReceived.ReadOnly = true;
this.txtAdvanceReceived.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtAdvanceReceived.Size = new System.Drawing.Size(200, 20);
this.txtAdvanceReceived.TabIndex = 45;
//
@@ -375,6 +391,7 @@
this.txtReceipts.Location = new System.Drawing.Point(99, 91);
this.txtReceipts.Name = "txtReceipts";
this.txtReceipts.ReadOnly = true;
this.txtReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtReceipts.Size = new System.Drawing.Size(200, 20);
this.txtReceipts.TabIndex = 44;
//
@@ -383,14 +400,55 @@
this.txtOpening.Location = new System.Drawing.Point(99, 65);
this.txtOpening.Name = "txtOpening";
this.txtOpening.ReadOnly = true;
this.txtOpening.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtOpening.Size = new System.Drawing.Size(200, 20);
this.txtOpening.TabIndex = 43;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(12, 198);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(79, 13);
this.label11.TabIndex = 77;
this.label11.Text = "Bill to Company";
//
// NC
//
this.NC.AutoSize = true;
this.NC.Location = new System.Drawing.Point(12, 172);
this.NC.Name = "NC";
this.NC.Size = new System.Drawing.Size(58, 13);
this.NC.TabIndex = 76;
this.NC.Text = "No Charge";
//
// txtBillToCompany
//
this.txtBillToCompany.Location = new System.Drawing.Point(99, 195);
this.txtBillToCompany.Name = "txtBillToCompany";
this.txtBillToCompany.ReadOnly = true;
this.txtBillToCompany.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtBillToCompany.Size = new System.Drawing.Size(200, 20);
this.txtBillToCompany.TabIndex = 75;
//
// txtNC
//
this.txtNC.Location = new System.Drawing.Point(99, 169);
this.txtNC.Name = "txtNC";
this.txtNC.ReadOnly = true;
this.txtNC.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.txtNC.Size = new System.Drawing.Size(200, 20);
this.txtNC.TabIndex = 74;
//
// Cashier_Checkout_Form
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(311, 519);
this.ClientSize = new System.Drawing.Size(311, 571);
this.Controls.Add(this.label11);
this.Controls.Add(this.NC);
this.Controls.Add(this.txtBillToCompany);
this.Controls.Add(this.txtNC);
this.Controls.Add(this.label18);
this.Controls.Add(this.txtClosingCash);
this.Controls.Add(this.dtpFinish);
@@ -477,5 +535,9 @@
private System.Windows.Forms.TextBox txtAdvanceReceived;
private System.Windows.Forms.TextBox txtReceipts;
private System.Windows.Forms.TextBox txtOpening;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label NC;
private System.Windows.Forms.TextBox txtBillToCompany;
private System.Windows.Forms.TextBox txtNC;
}
}
@@ -47,17 +47,20 @@ namespace Tanshu.Accounts.PointOfSale
dtpFinish.Value = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
txtOpening.Text = coProxy.Opening.ToString();
txtReceipts.Text = coProxy.Receipts.ToString();
txtAdvanceReceived.Text = coProxy.AdvanceReceipts.ToString();
txtCCReceipts.Text = coProxy.CCReceipts.ToString();
txtAdvanceAdjusted.Text = coProxy.AdvanceAdjusted.ToString();
txtPayments.Text = coProxy.CashPayments.ToString();
txtAdditionalVoids.Text = coProxy.AdditionalVoids.ToString();
txtVoidsInSystem.Text = coProxy.VoidsInSystem.ToString();
txtPending.Text = coProxy.PendingBills.ToString();
txtSales.Text = coProxy.NetSales.ToString();
txtClosingCash.Text = coProxy.ClosingBalance.ToString();
txtOpening.Text = string.Format("{0:#,##0.00}", coProxy);
txtReceipts.Text = string.Format("{0:#,##0.00}", coProxy.Receipts);
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", coProxy.AdvanceReceipts);
txtCCReceipts.Text = string.Format("{0:#,##0.00}", coProxy.CCReceipts);
txtNC.Text = string.Format("{0:#,##0.00}", coProxy.NCReceipts);
txtBillToCompany.Text = string.Format("{0:#,##0.00}", coProxy.BTCReceipts);
txtAdvanceAdjusted.Text = string.Format("{0:#,##0.00}", coProxy.AdvanceAdjusted);
txtPayments.Text = string.Format("{0:#,##0.00}", coProxy.CashPayments);
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", coProxy.AdditionalVoids);
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", coProxy.VoidsInSystem);
txtPending.Text = string.Format("{0:#,##0.00}", coProxy.PendingBills);
txtSales.Text = string.Format("{0:#,##0.00}", coProxy.NetSales);
txtClosingCash.Text = string.Format("{0:#,##0.00}", coProxy.ClosingBalance
);
txtStatus.Text = coProxy.Status;
}
@@ -170,7 +170,7 @@ namespace Tanshu.Accounts.PointOfSale
}
else
{
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), 0, new FoodTableBI().GetFoodTables(), new ButtonClickDelegate(tableButton_Click));
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
}
}
@@ -223,7 +223,7 @@ namespace Tanshu.Accounts.PointOfSale
int start = item.FoodTableID;
if (start < 0)
start = 0;
var list = new FoodTableBI().GetFoodTables();
var list = new FoodTableBI().List();
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
}
else
@@ -55,6 +55,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Windsor\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate, Version=1.2.0.694, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\FluentNHibernate.dll</HintPath>
@@ -101,7 +105,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Tanshu.Common.dll</HintPath>
</Reference>
<Reference Include="Tanshu.Common.KeyboardControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Reference Include="Tanshu.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fd89fe1d2351f8b5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Tanshu.Data.dll</HintPath>
+6 -1
View File
@@ -162,6 +162,10 @@ namespace Tanshu.Accounts.Print
private static bool PrintRAW(PrintLocation printer, string Text, string DocumentName)
{
#if (DEBUG)
System.Windows.Forms.MessageBox.Show(Text);
return true;
#else
try
{
Text += printer.CutCode;
@@ -176,6 +180,7 @@ namespace Tanshu.Accounts.Print
throw ex;
}
return true;
#endif
}
#region Print Cash Total
@@ -278,7 +283,7 @@ namespace Tanshu.Accounts.Print
string BillText;
try
{
BillText = FormatText(string.Format("{0} Checkout By {1}", details.Cashier, details.Manager), 42, false, Align.Centre);
BillText = FormatText(string.Format("{0} Checkout By {1}", details.Cashier.Name, details.Manager), 42, false, Align.Centre);
BillText += string.Format("{0:dd-MMM-yy} To {1:dd-MMM-yy} @ {2:dd-MMM-yyyy HH:mm}", details.StartDate, details.FinishDate, DateTime.Now);
BillText += DrawLine;
BillText += string.Format("\n\rOpening : {0,26:#,##0.00}", details.Opening);
@@ -7,6 +7,7 @@ using Tanshu.Data.DAO;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.SqlDAO;
using Tanshu.Accounts.Entities.Auth;
using NHibernate;
namespace Tanshu.Accounts.Repository
{
@@ -29,14 +30,20 @@ namespace Tanshu.Accounts.Repository
finishDate = finishDate.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
using (var session = SessionManager.Session)
{
var ab = from ad in session.QueryOver<Advance>()
where ad.DateIn >= startDate && ad.DateIn <= finishDate
select ad;
var query = from ad in session.QueryOver<Advance>()
where ad.DateIn >= startDate && ad.DateIn <= finishDate
select ad;
if (!all)
ab = from a in ab
where a.CashierOut == null
select a;
return ab.List();
query = from a in query
where a.CashierOut == null
select a;
var list = query.List();
foreach (var item in list)
{
NHibernateUtil.Initialize(item.CashierIn);
NHibernateUtil.Initialize(item.CashierOut);
}
return list;
}
}
public void Adjust(int advanceID, int userID)
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Linq;
using System.Text;
using System.Threading;
using System.Data.SqlClient;
using Tanshu.Data.DAO;
using Tanshu.Accounts.SqlDAO;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Entities.Auth;
using NHibernate.Criterion;
namespace Tanshu.Accounts.Repository
{
@@ -17,6 +19,8 @@ namespace Tanshu.Accounts.Repository
public decimal Receipts { get; private set; }
public decimal AdvanceReceipts { get; private set; }
public decimal CCReceipts { get; private set; }
public decimal NCReceipts { get; private set; }
public decimal BTCReceipts { get; private set; }
public decimal AdvanceAdjusted { get; private set; }
public decimal CashPayments { get; private set; }
public decimal AdditionalVoids { get; private set; }
@@ -29,36 +33,21 @@ namespace Tanshu.Accounts.Repository
public decimal Excess { get; private set; } //
public string Status { get; private set; } //
public string Cashiers { get; private set; } //
public int CashierID { get; private set; } //
public string Cashier { get; private set; } //
public User Cashier { get; private set; }
public decimal OldPending { get; private set; }
public decimal OldReceipts { get; private set; }
public decimal OldVoided { get; private set; }
public DateTime StartDate { get; private set; } //
public DateTime FinishDate { get; private set; } //
public DateTime StartDate { get; private set; }
public DateTime FinishDate { get; private set; }
private string pendingString;
public string PendingString
{
get { return pendingString; }
}
private string cCString;
public string CCString
{
get { return cCString; }
}
private string voidsString;
public string VoidsString
{
get { return voidsString; }
}
private string discountString;
public string DiscountString
{
get { return discountString; }
}
public string PendingString { get; private set; }
public string CCString { get; private set; }
public string NCString { get; private set; }
public string BTCString { get; private set; }
public string VoidsString { get; private set; }
public string DiscountString { get; private set; }
//public string PendingString { get; private set; } //
//public string CCString { get; private set; } //
@@ -77,21 +66,29 @@ namespace Tanshu.Accounts.Repository
using (var session = SessionManager.Session)
{
//Actual Closing
this.CashierID = cashier;
this.Cashier = UserBI.GetUser(cashier);
this.StartDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", startDate));
this.FinishDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", finishDate));
Cashier = UserBI.GetUser(CashierID).Name;
//PendingBills = dao.GetPending(ref pendingString);
// CCReceipts = dao.GetCreditCard(ref cCString);
// VoidsInSystem = dao.GetVoids(ref voidsString);
string info;
PendingBills = GetPending(out info);
PendingString = info;
CCReceipts = GetCreditCard(out info);
CCString = info;
NCReceipts = GetNoCharge(out info);
NCString = info;
BTCReceipts = GetBillToCompany(out info);
BTCString = info;
VoidsInSystem = GetVoids(out info);
VoidsString = info;
// Opening = dao.GetOpenings();
// Receipts = dao.GetReceipts();
// Receipts = GetReceipts();
// CashPayments = dao.GetPayments();
// AdditionalVoids = dao.GetAdditionalVoids();
// RetainedOvernight = dao.GetRetainedOvernight();
// AdvanceReceipts = dao.GetAdvancesReceived();
// AdvanceAdjusted = dao.GetAdvancesAdjusted();
AdvanceReceipts = GetAdvancesReceived();
AdvanceAdjusted = GetAdvancesAdjusted();
// PaymentString = dao.GetPaymentString();
// OldPending = dao.GetOldPending();
@@ -99,17 +96,42 @@ namespace Tanshu.Accounts.Repository
// OldVoided = dao.GetOldVoided();
// Cashiers = dao.GetActiveCashiers();
// NetSales = dao.GetNetSales();
// dao.GetDiscountsBills(ref discountString);
// ClosingBalance = Opening
// + Receipts
// + AdvanceReceipts
// - CCReceipts
// - AdvanceAdjusted
// - CashPayments
// - AdditionalVoids
// + NetSales;
//Cashiers = GetActiveCashiers();
NetSales = GetNetSales();
GetDiscountBills(.1M, out info);
DiscountString = info;
ClosingBalance = Opening
+ Receipts
+ AdvanceReceipts
- CCReceipts
- AdvanceAdjusted
- CashPayments
- AdditionalVoids
+ NetSales;
}
}
private decimal GetAdvancesAdjusted()
{
using (var session = SessionManager.Session)
{
var amt = session.QueryOver<Advance>()
.Where(i => i.DateOut >= StartDate && i.DateOut <= FinishDate && i.CashierOut == Cashier)
.SelectList(k => k.SelectSum(j => j.Amount))
.SingleOrDefault<decimal>();
return amt;
}
}
private decimal GetAdvancesReceived()
{
using (var session = SessionManager.Session)
{
var amt = session.QueryOver<Advance>()
.Where(i => i.DateIn >= StartDate && i.DateIn <= FinishDate && i.CashierIn == Cashier)
.SelectList(k => k.SelectSum(j => j.Amount))
.SingleOrDefault<decimal>();
return amt;
}
}
public void Calculate(decimal cashDeposited, decimal retainedOvernight)
@@ -119,49 +141,155 @@ namespace Tanshu.Accounts.Repository
Excess = CashDeposited - ClosingBalance;
Status = string.Format("{0:Extra Cash Rs #,##0.00; Cash Short Rs #,##0.00;Cash Perfect}", Excess);
}
// public decimal GetPending(ref string info)
// {
// using (var session = SessionManager.Session)
// {
// var a = from i in session.QueryOver<SaleVoucher>()
// where i.LastEditDate >= StartDate && i.LastEditDate <= FinishDate && i.User.UserID == userid
// }
// decimal amount = 0;
// info = "";
// string query = @"
//SELECT t.Date, s.BillID, c.Name, SUM(i.Amount) AS Amount, SUM(Quantity * Rate * Discount) AS Discount FROM Vouchers t INNER JOIN SaleVoucher s ON t.VoucherID = s.VoucherID
//INNER JOIN Inventory i ON t.VoucherID = i.VoucherID
//INNER JOIN Customers c ON s.CustomerID = c.CustomerID
//WHERE t.Type = 'S'
//AND t.LastEditDate BETWEEN @StartDate AND @FinishDate AND t.UserID = @UserID
//AND s.Void = 0 AND s.Paid = 0
//GROUP BY t.Date, c.Name, s.BillID
//";
// using (SqlCommand cmd = new SqlCommand(query))
// {
// cmd.Parameters.AddWithValue("@StartDate", startDate);
// cmd.Parameters.AddWithValue("@FinishDate", finishDate);
// cmd.Parameters.AddWithValue("@UserID", userID);
private decimal GetPending(out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- Pending Bills ------------------------";
var list = (from i in session.QueryOver<SaleVoucher>()
where i.LastEditDate >= StartDate &&
i.LastEditDate <= FinishDate &&
i.User == Cashier &&
i.Void == false &&
i.Settled == SettleOptionFactory.OUnsettled
select i).List();
GetInfo(list, out amount, ref info);
return amount;
}
}
private decimal GetNoCharge(out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- No Charge ----------------------------";
var list = (from i in session.QueryOver<SaleVoucher>()
where i.LastEditDate >= StartDate &&
i.LastEditDate <= FinishDate &&
i.User == Cashier &&
i.Void == false &&
i.Settled == SettleOptionFactory.ONoCharge
select i).List();
GetInfo(list, out amount, ref info);
return amount;
}
}
private decimal GetBillToCompany(out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- Bill To Company ----------------------";
var list = (from i in session.QueryOver<SaleVoucher>()
where i.LastEditDate >= StartDate &&
i.LastEditDate <= FinishDate &&
i.User == Cashier &&
i.Void == false &&
i.Settled == SettleOptionFactory.OBillToCompany
select i).List();
GetInfo(list, out amount, ref info);
return amount;
}
}
private decimal GetCreditCard(out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- Credit Card Bills --------------------";
var list = (from i in session.QueryOver<SaleVoucher>()
where i.LastEditDate >= StartDate &&
i.LastEditDate <= FinishDate &&
i.User == Cashier &&
i.Void == false &&
i.Settled == SettleOptionFactory.OCreditCard
select i).List();
GetInfo(list, out amount, ref info);
return amount;
}
}
private decimal GetVoids(out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- Void Bills ---------------------------";
var list = (from i in session.QueryOver<SaleVoucher>()
where i.LastEditDate >= StartDate &&
i.LastEditDate <= FinishDate &&
i.User == Cashier &&
i.Void == true
select i).List();
GetInfo(list, out amount, ref info);
return amount;
}
}
private decimal GetDiscountBills(decimal disount, out string info)
{
using (var session = SessionManager.Session)
{
decimal amount;
info = "\n\r--- High Discount Bills ------------------";
string query = @"
select v from SaleVoucher v
inner join v.Inventories i
where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and v.Void = false and v.Settled != :unSettled and v.Settled != :noCharge
and i.Discount >= :discount";
var list = session.CreateQuery(query)
.SetParameter("startDate", StartDate)
.SetParameter("finishDate", FinishDate)
.SetParameter("cashierID", Cashier.UserID)
.SetParameter("unSettled", SettleOptionFactory.Unsettled)
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
.SetParameter("discount", disount)
.List<SaleVoucher>();
// using (IDataReader dr = connection.ExecuteReader(cmd))
// {
// if (dr.Read())
// {
// info = "\n\r--- Pending Bills ------------------------";
GetInfo(list, out amount, ref info);
return amount;
}
}
// do
// {
// amount += dr.GetDecimal(3);
// info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", dr.GetDateTime(0), dr.GetString(1), dr.GetString(2));
// info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", dr.GetDecimal(3), dr.GetDecimal(4));
// info += "\n\r------------------------------------------";
// } while (dr.Read());
// }
// }
// }
// return amount;
// }
private decimal GetNetSales()
{
using (var session = SessionManager.Session)
{
decimal amount = 0;
string query = @"
select sum(i.Amount) from SaleVoucher v
inner join v.Inventories i
where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and v.Void = false and v.Settled != :unSettled and v.Settled != :noCharge";
amount = session.CreateQuery(query)
.SetParameter("startDate", StartDate)
.SetParameter("finishDate", FinishDate)
.SetParameter("cashierID", Cashier.UserID)
.SetParameter("unSettled", SettleOptionFactory.Unsettled)
.SetParameter("noCharge", SettleOptionFactory.NoCharge)
.UniqueResult<decimal>();
return amount;
}
}
private void GetInfo(IList<SaleVoucher> list, out decimal amount, ref string info)
{
amount = 0;
if (list.Count == 0)
{
info = string.Empty;
return;
}
foreach (var item in list)
{
decimal amt, disc;
amt = item.Inventories.Sum(x => x.Amount);
disc = item.Inventories.Sum(x => x.Quantity * x.Rate * (1 + x.Tax) * (1 + x.ServiceCharge) * x.Discount);
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
info += "\n\r------------------------------------------";
amount += amt;
}
}
}
}
@@ -6,45 +6,41 @@ using System.Data.SqlClient;
using Tanshu.Data.DAO;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.SqlDAO;
using NHibernate;
namespace Tanshu.Accounts.Repository
{
public class FoodTableBI
{
ISession session;
public FoodTableBI()
{
this.session = SessionManager.Session;
}
public void Insert(FoodTable foodTable)
{
using (var session = SessionManager.Session)
{
session.Save(foodTable);
}
session.Save(foodTable);
}
public void Update(FoodTable foodTable)
{
using (var session = SessionManager.Session)
{
session.Update(foodTable);
}
session.Update(foodTable);
}
public void Delete(int foodTableID)
{
using (var session = SessionManager.Session)
{
session.Delete(new FoodTable() { FoodTableID = foodTableID });
}
session.Delete(new FoodTable() { FoodTableID = foodTableID });
}
public FoodTable GetFoodTable(int foodTableID)
public FoodTable Get(int foodTableID)
{
using (var session = SessionManager.Session)
{
return session.Get<FoodTable>(foodTableID);
}
return session.Get<FoodTable>(foodTableID);
}
public IList<FoodTable> GetFoodTables()
public IList<FoodTable> List()
{
using (var session = SessionManager.Session)
{
return session.CreateCriteria<FoodTable>().List<FoodTable>();
}
return session.CreateCriteria<FoodTable>().List<FoodTable>();
}
public void Dispose()
{
session.Dispose();
}
}
}
@@ -0,0 +1,33 @@
//using System;
//using FluentNHibernate.Conventions;
//using System.Reflection;
//using FluentNHibernate;
//using FluentNHibernate.Conventions.Instances;
//using FluentNHibernate.Conventions.Inspections;
//using FluentNHibernate.Conventions.AcceptanceCriteria;
//using Tanshu.Accounts.Contracts;
//namespace Tanshu.Accounts.Conventions
//{
// public class AllowNullConvention : IPropertyConvention, IPropertyConventionAcceptance
// {
// public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
// {
// criteria.Expect(
// x => !this.IsNullableProperty(x)
// || x.Property.MemberInfo.GetCustomAttributes(typeof(AllowNullAttribute), true).Length > 0);
// }
// public void Apply(IPropertyInstance instance)
// {
// instance.Nullable();
// }
// private bool IsNullableProperty(IExposedThroughPropertyInspector target)
// {
// var type = target.Property.PropertyType;
// return type.Equals(typeof(string)) || (type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)));
// }
// }
//}
+60 -60
View File
@@ -360,66 +360,66 @@ namespace Tanshu.Accounts.Repository
{
using (var session = SessionManager.StatelessSession)
{
session.Insert(new FoodTable() { Name = "1" });
session.Insert(new FoodTable() { Name = "2" });
session.Insert(new FoodTable() { Name = "3" });
session.Insert(new FoodTable() { Name = "4" });
session.Insert(new FoodTable() { Name = "5" });
session.Insert(new FoodTable() { Name = "6" });
session.Insert(new FoodTable() { Name = "7" });
session.Insert(new FoodTable() { Name = "8" });
session.Insert(new FoodTable() { Name = "9" });
session.Insert(new FoodTable() { Name = "10" });
session.Insert(new FoodTable() { Name = "11" });
session.Insert(new FoodTable() { Name = "12" });
session.Insert(new FoodTable() { Name = "13" });
session.Insert(new FoodTable() { Name = "14" });
session.Insert(new FoodTable() { Name = "15" });
session.Insert(new FoodTable() { Name = "16" });
session.Insert(new FoodTable() { Name = "17" });
session.Insert(new FoodTable() { Name = "18" });
session.Insert(new FoodTable() { Name = "19" });
session.Insert(new FoodTable() { Name = "20" });
session.Insert(new FoodTable() { Name = "21" });
session.Insert(new FoodTable() { Name = "22" });
session.Insert(new FoodTable() { Name = "23" });
session.Insert(new FoodTable() { Name = "24" });
session.Insert(new FoodTable() { Name = "25" });
session.Insert(new FoodTable() { Name = "26" });
session.Insert(new FoodTable() { Name = "27" });
session.Insert(new FoodTable() { Name = "28" });
session.Insert(new FoodTable() { Name = "29" });
session.Insert(new FoodTable() { Name = "30" });
session.Insert(new FoodTable() { Name = "31" });
session.Insert(new FoodTable() { Name = "32" });
session.Insert(new FoodTable() { Name = "33" });
session.Insert(new FoodTable() { Name = "34" });
session.Insert(new FoodTable() { Name = "35" });
session.Insert(new FoodTable() { Name = "36" });
session.Insert(new FoodTable() { Name = "37" });
session.Insert(new FoodTable() { Name = "38" });
session.Insert(new FoodTable() { Name = "39" });
session.Insert(new FoodTable() { Name = "40" });
session.Insert(new FoodTable() { Name = "41" });
session.Insert(new FoodTable() { Name = "42" });
session.Insert(new FoodTable() { Name = "43" });
session.Insert(new FoodTable() { Name = "44" });
session.Insert(new FoodTable() { Name = "45" });
session.Insert(new FoodTable() { Name = "46" });
session.Insert(new FoodTable() { Name = "47" });
session.Insert(new FoodTable() { Name = "48" });
session.Insert(new FoodTable() { Name = "49" });
session.Insert(new FoodTable() { Name = "50" });
session.Insert(new FoodTable() { Name = "51" });
session.Insert(new FoodTable() { Name = "52" });
session.Insert(new FoodTable() { Name = "53" });
session.Insert(new FoodTable() { Name = "54" });
session.Insert(new FoodTable() { Name = "55" });
session.Insert(new FoodTable() { Name = "56" });
session.Insert(new FoodTable() { Name = "57" });
session.Insert(new FoodTable() { Name = "58" });
session.Insert(new FoodTable() { Name = "59" });
session.Insert(new FoodTable() { Name = "60" });
session.Insert(new FoodTable() { Location = "", Name = "1" });
session.Insert(new FoodTable() { Location = "", Name = "2" });
session.Insert(new FoodTable() { Location = "", Name = "3" });
session.Insert(new FoodTable() { Location = "", Name = "4" });
session.Insert(new FoodTable() { Location = "", Name = "5" });
session.Insert(new FoodTable() { Location = "", Name = "6" });
session.Insert(new FoodTable() { Location = "", Name = "7" });
session.Insert(new FoodTable() { Location = "", Name = "8" });
session.Insert(new FoodTable() { Location = "", Name = "9" });
session.Insert(new FoodTable() { Location = "", Name = "10" });
session.Insert(new FoodTable() { Location = "", Name = "11" });
session.Insert(new FoodTable() { Location = "", Name = "12" });
session.Insert(new FoodTable() { Location = "", Name = "13" });
session.Insert(new FoodTable() { Location = "", Name = "14" });
session.Insert(new FoodTable() { Location = "", Name = "15" });
session.Insert(new FoodTable() { Location = "", Name = "16" });
session.Insert(new FoodTable() { Location = "", Name = "17" });
session.Insert(new FoodTable() { Location = "", Name = "18" });
session.Insert(new FoodTable() { Location = "", Name = "19" });
session.Insert(new FoodTable() { Location = "", Name = "20" });
session.Insert(new FoodTable() { Location = "", Name = "21" });
session.Insert(new FoodTable() { Location = "", Name = "22" });
session.Insert(new FoodTable() { Location = "", Name = "23" });
session.Insert(new FoodTable() { Location = "", Name = "24" });
session.Insert(new FoodTable() { Location = "", Name = "25" });
session.Insert(new FoodTable() { Location = "", Name = "26" });
session.Insert(new FoodTable() { Location = "", Name = "27" });
session.Insert(new FoodTable() { Location = "", Name = "28" });
session.Insert(new FoodTable() { Location = "", Name = "29" });
session.Insert(new FoodTable() { Location = "", Name = "30" });
session.Insert(new FoodTable() { Location = "", Name = "31" });
session.Insert(new FoodTable() { Location = "", Name = "32" });
session.Insert(new FoodTable() { Location = "", Name = "33" });
session.Insert(new FoodTable() { Location = "", Name = "34" });
session.Insert(new FoodTable() { Location = "", Name = "35" });
session.Insert(new FoodTable() { Location = "", Name = "36" });
session.Insert(new FoodTable() { Location = "", Name = "37" });
session.Insert(new FoodTable() { Location = "", Name = "38" });
session.Insert(new FoodTable() { Location = "", Name = "39" });
session.Insert(new FoodTable() { Location = "", Name = "40" });
session.Insert(new FoodTable() { Location = "", Name = "41" });
session.Insert(new FoodTable() { Location = "", Name = "42" });
session.Insert(new FoodTable() { Location = "", Name = "43" });
session.Insert(new FoodTable() { Location = "", Name = "44" });
session.Insert(new FoodTable() { Location = "", Name = "45" });
session.Insert(new FoodTable() { Location = "", Name = "46" });
session.Insert(new FoodTable() { Location = "", Name = "47" });
session.Insert(new FoodTable() { Location = "", Name = "48" });
session.Insert(new FoodTable() { Location = "", Name = "49" });
session.Insert(new FoodTable() { Location = "", Name = "50" });
session.Insert(new FoodTable() { Location = "", Name = "51" });
session.Insert(new FoodTable() { Location = "", Name = "52" });
session.Insert(new FoodTable() { Location = "", Name = "53" });
session.Insert(new FoodTable() { Location = "", Name = "54" });
session.Insert(new FoodTable() { Location = "", Name = "55" });
session.Insert(new FoodTable() { Location = "", Name = "56" });
session.Insert(new FoodTable() { Location = "", Name = "57" });
session.Insert(new FoodTable() { Location = "", Name = "58" });
session.Insert(new FoodTable() { Location = "", Name = "59" });
session.Insert(new FoodTable() { Location = "", Name = "60" });
}
}
#endregion
@@ -1,24 +1,20 @@
using System;
using FluentNHibernate.Conventions;
using System.Reflection;
using FluentNHibernate;
using FluentNHibernate.Conventions.Instances;
using FluentNHibernate.Conventions.Inspections;
using FluentNHibernate.Conventions.AcceptanceCriteria;
using Tanshu.Accounts.Contracts;
//using System;
//using FluentNHibernate.Conventions;
//using System.Reflection;
//using FluentNHibernate;
//using FluentNHibernate.Conventions.Instances;
//using FluentNHibernate.Conventions.Inspections;
//using FluentNHibernate.Conventions.AcceptanceCriteria;
//using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Conventions
{
public class NotNullConvention : IPropertyConvention
{
public void Apply(IPropertyInstance instance)
{
if (!HasAttribute(instance.Property.MemberInfo)) return;
instance.Not.Nullable();
}
bool HasAttribute(ICustomAttributeProvider provider)
{
return provider.GetCustomAttributes(typeof(NotNullAttribute), false).Length == 1;
}
}
}
//namespace Tanshu.Accounts.Conventions
//{
// public class NotNullConvention : IPropertyConvention
// {
// public void Apply(IPropertyInstance instance)
// {
// instance.Not.Nullable();
// }
// }
//}
+1 -3
View File
@@ -29,9 +29,7 @@ namespace Tanshu.Accounts.SqlDAO
public class NHSQLInterceptor : EmptyInterceptor, IInterceptor
{
SqlString
IInterceptor.OnPrepareStatement
(SqlString sql)
SqlString IInterceptor.OnPrepareStatement(SqlString sql)
{
QueryStore.Query = sql.ToString();
return sql;
+2 -1
View File
@@ -51,7 +51,8 @@ namespace Tanshu.Accounts.Repository
c.Add<CustomForeignKeyConvention>();
c.Add<ClassConvention>();
c.Add<CascadeConvention>();
c.Add<NotNullConvention>();
//c.Add<AllowNullConvention>();
//c.Add<NotNullConvention>();
//c.Add(DefaultLazy.Never());
//c.Add<EnumConvention>();
});
@@ -0,0 +1,24 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using FluentNHibernate.Conventions;
//using FluentNHibernate.Conventions.Instances;
//using NHibernate;
//using NHibernate.SqlCommand;
//using System.Diagnostics;
//using Ninject.Modules;
//namespace Tanshu.Accounts.Repository
//{
// public class RepositoryModule : NinjectModule
// {
// public override void Load()
// {
// Bind<ISessionFactory>().ToMethod(m => SessionRepository.GetSessionFactory()).InSingletonScope();
// Bind<ISession>().ToMethod (m=>m.Kernel.
// Bind<ISession>().To<Sword>();
// Bind<Samurai>().ToSelf();
// }
// }
//}
@@ -0,0 +1,48 @@
//using FluentNHibernate.Automapping;
//using FluentNHibernate.Cfg;
//using FluentNHibernate.Cfg.Db;
//using NHibernate;
//using NHibernate.Cfg;
//using Tanshu.Accounts.Conventions;
//using Tanshu.Accounts.Entities;
//using Tanshu.Accounts.SqlDAO;
//namespace Tanshu.Accounts.Repository
//{
// public class SessionRepository
// {
// public static Configuration GetConfiguration()
// {
// var storeConfiguration = new StoreConfiguration();
// var persistenceModel = AutoMap.AssemblyOf<Voucher>(storeConfiguration)
// .Conventions.Setup(c =>
// {
// c.Add<PrimaryKeyConvention>();
// c.Add<CustomForeignKeyConvention>();
// c.Add<ClassConvention>();
// c.Add<CascadeConvention>();
// c.Add<NotNullConvention>();
// //c.Add(DefaultLazy.Never());
// //c.Add<EnumConvention>();
// });
// return Fluently.Configure()
// .Database(MsSqlConfiguration.MsSql2005.ConnectionString(p => p.FromConnectionStringWithKey("FluentCon")))
// .Mappings(m => m.AutoMappings.Add(persistenceModel))
// .BuildConfiguration()
// .SetInterceptor(new NHSQLInterceptor());
// }
// public static ISessionFactory GetSessionFactory()
// {
// return GetConfiguration().BuildSessionFactory();
// }
// public static ISession GetSession(ISessionFactory factory)
// {
// return factory.OpenSession();
// }
// public static IStatelessSession GetStatelessSession(ISessionFactory factory)
// {
// return factory.OpenStatelessSession();
// }
// }
//}
@@ -40,9 +40,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<Reference Include="Castle.Windsor, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\Castle.DynamicProxy2.dll</HintPath>
<HintPath>..\Include\Windsor\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate, Version=1.1.0.685, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -52,10 +52,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\log4net.dll</HintPath>
</Reference>
<Reference Include="NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\NHibernate.dll</HintPath>
@@ -64,6 +60,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Fluent\NHibernate.ByteCode.Castle.dll</HintPath>
</Reference>
<Reference Include="Ninject, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Include\Ninject\Ninject.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
@@ -96,6 +96,8 @@
<Compile Include="BusinessLayer\ManagementBI.cs" />
<Compile Include="Fluent\CascadeConvention.cs" />
<Compile Include="Fluent\NotNullConvention.cs" />
<Compile Include="Ninject\SessionRepository.cs" />
<Compile Include="Fluent\AllowNullConvention.cs" />
<Compile Include="Fluent\SettleOptionFactory.cs" />
<Compile Include="Fluent\EnumConvention.cs" />
<Compile Include="Fluent\QueryStore.cs" />
@@ -121,6 +123,7 @@
<Compile Include="DbValues.cs" />
<Compile Include="Fluent\Inflector.cs" />
<Compile Include="Fluent\SetupStore.cs" />
<Compile Include="Ninject\QueryStore.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>