Exemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            List <AdvancePaymentItem> objPay = new List <AdvancePaymentItem>();

            objPayItem = new AdvancePaymentItem();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            objPayItem = objPayService.GetById(id);
            objPay     = objPayService.GetPaymentDetails(cid);
            objPayItem.ListAdvPayment = new List <AdvancePaymentItem>();
            objPayItem.ListAdvPayment.AddRange(objPay);

            #region Bind DropDown Comp
            List <CompanyItem> lstComp = new List <CompanyItem>();
            lstComp             = objPayService.GetAllComp();
            objPayItem.ListComp = new List <CompanyItem>();
            objPayItem.ListComp.AddRange(lstComp);
            #endregion

            #region Bind DropDown Emp
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();
            lstEmp             = objPayService.GetEmp(cid);
            objPayItem.ListEmp = new List <EmployeeItem>();
            objPayItem.ListEmp.AddRange(lstEmp);
            #endregion

            return(View(objPayItem));
        }
Exemplo n.º 2
0
        public ActionResult Create(AdvancePaymentItem model)
        {
            objPayService = new AdvancePaymentService();
            objPayItem    = new AdvancePaymentItem();
            objPayService.Insert(model);

            #region Bind DropDown Comp
            List <CompanyItem> lstComp = new List <CompanyItem>();
            lstComp             = objPayService.GetAllComp();
            objPayItem.ListComp = new List <CompanyItem>();
            objPayItem.ListComp.AddRange(lstComp);
            #endregion
            int cid = 0;
            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            #region Bind DropDown Emp
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();
            lstEmp             = objPayService.GetEmp(cid);
            objPayItem.ListEmp = new List <EmployeeItem>();
            objPayItem.ListEmp.AddRange(lstEmp);
            #endregion

            List <AdvancePaymentItem> objPay = new List <AdvancePaymentItem>();
            objPay = objPayService.GetPaymentDetails(cid);
            objPayItem.ListAdvPayment = new List <AdvancePaymentItem>();
            objPayItem.ListAdvPayment.AddRange(objPay);
            return(RedirectToAction("Create"));
        }
Exemplo n.º 3
0
        public ActionResult Edit(AdvancePaymentItem Model)
        {
            AdvancePaymentService objPayService = new AdvancePaymentService();
            AdvancePaymentItem    objPayItem    = new AdvancePaymentItem();

            objPayService.Update(Model);
            return(RedirectToAction("Create"));
        }
Exemplo n.º 4
0
        public int Update(AdvancePaymentItem model)
        {
            //  model.CreatedDate = System.DateTime.Now;
            model.UpdatedDate = System.DateTime.Now;
            Mapper.CreateMap <AdvancePaymentItem, Advance_Payroll_Master>();
            Advance_Payroll_Master objRep = DbContext.Advance_Payroll_Master.SingleOrDefault(m => m.Id == model.Id);

            objRep = Mapper.Map(model, objRep);
            return(DbContext.SaveChanges());
        }
Exemplo n.º 5
0
        public int Insert(AdvancePaymentItem model)
        {
            Advance_Payroll_Master objPayItem = new Advance_Payroll_Master();

            objPayItem.CompId      = model.CompId;
            objPayItem.EmpId       = model.EmpId;
            objPayItem.AdvAmount   = model.AdvAmount;
            objPayItem.CreatedDate = System.DateTime.Now;
            objPayItem.UpdatedDate = System.DateTime.Now;
            DbContext.Advance_Payroll_Master.Add(objPayItem);
            return(DbContext.SaveChanges());
        }
Exemplo n.º 6
0
 public AdvancePaymentItem GetById(int id)
 {
     try
     {
         Mapper.CreateMap <Advance_Payroll_Master, AdvancePaymentItem>();
         Advance_Payroll_Master objAdvance     = DbContext.Advance_Payroll_Master.SingleOrDefault(m => m.Id == id);
         AdvancePaymentItem     objAdvanceItem = Mapper.Map <AdvancePaymentItem>(objAdvance);
         return(objAdvanceItem);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }