Exemplo n.º 1
0
        public ActionResult Create()
        {
            ViewBag.CodeItemID = new SelectList(DataRepository.GetCodeItems() , "Id", "Description");

               var debtor = new Debtor { CallCollection = new List<CallHistory>(), VisitCollection = new List<SiteVisit>() };
            debtor.SalesDate = DateTime.MinValue;

            return View(debtor);
        }
Exemplo n.º 2
0
        public ActionResult Create(Debtor debtObj)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    // do something.
                    Response.Write("Debtor with the same account '" + debtObj.AcNo + "' already exists");
                    Response.StatusCode = 404;
                    Response.End();
                }

                if (_debtorList == null)
                {
                    _debtorList = (List<Debtor>)DataRepository.GetDebtors();
                }
                if (debtObj.AcNo != null)
                {
                    if (_debtorList.Any(c => c.AcNo.ToLower().Equals(debtObj.AcNo.ToLower())))
                    {
                        //Response.Write("Debtor with the same account '" + debtObj.AcNo + "' already exists");
                        //Response.StatusCode = 404;
                        //Response.End();
                        ShowErrorView("Debtor with the same account '" + debtObj.AcNo + "' already exists");
                        ViewBag.messageString = "Debtor with the same account '" + debtObj.AcNo + "' already exists";
                        return View(debtObj);
                    }
                    else
                    {
                        _debtorList.Add(debtObj);
                        //TODO invoke save action.

                    }
                }

                return View(debtObj);
                //return RedirectToAction("Create");
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 3
0
        public int AddData(string name, string cardno, decimal osamount, string status, string assignto, int? country)
        {
            IList<Debtor> debtors = DataRepository.GetDebtors();
            if (debtors.Any(c => c.Name.ToLower().Equals(name.ToLower())))
            {
                Response.Write("Debtor with the name '" + name + "' already exists");
                Response.StatusCode = 404;
                Response.End();
                return -1;
            }

            var debtor = new Debtor();
            debtor.Name = name;
            debtor.CardNo = cardno;
            debtor.OSAmount = osamount;
            debtor.Status = Convert.ToInt32(status);
            debtor.AssignTo = assignto;
            debtors.Add(debtor);
            return debtor.Id;
        }
Exemplo n.º 4
0
        public ActionResult Edit(string id, Debtor crModel)
        {
            try
            {
                if (id == null)
                {
                    // TODO: Add logic here
                    _debtorList.Add(crModel);
                }
                else
                {
                    List<Debtor> list = _debtorList.Where(c => c.Id == Convert.ToInt32(id)).ToList();
                    // TODO: Add update logic here
                }

                return RedirectToAction("Customization");
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 5
0
        //
        // GET: /Creditor/Edit/5
        public ActionResult Edit(string id)
        {
            if (_debtorList == null)
            {
                _debtorList = (List<Debtor>)DataRepository.GetDebtors();
            }

            if (id == null)
            {

                var debtor = new Debtor { CallCollection = new List<CallHistory>(), VisitCollection = new List<SiteVisit>(), PaymentCollection = new List<PaymentMaster>() };

                return View(debtor);
            }
            var debt = _debtorList.FirstOrDefault(c => c.Id == Convert.ToInt32(id));

            debt.CallCollection.Add(new CallHistory{AccNo="Ac122",Collector ="Adira",FollowUpDate=DateTime.Now.AddDays(3) ,Id=id,LastStatus="PTS",PtpAmount =20000,Remarks="Refuse to pay",RmksDate =DateTime.Now });
            debt.CallCollection.Add(new CallHistory { AccNo = "Ac122", Collector = "Najib", FollowUpDate = DateTime.Now.AddDays(5), Id = id, LastStatus = "CP", PtpAmount = 20000, Remarks = "Refuse to pay", RmksDate = DateTime.Now });

            debt.VisitCollection.Add(new SiteVisit { AccNo = "Ac122",CollectorName  = "Adira",Id =id,Location="Mantin",Remarks="Very poor",RemarksDate=DateTime.Now.AddDays(-5) ,VisitDate=DateTime.Now } );
            debt.VisitCollection.Add(new SiteVisit { AccNo = "Ac133", CollectorName = "Azmi", Id = id, Location = "Pilah", Remarks = "Very arrogant", RemarksDate = DateTime.Now.AddDays(-10), VisitDate = DateTime.Now });

            debt.PaymentCollection.Add(new PaymentMaster { AccNo = "Ac122", Balance = 40000, PaidAmt = 1000, PaidDate = DateTime.Now.AddDays(-5), BatchNo = "MTSB1", ColectorComm = 0, Comm = 0, Id = Convert.ToInt32(id), OweTo = "BIMB", Remarks = "RECEIPT NO: R140100099360" });
            debt.PaymentCollection.Add(new PaymentMaster { AccNo = "Ac122", Balance = 30000, PaidAmt = 1000, PaidDate = DateTime.Now, BatchNo = "MTSB1", ColectorComm = 0, Comm = 0, Id = Convert.ToInt32(id), OweTo = "BIMB", Remarks = "RECEIPT NO: R140100099361" });

            //set valus dropdown status
            ViewBag.CodeItemID = new SelectList(DataRepository.GetCodeItems(), "Id", "Description", debt.Status);
            //set values count status

            //return View(_debtorList.FirstOrDefault(c => c.Id == Convert.ToInt32(id)));
            return View(debt);
        }