public ActionResult PaidBillEdit(tblBill bill) { if (ModelState.IsValid) { tblPaidBillModel model = new tblPaidBillModel(); model.Bid = bill.Bid; model.PaymentAmount1 = bill.PaymentAmount1; model.PaymentAmount2 = bill.PaymentAmount2; model.PaymentDate1 = bill.PaymentDate1; model.PaymentDate2 = bill.PaymentDate2; model.Monthcharge = bill.Monthcharge; model.Balance = bill.Balance; _db.Entry(bill).State = EntityState.Modified; _db.SaveChanges(); var result = _objReg.PaidBill(model); return(RedirectToAction("Dashboard", "Admin")); } return(View(bill)); }
public async Task <ProjectResult> CustomerRegistrationEdit(tblCustomerRegistration model) { try { tblCustomerRegistration _objCustomer = _db.tblCustomerRegistrations.Where(a => a.CustId == model.CustId && a.IMEINo == model.IMEINo && a.OperatorCode == model.OperatorCode).FirstOrDefault(); // tblCustomerRegistration _objCustomer = (from psd in _db.tblCustomerRegistrations.Where(a => a.CustId == model.CustId && a.IMEINo == model.IMEINo && a.OperatorCode == model.OperatorCode) select psd).FirstOrDefault(); _objCustomer.CustName = model.CustName; _objCustomer.Address = model.Address; _objCustomer.MobileNo = model.MobileNo; _objCustomer.Area = model.Area; _objCustomer.NoOfBox = model.NoOfBox; _objCustomer.SetupBox_Details = model.SetupBox_Details; _objCustomer.Package = model.Package; _objCustomer.PackageRate = (model.PackageRate); _objCustomer.AgentName = model.AgentName; _objCustomer.Status = model.Status; _objCustomer.IMEINo = model.IMEINo; _objCustomer.OperatorCode = model.OperatorCode; _db.Entry(_objCustomer).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); if (_objCustomer != null) { return(new ProjectResult { Message = "Sucsessfully", Status = 1, Response = _objCustomer }); } else { return(new ProjectResult { Message = "Insert Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> ApprovalRequest(int id) { string OperatorCode = GenerateRandomChar() + Convert.ToString(GenerateRandomNo()); tblAdminRegistration _objAdmin = _db.tblAdminRegistrations.Find(id); try { var result = _db.tblAdminRegistrations.Where(psd => psd.OperatorCode == OperatorCode).ToList(); if (result.Count == 0) { _objAdmin.SkyStatus = 1; _objAdmin.OperatorCode = OperatorCode; _db.Entry(_objAdmin).State = EntityState.Modified; _db.SaveChanges(); } else { OperatorCode = GenerateRandomChar() + Convert.ToString(GenerateRandomNo()); _objAdmin.SkyStatus = 1; _objAdmin.OperatorCode = OperatorCode; _db.Entry(_objAdmin).State = EntityState.Modified; _db.SaveChanges(); } return(new ProjectResult { Message = "Success", Status = 1, Response = "Success" }); } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
public async Task <ProjectResult> PaidBill(tblPaidBillModel model) { try { if (ModelState.IsValid) { // var result = _db.tblBills.Where(psd=>psd.CustId==model.CustId).FirstOrDefault(); using (CableApiAndroidEntity _db = new CableApiAndroidEntity()) { tblBill _objBill = (from psd in _db.tblBills.Where(psd => psd.Bid == model.Bid) select psd).FirstOrDefault(); tblCustomerRegistration _objCust = (from psd in _db.tblCustomerRegistrations.Where(psd => psd.CustId == _objBill.CustId) select psd).FirstOrDefault(); if (model.PaymentAmount2 != 0 && model.PaymentDate2 != "") { //_objBill.PaymentAmount1 = model.PaymentAmount1; //_objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = model.PaymentAmount2; _objBill.PaymentDate2 = model.PaymentDate2; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } else { _objBill.PaymentAmount1 = model.PaymentAmount1; _objBill.PaymentDate1 = model.PaymentDate1; _objBill.PaymentAmount2 = 0; _objBill.PaymentDate2 = ""; _objBill.Balance = model.Balance; _objBill.Bid = model.Bid; } if (model.PaymentAmount1 != 0 && model.PaymentAmount2 == 0) { //_objBill.Balance = (model.Monthcharge-model.PaymentAmount1); _objCust.OldBal = model.Balance; } else { //_objBill.Balance = (model.Monthcharge - (model.PaymentAmount2 + model.PaymentAmount1)); _objCust.OldBal = model.Balance; } _db.Entry(_objBill).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); _db.Entry(_objCust).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(new ProjectResult { Message = "Success", Status = 1, Response = _objBill }); } } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }