public async Task <ProjectResult> CustomerRegistrationDatacustid(tblCustomerRegistration model) { try { var result1 = _db.tblCustomerRegistrations.Where(a => a.CustId == model.CustId && a.IMEINo == model.IMEINo && a.OperatorCode == model.OperatorCode).ToList(); if (result1 != null) { return(new ProjectResult { Message = "Sucsessfully", Status = 1, Response = result1 }); } 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> CustomerRegistrationDelete(tblCustomerRegistration model) { try { var result = _db.tblCustomerRegistrations.Where(a => a.CustId == model.CustId && a.IMEINo == model.IMEINo && a.OperatorCode == model.OperatorCode).FirstOrDefault(); _db.Entry(result).State = System.Data.Entity.EntityState.Deleted; _db.SaveChanges(); if (result != null) { return(new ProjectResult { Message = "Sucsessfully", Status = 1, Response = result }); } 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> Mobileupdate(tblCustomerRegistration model) { try { if (ModelState.IsValid) { tblCustomerRegistration _objcr = new tblCustomerRegistration(); _objcr = _db.tblCustomerRegistrations.Where(a => a.CustId == model.CustId && a.OperatorCode == model.OperatorCode).FirstOrDefault(); _objcr.MobileNo = model.MobileNo; _db.Entry(_objcr).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); return(new ProjectResult { Message = "Success", Status = 1, Response = _objcr }); } else { return(new ProjectResult { Message = "Failed", Status = 0, Response = null }); } } catch (Exception exp) { return(new ProjectResult { Message = exp.ToString(), Status = 0, Response = null }); } }
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> 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 }); } }
public async Task <ProjectResult> CustomerRegistration(tblCustomerRegistration model) { try { var result1 = _db.tblCustomerRegistrations.Where(a => a.CustName == model.CustName && a.IMEINo == model.IMEINo).ToList(); if (result1.Count != 0) { return(new ProjectResult { Message = "User Already Exist", Status = 0, Response = result1 }); } else { tblCustomerRegistration _objCustomer = new tblCustomerRegistration(); _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; if (_objCustomer.OldBal == null) { _objCustomer.OldBal = 0; } else { _objCustomer.OldBal = model.OldBal; } _objCustomer.RegistrationDate = model.RegistrationDate; _objCustomer.AgentName = model.AgentName; _objCustomer.Status = model.Status; _objCustomer.IMEINo = model.IMEINo; _objCustomer.OperatorCode = model.OperatorCode; _db.tblCustomerRegistrations.Add(_objCustomer); _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 }); } }