コード例 #1
0
        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));
        }
コード例 #2
0
        public async Task <ProjectResult> AllBillDetails(tblPaidBillModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var result = _db.tblBills.Where(psd => psd.Bmonth == model.Bmonth && psd.Byear == model.Byear && psd.IMEINo == model.IMEINo && psd.OperatorCode == model.OperatorCode).ToList();

                    return(new ProjectResult {
                        Message = "Success", Status = 1, Response = result
                    });
                }
                else
                {
                    return(new ProjectResult {
                        Message = "Failed", Status = 0, Response = null
                    });
                }
            }
            catch (Exception exp)
            {
                return(new ProjectResult {
                    Message = exp.ToString(), Status = 0, Response = null
                });
            }
        }
コード例 #3
0
        public ActionResult PaidBill(tblPaidBillModel model)
        {
            model.Bmonth = Convert.ToString(DateTime.Now.ToString("MMM"));
            model.Byear  = Convert.ToString(DateTime.Now.Year);

            var result = _objReg.AllBillDetails(model);

            return(View(result.Result.Response));
        }
コード例 #4
0
        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
                });
            }
        }