示例#1
0
        public OtherExpItem GetById(int id)
        {
            Mapper.CreateMap <Other_Expenses, OtherExpItem>();
            Other_Expenses objOExp     = DbContext.Other_Expenses.SingleOrDefault(m => m.OEID == id);
            OtherExpItem   objOExpITem = Mapper.Map <OtherExpItem>(objOExp);

            return(objOExpITem);
        }
示例#2
0
        public ActionResult Create()
        {
            List <OtherExpItem> lstOExp = new List <OtherExpItem>();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }

            OtherExpService objOExp = new OtherExpService();

            lstOExp = objOExp.OtherExpData(cid);
            OtherExpItem objOExpItem = new OtherExpItem();

            objOExpItem.ListOExp = new List <OtherExpItem>();
            objOExpItem.ListOExp.AddRange(lstOExp);

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

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

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch = objOExp.GetBranch();
            objOExpItem.ListBranch = new List <BranchItem>();
            objOExpItem.ListBranch.AddRange(lstBranch);

            #endregion

            #region Bind DropDown Exp
            List <clsMasterData> lstMasters1 = new List <clsMasterData>();
            lstMasters1            = objOExp.GetExp();
            objOExpItem.ListMaster = new List <clsMasterData>();
            objOExpItem.ListMaster.AddRange(lstMasters1);

            #endregion

            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objOExpItem));
        }
示例#3
0
 public int Insert(OtherExpItem model)
 {
     try
     {
         Mapper.CreateMap <OtherExpItem, Other_Expenses>();
         Other_Expenses objOExp = Mapper.Map <Other_Expenses>(model);
         DbContext.Other_Expenses.Add(objOExp);
         return(DbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
示例#4
0
        public ActionResult Edit(OtherExpItem model)
        {
            OtherExpService objTExp = new OtherExpService();
            string          uid     = null;

            if (Session["UserId"] != null)
            {
                uid = Session["UserId"].ToString();
            }
            model.UpdateBy    = uid;
            model.UpdatedDate = System.DateTime.Now;
            objTExp.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
示例#5
0
        public int Update(OtherExpItem model)
        {
            Other_Expenses TE = new Other_Expenses();

            TE          = DbContext.Other_Expenses.SingleOrDefault(m => m.OEID == model.OEID);
            TE.CompID   = model.CompID;
            TE.EmpID    = model.EmpID;
            TE.Date     = model.Date;
            TE.BranchID = model.BranchID;
            TE.ExpID    = model.ExpID;
            TE.Remarks  = model.Remarks;
            TE.Amount   = model.Amount;
            //TE.Status = model.Status;
            TE.UpdateBy    = model.UpdateBy;
            TE.UpdatedDate = model.UpdatedDate;
            return(DbContext.SaveChanges());
        }
示例#6
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         OtherExpService objTenService = new OtherExpService();
         OtherExpItem    objDoc        = new OtherExpItem();
         objDoc = objTenService.GetById(id);
         db.Other_Expenses.Remove(db.Other_Expenses.Find(id));
         db.SaveChanges();
         //ViewBag.Empid = Empid;
         ViewBag.Menuid = Request.QueryString["menuId"];
     }
     catch (Exception ex)
     {
         //ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. ";
         return(View("Error"));
     }
     return(RedirectToAction("Create", new { @menuId = Request.QueryString["menuId"] }));
 }
示例#7
0
        public ActionResult View(int id)
        {
            OtherExpService objOExpService = new OtherExpService();
            OtherExpItem    objOExpItem    = new OtherExpItem();

            objOExpItem = objOExpService.GetById(id);
            List <OtherExpItem> lstVehicle = new List <OtherExpItem>();

            objOExpItem.ListOExp = new List <OtherExpItem>();
            objOExpItem.ListOExp.AddRange(lstVehicle);

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

            #region Bind DropDown Emp
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();
            lstEmp = objOExpService.GetEmp();
            objOExpItem.ListEmp = new List <EmployeeItem>();
            objOExpItem.ListEmp.AddRange(lstEmp);
            #endregion
            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch = objOExpService.GetBranch();
            objOExpItem.ListBranch = new List <BranchItem>();
            objOExpItem.ListBranch.AddRange(lstBranch);

            #endregion
            #region Bind DropDown Exp
            List <clsMasterData> lstMasters1 = new List <clsMasterData>();
            lstMasters1            = objOExpService.GetExp();
            objOExpItem.ListMaster = new List <clsMasterData>();
            objOExpItem.ListMaster.AddRange(lstMasters1);
            #endregion
            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objOExpItem));
        }
示例#8
0
        public ActionResult Create(OtherExpItem model)
        {
            OtherExpService objTExp = new OtherExpService();
            int             cid     = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            if (model.CompID == null)
            {
                model.CompID = cid;
            }
            string uid = null;

            if (Session["UserId"] != null)
            {
                uid = Session["UserId"].ToString();
            }
            model.CreatedBy   = uid;
            model.CreatedDate = System.DateTime.Now;
            objTExp.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }