예제 #1
0
        public int Update(TExpenseItem model)
        {
            TravelExpence TE = DbContext.TravelExpences.SingleOrDefault(m => m.Id == model.Id);

            TE.Companyid       = model.Companyid;
            TE.EmpId           = model.EmpId;
            TE.TDate           = model.TDate;
            TE.Country         = model.Country;
            TE.TFromDate       = model.TFromDate;
            TE.TToDate         = model.TToDate;
            TE.Fare            = model.Fare;
            TE.FromDate        = model.FromDate;
            TE.ToDate          = model.ToDate;
            TE.City            = model.City;
            TE.Id              = model.Id;
            TE.AccomodationExp = model.AccomodationExp;
            TE.FoodExp         = model.FoodExp;
            TE.OtherExp        = model.OtherExp;
            TE.Remarks         = model.Remarks;
            TE.Conv_Exp        = model.Conv_Exp;
            TE.Status          = model.Status;
            TE.UpdatedBy       = model.UpdatedBy;
            TE.UpdatedDate     = model.UpdatedDate;
            return(DbContext.SaveChanges());
        }
예제 #2
0
        public ActionResult Create(TExpenseItem model)
        {
            model.Status = "Active";
            TExpenseService objTExp = new TExpenseService();
            string          uid     = null;

            if (Session["UserId"] != null)
            {
                uid = Session["UserId"].ToString();
            }
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            if (model.Companyid == null)
            {
                model.Companyid = cid;
            }
            model.CreatedBy   = uid;
            model.CreatedDate = System.DateTime.Now;
            objTExp.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
예제 #3
0
        public TExpenseItem GetById(int id)
        {
            Mapper.CreateMap <TravelExpence, TExpenseItem>();
            TravelExpence objTExp     = DbContext.TravelExpences.SingleOrDefault(m => m.Id == id);
            TExpenseItem  objTExpItem = Mapper.Map <TExpenseItem>(objTExp);

            return(objTExpItem);
        }
예제 #4
0
        public ActionResult Edit(TExpenseItem model)
        {
            TExpenseService objTExp = new TExpenseService();
            string          uid     = null;

            if (Session["UserId"] != null)
            {
                uid = Session["UserId"].ToString();
            }
            model.UpdatedBy   = uid;
            model.UpdatedDate = System.DateTime.Now;
            objTExp.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
예제 #5
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         TExpenseService objTenService = new TExpenseService();
         TExpenseItem    objDoc        = new TExpenseItem();
         objDoc = objTenService.GetById(id);
         db.TravelExpences.Remove(db.TravelExpences.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"] }));
 }
예제 #6
0
        public ActionResult Create()
        {
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            List <TExpenseItem> lstTExp = new List <TExpenseItem>();
            TExpenseService     objTExp = new TExpenseService();

            lstTExp = objTExp.TExpenseData(cid);
            TExpenseItem objTExpItem = new TExpenseItem();

            objTExpItem.ListTExp = new List <TExpenseItem>();
            objTExpItem.ListTExp.AddRange(lstTExp);
            #region Bind DropDown Country
            List <clsMasterData> lstMasters = new List <clsMasterData>();
            lstMasters          = objTExp.getCountry();
            objTExpItem.ListCon = new List <clsMasterData>();
            objTExpItem.ListCon.AddRange(lstMasters);

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

            #region Bind DropDown Emp
            List <EmployeeItem> lstEmp = new List <EmployeeItem>();
            lstEmp = objTExp.GetEmp(cid);
            objTExpItem.ListEmp = new List <EmployeeItem>();
            objTExpItem.ListEmp.AddRange(lstEmp);
            #endregion
            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objTExpItem));
        }
예제 #7
0
 public int Insert(TExpenseItem model)
 {
     try
     {
         TravelExpence TE = new TravelExpence();
         TE.Companyid       = model.Companyid;
         TE.EmpId           = model.EmpId;
         TE.TDate           = model.TDate;
         TE.Country         = model.Country;
         TE.TFromDate       = model.TFromDate;
         TE.TToDate         = model.TToDate;
         TE.Fare            = model.Fare;
         TE.FromDate        = model.FromDate;
         TE.ToDate          = model.ToDate;
         TE.City            = model.City;
         TE.Id              = model.Id;
         TE.AccomodationExp = model.AccomodationExp;
         TE.FoodExp         = model.FoodExp;
         TE.OtherExp        = model.OtherExp;
         TE.Conv_Exp        = model.Conv_Exp;
         TE.Remarks         = model.Remarks;
         TE.Status          = model.Status;
         TE.CreatedBy       = model.CreatedBy;
         TE.CreatedDate     = model.CreatedDate;
         DbContext.TravelExpences.Add(TE);
         return(DbContext.SaveChanges());
         //Mapper.CreateMap<TExpenseItem, TravelExpence>();
         //TravelExpence objTExp = Mapper.Map<TravelExpence>(model);
         //DbContext.TravelExpences.Add(objTExp);
         //return DbContext.SaveChanges();
     }
     catch (Exception ex)
     {
         throw;
     }
 }