public void SaveUpdateRecord(PenaltySlabViewModel penalty)
        {
            Mst_PenaltySlab tblPenaltySlab = new Mst_PenaltySlab();

            try
            {
                if (penalty.EditID <= 0)
                {
                    penalty.ID                        = _context.Mst_PenaltySlab.Any() ? _context.Mst_PenaltySlab.Max(m => m.Ps_Id) + 1 : 1;
                    tblPenaltySlab.Ps_Id              = penalty.ID;
                    tblPenaltySlab.Ps_RecordCreated   = DateTime.Now;
                    tblPenaltySlab.Ps_RecordCreatedBy = penalty.CreatedBy;
                    _context.Mst_PenaltySlab.Add(tblPenaltySlab);
                }
                else
                {
                    tblPenaltySlab = _context.Mst_PenaltySlab.Where(x => x.Ps_Id == penalty.ID).FirstOrDefault();
                }
                tblPenaltySlab.Ps_Datewef         = Convert.ToDateTime(penalty.Datewef);
                tblPenaltySlab.Ps_Penalty         = penalty.PenaltyAmount;
                tblPenaltySlab.Ps_Accounthead     = penalty.AccountHead;
                tblPenaltySlab.Ps_RecordUpdated   = DateTime.Now;
                tblPenaltySlab.Ps_RecordUpdatedBy = penalty.UpdatedBy;
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult PenaltySlab()
        {
            ButtonVisiblity("Index");
            var model = new PenaltySlabViewModel();

            model.ID = _penaltySlabService.GetMaxPkNo();
            ViewBag.AccountHeadList = new SelectList(_penaltySlabService.GetAccountHeadList(), "AccountID", "Name");
            return(View(model));
        }
Beispiel #3
0
        public ActionResult PenaltySlab()
        {
            ButtonVisiblity("Index");
            var model = new PenaltySlabViewModel();

            model.ID = dd._context.Mst_PenaltySlab.Any() ? dd._context.Mst_PenaltySlab.Max(m => m.Ps_Id) + 1 : 1;
            ViewBag.AccountHeadList = new SelectList(dd._context.tblaccountmasters.ToList(), "AccountID", "Name");
            return(View(model));
        }
        public PenaltySlabViewModel SetRecordinEdit(Mst_PenaltySlab tblPenalty)
        {
            PenaltySlabViewModel penalty = new PenaltySlabViewModel();

            penalty.ID            = tblPenalty.Ps_Id;
            penalty.EditID        = tblPenalty.Ps_Id;
            penalty.Datewef       = tblPenalty.Ps_Datewef.ToString("dd/MM/yyyy");
            penalty.PenaltyAmount = tblPenalty.Ps_Penalty;
            penalty.AccountHead   = tblPenalty.Ps_Accounthead;
            return(penalty);
        }
 public JsonResult CreateEdit(PenaltySlabViewModel penalty)
 {
     penalty.CreatedBy = Convert.ToInt32(Session["UserLoginId"]);
     penalty.UpdatedBy = Convert.ToInt32(Session["UserLoginId"]);
     try
     {
         _penaltySlabService.SaveUpdateRecord(penalty);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     return(Json(penalty));
 }
        public ActionResult GetPenaltySlabById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            ViewBag.AccountHeadList = new SelectList(_penaltySlabService.GetAccountHeadList(), "AccountID", "Name");
            var penalty     = new PenaltySlabViewModel();
            var tblPenalaty = _penaltySlabService.GetPenaltySlabById(ID);

            if (tblPenalaty != null)
            {
                penalty = _penaltySlabService.SetDataOnEdit(tblPenalaty);
            }
            return(View("PenaltySlab", penalty));
        }
Beispiel #7
0
        public ActionResult GetPenaltySlabById(int ID)
        {
            string operation = Session["Operation"].ToString();

            ButtonVisiblity(operation);
            ViewBag.AccountHeadList = new SelectList(dd._context.tblaccountmasters.ToList(), "AccountID", "Name");
            Mst_PenaltySlab      tblPenalty = dd._context.Mst_PenaltySlab.Where(x => x.Ps_Id == ID).FirstOrDefault();
            PenaltySlabViewModel penalty    = new PenaltySlabViewModel();

            penalty.ID            = tblPenalty.Ps_Id;
            penalty.EditID        = tblPenalty.Ps_Id;
            penalty.Datewef       = tblPenalty.Ps_Datewef.ToString("dd/MM/yyyy");
            penalty.PenaltyAmount = tblPenalty.Ps_Penalty;
            penalty.AccountHead   = tblPenalty.Ps_Accounthead;
            penalty.operation     = operation;
            return(View("PenaltySlab", penalty));
        }
        public List <PenaltySlabViewModel> SetDataofModalList()
        {
            List <PenaltySlabViewModel> list = new List <PenaltySlabViewModel>();
            var model     = new PenaltySlabViewModel();
            var tablelist = _context.Mst_PenaltySlab.ToList();

            foreach (var item in tablelist)
            {
                model                = new PenaltySlabViewModel();
                model.Datewef        = item.Ps_Datewef.ToString("dd/MM/yyyy");
                model.EditID         = item.Ps_Id;
                model.ID             = item.Ps_Id;
                model.PenaltyAmount  = item.Ps_Penalty;
                model.AccountHeadStr = _context.tblaccountmasters.Where(x => x.AccountID == item.Ps_Accounthead).Select(x => x.Name).FirstOrDefault();
                list.Add(model);
            }
            return(list);
        }
Beispiel #9
0
        public ActionResult GetPenaltySlabTable(string Operation)
        {
            Session["Operation"] = Operation;
            List <PenaltySlabViewModel> list = new List <PenaltySlabViewModel>();
            var model     = new PenaltySlabViewModel();
            var tablelist = dd._context.Mst_PenaltySlab.ToList();

            foreach (var item in tablelist)
            {
                model                = new PenaltySlabViewModel();
                model.Datewef        = item.Ps_Datewef.ToString("dd/MM/yyyy");
                model.EditID         = item.Ps_Id;
                model.ID             = item.Ps_Id;
                model.PenaltyAmount  = item.Ps_Penalty;
                model.AccountHeadStr = dd._context.tblaccountmasters.Where(x => x.AccountID == item.Ps_Accounthead).Select(x => x.Name).FirstOrDefault();
                list.Add(model);
            }
            return(PartialView("_PenaltySlablist", list));
        }
Beispiel #10
0
 public ActionResult Insert(PenaltySlabViewModel objViewModel)
 {
     ModelState.Remove("Id");
     if (objViewModel.ID == 0)
     {
         if (InsertData(objViewModel))
         {
             return(Json(1, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(3, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         if (InsertData(objViewModel))
         {
             return(Json(2, JsonRequestBehavior.AllowGet));
         }
     }
     return(View("Index", objViewModel));
 }
Beispiel #11
0
        public bool InsertData(PenaltySlabViewModel penalty)
        {
            bool retVal = false;

            penalty.CreatedBy = Convert.ToInt32(Session["UserLoginId"]);
            penalty.UpdatedBy = Convert.ToInt32(Session["UserLoginId"]);
            Mst_PenaltySlab tblPenaltySlab = new Mst_PenaltySlab();

            try
            {
                if (penalty.EditID <= 0)
                {
                    penalty.ID                        = dd._context.Mst_PenaltySlab.Any() ? dd._context.Mst_PenaltySlab.Max(m => m.Ps_Id) + 1 : 1;
                    tblPenaltySlab.Ps_Id              = penalty.ID;
                    tblPenaltySlab.Ps_RecordCreated   = DateTime.Now;
                    tblPenaltySlab.Ps_RecordCreatedBy = penalty.CreatedBy;
                    dd._context.Mst_PenaltySlab.Add(tblPenaltySlab);
                }
                else
                {
                    tblPenaltySlab = dd._context.Mst_PenaltySlab.Where(x => x.Ps_Id == penalty.ID).FirstOrDefault();
                }
                tblPenaltySlab.Ps_Datewef         = Convert.ToDateTime(penalty.Datewef);
                tblPenaltySlab.Ps_Penalty         = penalty.PenaltyAmount;
                tblPenaltySlab.Ps_Accounthead     = penalty.AccountHead;
                tblPenaltySlab.Ps_RecordUpdated   = DateTime.Now;
                tblPenaltySlab.Ps_RecordUpdatedBy = penalty.UpdatedBy;
                dd._context.SaveChanges();
                retVal = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retVal);
        }
 public void SaveUpdateRecord(PenaltySlabViewModel model)
 {
     _penaltyslabRepository.SaveUpdateRecord(model);
 }