public JsonResult DeleteTellerSetup(TblTellersetup Setteller) { var item = RetailUnitOfWork.tellerSetup.GetById(Setteller.Id); item.Isdelete = true; RetailUnitOfWork.tellerSetup.Update(item); RetailUnitOfWork.Commit(); return(Json(Setteller.Id)); }
public JsonResult AddTellerSetup(TblTellersetup Setteller) { Setteller.Companyid = 1; Setteller.Branchid = 1; Setteller.Datecreated = DateTime.Now; Setteller.Createdby = "peter"; //Setteller.Createdby = User.Identity.Name; var tillName = RetailUnitOfWork.tillLimit.GetAll().Where(p => p.Id == Setteller.Tilllimitid).FirstOrDefault().Tillname; Setteller.Tillname = tillName; var tillUser = LoadStaffs() .Where(p => p.Id == Setteller.Staffinformationid.ToString()) .FirstOrDefault().StaffName; Setteller.Tilluser = tillUser; var tillLedger = RetailUnitOfWork.tillLimit.GetDetailed().Where(p => p.Id == Setteller.Tilllimitid).FirstOrDefault().Ledgeraccount; Setteller.Tillaccountnumber = tillLedger; var tillLedgerName = RetailUnitOfWork.tillLimit.GetDetailed().Where(p => p.Id == Setteller.Tilllimitid).FirstOrDefault().Tillname; Setteller.Tillaccountnumber = tillLedger; var LoginCounter = RetailUnitOfWork.tellerlogin.GetAll().Where(t => t.Accountid == Setteller.Tillaccountnumber).Count(); if (LoginCounter == 0) { TblTellerlogin loginteller = new TblTellerlogin(); loginteller.Accountid = tillLedger.ToString(); loginteller.Ledgername = tillLedger; loginteller.Username = tillUser; RetailUnitOfWork.tellerlogin.Add(loginteller); } RetailUnitOfWork.tellerSetup.Add(Setteller); RetailUnitOfWork.Commit(); return(Json(Setteller.Id)); }
public JsonResult updateTellerSetup(TblTellersetup Setteller) { var tillUser = LoadStaffs() .Where(p => p.Id == Setteller.Staffinformationid.ToString()) .FirstOrDefault().StaffName; Setteller.Tilluser = tillUser; //var tillAccountnumber = RetailUnitOfWork.tillMapping.GetAll().Where(p => p.Id == Setteller.Tillmappingid).FirstOrDefault().Accountid; //Setteller.Tillaccountnumber = tillAccountnumber; var tillLedger = RetailUnitOfWork.tillLimit.GetDetailed().Where(p => p.Id == Setteller.Tilllimitid).FirstOrDefault().Ledgeraccount; Setteller.Tillaccountnumber = tillLedger; var tillName = RetailUnitOfWork.tillLimit.GetAll().Where(p => p.Id == Setteller.Tilllimitid).FirstOrDefault().Tillname; Setteller.Tillname = tillName; RetailUnitOfWork.tellerSetup.Update(Setteller); RetailUnitOfWork.Commit(); return(Json(Setteller.Id)); }