Ejemplo n.º 1
0
        private static Remittance getEntityByModel(RemittanceDetailModel model, int count)
        {
            if (model == null)
            {
                return(null);
            }

            Remittance entity = new Remittance();

            if (count == 0)
            {
                entity.CreateBy   = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
                entity.CompanyId  = AuthenticationHelper.CompanyId.Value;
            }
            else
            {
                entity.CreateBy   = model.CreateBy;
                entity.CreateDate = model.CreateDate;
                entity.CompanyId  = model.CompanyId;
            }

            entity.BankAccountId = model.BankAccountId;
            entity.BankId        = model.BankId;
            entity.Id            = model.Id;
            entity.ReceiptId     = model.ReceiptId;
            entity.RemitDate     = model.RemitDate;
            entity.RemitNo       = model.RemitNo;
            entity.SOBId         = model.SOBId;
            entity.UpdateBy      = AuthenticationHelper.UserId;
            entity.UpdateDate    = DateTime.Now;
            return(entity);
        }
Ejemplo n.º 2
0
        public static void DeleteRemittanceDetail(RemittanceDetailModel model)
        {
            RemittanceModel       remittance       = SessionHelper.Remittance;
            RemittanceDetailModel remittanceDetail = remittance.Remittances.FirstOrDefault(x => x.Id == model.Id);

            remittance.Remittances.Remove(remittanceDetail);
        }
Ejemplo n.º 3
0
        public ActionResult AddNewPartial(RemittanceDetailModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    //bool validated = false;
                    //if (SessionHelper.Remittance != null)
                    //{
                    //    model.Id = SessionHelper.Remittance.Remittances.Last().Id + 1;
                    //    validated = true;
                    //}
                    //else
                    //    model.Id = 1;

                    //if (validated)
                    //    RemittanceHelper.Insert(model);

                    if (SessionHelper.Remittance != null)
                    {
                        if (SessionHelper.Remittance.Remittances != null && SessionHelper.Remittance.Remittances.Count() > 0)
                        {
                            model.Id = SessionHelper.Remittance.Remittances.LastOrDefault().Id + 1;
                        }
                        else
                        {
                            model.Id = 1;
                        }
                    }
                    else
                    {
                        model.Id = 1;
                    }

                    RemittanceHelper.Insert(model);
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_Detail", RemittanceHelper.GetRemittanceDetail()));
        }
Ejemplo n.º 4
0
 public ActionResult UpdatePartial(RemittanceDetailModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             RemittanceHelper.UpdateRemittanceDetail(model);
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_Detail", RemittanceHelper.GetRemittanceDetail()));
 }
Ejemplo n.º 5
0
 public ActionResult DeletePartial(RemittanceDetailModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             RemittanceModel remittance = SessionHelper.Remittance;
             RemittanceHelper.DeleteRemittanceDetail(model);
             SessionHelper.Remittance = remittance;
             IList <RemittanceDetailModel> remittanceDetail = RemittanceHelper.GetRemittanceDetail();
             return(PartialView("_Detail", remittanceDetail));
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(PartialView("_Detail"));
     //return PartialView("_Detail", InvoiceHelper.GetInvoiceDetail());
 }
Ejemplo n.º 6
0
        public static void Insert(RemittanceDetailModel model)
        {
            RemittanceModel remittance = SessionHelper.Remittance;

            remittance.Remittances.Add(model);
        }
Ejemplo n.º 7
0
        public static void UpdateRemittanceDetail(RemittanceDetailModel model)
        {
            RemittanceModel remittance = SessionHelper.Remittance;

            remittance.Remittances.FirstOrDefault(x => x.Id == model.Id).ReceiptId = model.ReceiptId;
        }