public Int32 postDebitCredit() { try { Data.TrnDebitCreditMemo newDebitCredit = new Data.TrnDebitCreditMemo(); newDebitCredit.PeriodId = PeriodId(); newDebitCredit.DCMemoNumber = "n/a"; newDebitCredit.DCMemoDate = DateTime.Today; newDebitCredit.Particulars = "n/a"; newDebitCredit.PreparedBy = UserId(); newDebitCredit.CheckedBy = UserId(); newDebitCredit.ApprovedBy = UserId(); newDebitCredit.IsLocked = false; newDebitCredit.EntryUserId = UserId(); newDebitCredit.EntryDateTime = DateTime.Today; newDebitCredit.UpdateUserId = UserId(); newDebitCredit.UpdateDateTime = DateTime.Today; db.TrnDebitCreditMemos.InsertOnSubmit(newDebitCredit); db.SubmitChanges(); return(newDebitCredit.Id); } catch (Exception e) { return(0); } }
public int Post(Models.TrnDebitCreditMemo debitcreditmemo) { try { var isLocked = true; var identityUserId = User.Identity.GetUserId(); var mstUserId = (from d in db.MstUsers where "" + d.Id == identityUserId select d.Id).SingleOrDefault(); var date = DateTime.Now; Data.TrnDebitCreditMemo newDebitCreditMemo = new Data.TrnDebitCreditMemo(); // newDebitCreditMemo.PeriodId = debitcreditmemo.PeriodId; newDebitCreditMemo.DCMemoNumber = debitcreditmemo.DCMemoNumber; newDebitCreditMemo.DCMemoDate = Convert.ToDateTime(debitcreditmemo.DCMemoDate); newDebitCreditMemo.Particulars = debitcreditmemo.Particulars; newDebitCreditMemo.PreparedBy = debitcreditmemo.PreparedBy; newDebitCreditMemo.CheckedBy = debitcreditmemo.CheckedBy; newDebitCreditMemo.ApprovedBy = debitcreditmemo.ApprovedBy; newDebitCreditMemo.IsLocked = isLocked; newDebitCreditMemo.EntryUserId = mstUserId; newDebitCreditMemo.EntryDateTime = date; newDebitCreditMemo.UpdateDateTime = date; newDebitCreditMemo.UpdateUserId = mstUserId; // db.TrnDebitCreditMemos.InsertOnSubmit(newDebitCreditMemo); db.SubmitChanges(); return newDebitCreditMemo.Id; } catch { return 0; } }