LLBLGen 3.5
.Net framework 4.0
C# windows application
SQL Server 2005
I am trying to do insert and udpate entity but the line which is in **bold **below does not update the entity. Created trace file to trace queries but noticed it did not generate update query at all. Unable to find reason, hence request help.
var Uowguestregistrationsave = new UnitOfWork();
try
{
Int64 BillNo = 2; //BillCounter.BillCounterGuestRegistaration();
if (BillNo == 0)
{
MessageBox.Show("Failed to generate bill number");
return 0;
}
string[] Uno = Convert.ToString(InserId.Rows[0]["USERNO"]).Split(' ');
............
var GuestRegistration = new GuestregnheaderEntity();
.............
Uowguestregistrationsave.AddForSave(GuestRegistration);
for (int i = 0; i < dgridguest.Rows.Count - 1; i++)
{
...........
decimal total = Convert.ToDecimal(InserId.Rows[0]["TOTAL"]);
int Monthlybillid = Convert.ToInt32(InserId.Rows[0]["MONTHLYBILLID"]);
var monthlybill = new MonthlybillEntity(Monthlybillid);
if (Monthlybillid == 0) return 0;
{
monthlybill.IsNew = false;
monthlybill.Fields[(int) MonthlybillFieldIndex.Debitamount].ExpressionToApply =
(MonthlybillFields.Debitamount + total);
monthlybill.Fields[(int) MonthlybillFieldIndex.Balanceamount].ExpressionToApply =
(MonthlybillFields.Balanceamount + total);
** Uowguestregistrationsave.AddForSave(monthlybill);**
}
.........
Uowguestregistrationsave.AddForSave(monthlybilldetail);
}
else
{
var monthlybilldetail = new MonthlybilldetailEntity(MonthlybilldetailId);
monthlybilldetail.IsNew = false;
monthlybilldetail.Fields[(int) MonthlybilldetailFieldIndex.Debitamount].ExpressionToApply =
(MonthlybilldetailFields.Debitamount +
total);
Uowguestregistrationsave.AddForSave(monthlybilldetail);
}
int succeeded = Uowguestregistrationsave.Commit(
new Transaction(IsolationLevel.ReadCommitted, "UOW"), true);
return succeeded;