public ActionResult Create(EmpInsuranceItem model) { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); //model.emp = Empid; EmpInsuranceService objEmpInc = new EmpInsuranceService(); string uid = null; if (Session["UserId"] != null) { uid = Session["UserId"].ToString(); } model.CreatedBy = uid; model.CreatedDate = System.DateTime.Now; int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } if (model.CompID == null) { model.CompID = cid; } objEmpInc.Insert(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public ActionResult Edit(EmpInsuranceItem model, HttpPostedFileBase[] files) { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); // model.EmpID = Empid; EmpInsuranceService objPass = new EmpInsuranceService(); string uid = null; if (Session["UserId"] != null) { uid = Session["UserId"].ToString(); } model.UpdatedBy = uid; model.UpdatedDate = System.DateTime.Now; if (files != null) { string strtext = "Insurance"; foreach (HttpPostedFileBase file in files) { if (file != null) { string filename = System.IO.Path.GetFileName(file.FileName); string folderPath = Server.MapPath("~/UploadedDocs/") + strtext; // obj.EmpId = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); string destinationPath = folderPath; string employeeFolderPath = destinationPath; // create folder if it is not exist if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); if (!Directory.Exists(employeeFolderPath)) { Directory.CreateDirectory(employeeFolderPath); // create emp id folder of not exist } } else { if (!Directory.Exists(employeeFolderPath)) { Directory.CreateDirectory(employeeFolderPath); // create emp id folder of not exist } } destinationPath = employeeFolderPath; /*Saving the file in server folder*/ //file.SaveAs(Server.MapPath("~/Images/" + filename)); string fileNewName = Guid.NewGuid() + Path.GetExtension(file.FileName); file.SaveAs(Path.Combine(destinationPath, fileNewName)); model.FileName = filename; model.FilePath = Path.Combine("/UploadedDocs/" + strtext + "/", fileNewName); } } } objPass.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public EmpInsuranceItem GetById(int id) { Mapper.CreateMap <EmployeeInsurance, EmpInsuranceItem>(); EmployeeInsurance objInsu = DbContext.EmployeeInsurances.SingleOrDefault(m => m.IID == id); EmpInsuranceItem objInsuItem = Mapper.Map <EmpInsuranceItem>(objInsu); return(objInsuItem); }
public int Update(EmpInsuranceItem model) { Mapper.CreateMap <EmpInsuranceItem, EmployeeInsurance>(); EmployeeInsurance objInsu = DbContext.EmployeeInsurances.SingleOrDefault(m => m.IID == model.IID); objInsu = Mapper.Map(model, objInsu); return(DbContext.SaveChanges()); }
public ActionResult Create() { int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); List <EmpInsuranceItem> lstInsu = new List <EmpInsuranceItem>(); EmpInsuranceService objInsu = new EmpInsuranceService(); ViewBag.Empid = Empid; lstInsu = objInsu.EmpInsuranceList(Empid); EmpInsuranceItem objEmpItem = new EmpInsuranceItem(); objEmpItem.ListInsurance = new List <EmpInsuranceItem>(); objEmpItem.ListInsurance.AddRange(lstInsu); #region Bind DropDown Icomp List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objInsu.GetALLIComp(); objEmpItem.ListMasterTable = new List <clsMasterData>(); objEmpItem.ListMasterTable.AddRange(lstMasters); #endregion #region Bind DropDown Ptype List <clsMasterData> lstMasters1 = new List <clsMasterData>(); lstMasters1 = objInsu.GetALLPType(); objEmpItem.ListPolicyType = new List <clsMasterData>(); objEmpItem.ListPolicyType.AddRange(lstMasters1); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objInsu.GetBranch(); objEmpItem.ListBranch = new List <BranchItem>(); objEmpItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Comp List <CompanyItem> lstComp = new List <CompanyItem>(); lstComp = objInsu.GetComp(); objEmpItem.ListComp = new List <CompanyItem>(); objEmpItem.ListComp.AddRange(lstComp); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objInsu.GetEmp(); objEmpItem.ListEmp = new List <EmployeeItem>(); objEmpItem.ListEmp.AddRange(lstEmp); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objEmpItem)); }
public ActionResult View(int id, int IID) { EmpInsuranceService objInsService = new EmpInsuranceService(); EmpInsuranceItem objInsItem = new EmpInsuranceItem(); objInsItem = objInsService.GetById(IID); //Session["Empid"] = objPassItem.EmpId; List <EmpInsuranceItem> lstInsu = new List <EmpInsuranceItem>(); objInsItem.ListInsurance = new List <EmpInsuranceItem>(); objInsItem.ListInsurance.AddRange(lstInsu); ViewBag.IID = IID; #region Bind DropDown Icomp List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objInsService.GetALLIComp(); objInsItem.ListMasterTable = new List <clsMasterData>(); objInsItem.ListMasterTable.AddRange(lstMasters); #endregion #region Bind DropDown Ptype lstMasters = objInsService.GetALLPType(); objInsItem.ListPolicyType = new List <clsMasterData>(); objInsItem.ListPolicyType.AddRange(lstMasters); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objInsService.GetBranch(); objInsItem.ListBranch = new List <BranchItem>(); objInsItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objInsService.GetEmp(); objInsItem.ListEmp = new List <EmployeeItem>(); objInsItem.ListEmp.AddRange(lstEmp); #endregion #region Bind DropDown Comp List <CompanyItem> lstComp = new List <CompanyItem>(); lstComp = objInsService.GetComp(); objInsItem.ListComp = new List <CompanyItem>(); objInsItem.ListComp.AddRange(lstComp); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objInsItem)); }
public int Insert(EmpInsuranceItem model) { try { Mapper.CreateMap <EmpInsuranceItem, EmployeeInsurance>(); EmployeeInsurance objEmp = Mapper.Map <EmployeeInsurance>(model); DbContext.EmployeeInsurances.Add(objEmp); return(DbContext.SaveChanges()); } catch (Exception ex) { throw; } }
public ActionResult delete(int id, int IId, int menuid) { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); EmpInsuranceService objService = new EmpInsuranceService(); List <EmpInsuranceItem> lstItem = new List <EmpInsuranceItem>(); EmpInsuranceItem objDoc = new EmpInsuranceItem(); objDoc = objService.GetById(IId); db.EmployeeInsurances.Remove(db.EmployeeInsurances.Find(IId)); db.SaveChanges(); //ViewBag.Empid = id; ViewBag.Menuid = Request.QueryString["menuId"]; return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] })); }
public ActionResult Edit(EmpInsuranceItem model) { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); // model.EmpID = Empid; EmpInsuranceService objPass = new EmpInsuranceService(); string uid = null; if (Session["UserId"] != null) { uid = Session["UserId"].ToString(); } model.UpdatedBy = uid; model.UpdatedDate = System.DateTime.Now; objPass.Update(model); return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu })); }
public ActionResult delete(int id, int menuid) { try { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); EmpInsuranceService objService = new EmpInsuranceService(); EmpInsuranceItem objDoc = new EmpInsuranceItem(); objDoc = objService.GetById(id); db.EmployeeInsurances.Remove(db.EmployeeInsurances.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 { @id = id, @menuId = Request.QueryString["menuId"] })); }
public ActionResult Create() { //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); List <EmpInsuranceItem> lstInsu = new List <EmpInsuranceItem>(); EmpInsuranceService objInsu = new EmpInsuranceService(); //ViewBag.Empid = Empid; int cid = 0; string uid = null; if (Session["UserId"] != null) { uid = Session["UserId"].ToString(); } if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } lstInsu = objInsu.VehicleInsuranceList(cid); EmpInsuranceItem objEmpItem = new EmpInsuranceItem(); objEmpItem.ListInsurance = new List <EmpInsuranceItem>(); objEmpItem.ListInsurance.AddRange(lstInsu); VehicleRepairingService objVrepairing = new VehicleRepairingService(); #region Bind DropDown Vehicle List <VehicleItem> lstVehicle1 = new List <VehicleItem>(); lstVehicle1 = objVrepairing.GetVehicle(cid); objEmpItem.ListVehicle = new List <VehicleItem>(); objEmpItem.ListVehicle.AddRange(lstVehicle1); #endregion #region Bind DropDown Icomp List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objInsu.GetALLIComp(); objEmpItem.ListMasterTable = new List <clsMasterData>(); objEmpItem.ListMasterTable.AddRange(lstMasters); #endregion #region Bind DropDown Ptype List <clsMasterData> lstMasters1 = new List <clsMasterData>(); lstMasters1 = objInsu.GetALLPType(); objEmpItem.ListPolicyType = new List <clsMasterData>(); objEmpItem.ListPolicyType.AddRange(lstMasters1); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objInsu.GetBranch(); objEmpItem.ListBranch = new List <BranchItem>(); objEmpItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Comp List <CompanyItem> lstComp = new List <CompanyItem>(); lstComp = objInsu.GetComp(); objEmpItem.ListComp = new List <CompanyItem>(); objEmpItem.ListComp.AddRange(lstComp); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objInsu.GetEmp(); objEmpItem.ListEmp = new List <EmployeeItem>(); objEmpItem.ListEmp.AddRange(lstEmp); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objEmpItem)); }
public ActionResult View(int IID) { EmpInsuranceService objInsService = new EmpInsuranceService(); EmpInsuranceItem objInsItem = new EmpInsuranceItem(); objInsItem = objInsService.GetById(IID); //Session["Empid"] = objPassItem.EmpId; List <EmpInsuranceItem> lstInsu = new List <EmpInsuranceItem>(); objInsItem.ListInsurance = new List <EmpInsuranceItem>(); objInsItem.ListInsurance.AddRange(lstInsu); ViewBag.IID = IID; int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } VehicleRepairingService objVrepairing = new VehicleRepairingService(); #region Bind DropDown Vehicle List <VehicleItem> lstVehicle1 = new List <VehicleItem>(); lstVehicle1 = objVrepairing.GetVehicle(cid); objInsItem.ListVehicle = new List <VehicleItem>(); objInsItem.ListVehicle.AddRange(lstVehicle1); #endregion #region Bind DropDown Icomp List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objInsService.GetALLIComp(); objInsItem.ListMasterTable = new List <clsMasterData>(); objInsItem.ListMasterTable.AddRange(lstMasters); #endregion #region Bind DropDown Ptype lstMasters = objInsService.GetALLPType(); objInsItem.ListPolicyType = new List <clsMasterData>(); objInsItem.ListPolicyType.AddRange(lstMasters); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objInsService.GetBranch(); objInsItem.ListBranch = new List <BranchItem>(); objInsItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objInsService.GetEmp(); objInsItem.ListEmp = new List <EmployeeItem>(); objInsItem.ListEmp.AddRange(lstEmp); #endregion #region Bind DropDown Comp List <CompanyItem> lstComp = new List <CompanyItem>(); lstComp = objInsService.GetComp(); objInsItem.ListComp = new List <CompanyItem>(); objInsItem.ListComp.AddRange(lstComp); #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objInsItem)); }