public ResponseData SaveRoleUser(int roleid, string users) { ResponseData result = new Models.ResponseData(); using (SATEntities db = new SATEntities()) { try { if (!string.IsNullOrEmpty(users)) { string[] user = users.Split(','); foreach (var userid in user) { tb_User_Role model = new tb_User_Role(); model.RoleID = roleid; model.UserID = Convert.ToInt32(userid); model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_User_Role.Add(model); db.SaveChanges(); } } } catch (Exception ex) { result.MessageCode = ""; result.MessageText = ex.Message; } return(result); } }
public ResponseData AddByEntity(ActionTypeViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Action_Type model = new tb_Action_Type(); model.ActID = data.ActID; model.ActName = data.ActName; model.ActType = data.ActType; model.ActPos = data.ActPos; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Action_Type.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData AddByEntity(PositionRateViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { int maxID = db.tb_Man_Power.Where(m => m.TypeID == data.TypeID).Max(m => (int)m.MpID); tb_Man_Power model = new tb_Man_Power(); model.MpID = maxID; model.TypeID = data.TypeID; model.DivID = data.DivID; model.DepID = data.DepID; model.SecID = data.SecID; model.PoID = data.PoID; model.DisID = data.DisID; model.UserID = data.UserID; model.EduID = data.EduID; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Man_Power.Add(model); db.SaveChanges(); result.ID = model.MpID; } catch (Exception ex) { result.MessageCode = ""; result.MessageText = ex.Message; } return(result); } }
public ResponseData AddByEntity(InsigniaViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Insignia model = new tb_Insignia(); model.InsID = data.InsID; model.InsFullName = data.InsFullName; model.InsShortName = data.InsShortName; model.InsStatus = (data.Status == "1") ? true : false; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Insignia.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData UpdateByEntity(PositionRateViewModel newdata) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { var model = db.tb_Man_Power.Single(x => x.MpID == newdata.MpID); model.DivID = newdata.DivID; model.DepID = newdata.DepID; model.SecID = newdata.SecID; model.PoID = newdata.PoID; model.DisID = newdata.DisID; model.UserID = newdata.UserID; model.EduID = newdata.EduID; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.SaveChanges(); } catch (Exception ex) { result.MessageCode = ""; result.MessageText = ex.Message; } return(result); } }
public JsonResult SaveInsignia(UserInsigniaViewModel data, HttpPostedFileBase fileUpload) { ResponseData result = new Models.ResponseData(); if (fileUpload != null && fileUpload.ContentLength > 0) { //if (fileUpload.ContentLength > 10240) //{ //} //var supportedTypes = new[] { "jpg", "jpeg", "png" }; //var fileExt = System.IO.Path.GetExtension(fileUpload.FileName).Substring(1); //if (!supportedTypes.Contains(fileExt)) //{ //} } if (data.UiID != 0) { result = new EmployeeRepository().UpdateInsigniaByEntity(data, fileUpload); } else { result = new EmployeeRepository().AddInsigniaByEntity(data, fileUpload); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ResponseData AddByEntity(LeaveTypeViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Leave_Type model = new tb_Leave_Type(); model.LevID = data.LevID; model.LevYear = data.LevYear; model.LevName = data.LevName; model.LevStartDate = Convert.ToDateTime(data.LevStartDateText); model.LevEndDate = Convert.ToDateTime(data.LevEndDateText); model.LevMax = data.LevMax; model.SexID = data.SexID; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Leave_Type.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData AddByEntity(DepartmentViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Department model = new tb_Department(); model.DepID = data.DepID; model.DepName = data.DepName; model.DepStatus = (data.Status == "1") ? true : false; model.DivID = (int)data.DivID; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Department.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public JsonResult SaveSysConfig(List <SysConfigViewModel> model) { ResponseData result = new Models.ResponseData(); result = new SysConfigRepository().UpdateByEntity(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ResponseData AddByEntity(CapabilityDetailViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Capability_Detail model = new tb_Capability_Detail(); model.CapDID = data.CapDID; model.CapDName = data.CapDName; model.CapDDesc = data.CapDDesc; model.CapID = data.CapID; model.Score1 = data.Score1; model.Score2 = data.Score2; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Capability_Detail.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData AddByEntity(CapabilityViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Capability model = new tb_Capability(); model.CapID = data.CapID; model.CapYear = data.CapYear; model.CapTID = data.CapTID; model.CapGID = data.CapGID; model.CapGTID = data.CapGTID; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Capability.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData DeleteLevelTransfer(int id) { ResponseData result = new Models.ResponseData(); using (SATEntities db = new SATEntities()) { using (var transection = db.Database.BeginTransaction()) { try { var listdelete = db.tb_Move_Level_Detail.Where(x => x.MlID == id).ToList(); db.tb_Move_Level_Detail.RemoveRange(listdelete); db.SaveChanges(); var itemdelete = db.tb_Move_Level_Head.Where(x => x.MlID == id).FirstOrDefault(); db.tb_Move_Level_Head.Remove(itemdelete); db.SaveChanges(); transection.Commit(); } catch (Exception ex) { transection.Rollback(); result.MessageCode = ""; result.MessageText = ex.Message; } return result; } } }
public ResponseData AddByEntity(SalaryViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Salary model = new tb_Salary(); model.SaID = data.SaID; model.SaLevel = data.SaLevel; model.SaStep = data.SaStep; model.SaRate = data.SaRate; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Salary.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData AddByEntity(PositionViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Position model = new tb_Position(); model.PoID = data.PoID; model.PoCode = data.PoCode; model.PoName = data.PoName; model.PoStatus = (data.Status == "1") ? true : false; model.TypeID = data.TypeID; model.CreateBy = UtilityService.User.UserID; model.CreateDate = DateTime.Now; model.ModifyBy = UtilityService.User.UserID; model.ModifyDate = DateTime.Now; db.tb_Position.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public ResponseData AddRoleByEntity(RoleViewModel data) { using (SATEntities db = new SATEntities()) { ResponseData result = new Models.ResponseData(); try { tb_Role model = new tb_Role(); model.RoleID = data.RoleID; model.RoleName = data.RoleName; data.RoleDesc = data.RoleDesc; model.RoleStatus = (data.Status == "1") ? true : false; model.CreateBy = data.ModifyBy; model.CreateDate = DateTime.Now; model.ModifyBy = data.ModifyBy; model.ModifyDate = DateTime.Now; db.tb_Role.Add(model); db.SaveChanges(); } catch (Exception) { } return(result); } }
public JsonResult SubmitCapabilityDetail(List <CapabilityDetailViewModel> model) { ResponseData result = new Models.ResponseData(); result = new CapabilityDetailRepository().SubmitByEntity(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ResponseData SaveRoleMenu(List <RoleMenuViewModel> model) { ResponseData result = new Models.ResponseData(); using (SATEntities db = new SATEntities()) { try { if (model != null) { foreach (var item in model) { if (item.MenuType == "M" || (item.ParentID != 0 && (item.MenuType == "T" || item.MenuType == "R"))) { var data = db.tb_Menu_Role.Where(m => m.RoleID == item.RoleID && m.MenuID == item.MenuID).FirstOrDefault(); if (data != null) { data.R_View = item.R_View; data.R_Add = item.R_Add; data.R_Edit = item.R_Edit; data.R_Delete = item.R_Delete; data.ModifyBy = UtilityService.User.UserID; data.ModifyDate = DateTime.Now; db.SaveChanges(); } else { tb_Menu_Role obj = new tb_Menu_Role(); obj.RoleID = item.RoleID; obj.MenuID = item.MenuID; obj.R_View = item.R_View; obj.R_Add = item.R_Add; obj.R_Edit = item.R_Edit; obj.R_Delete = item.R_Delete; obj.CreateBy = UtilityService.User.UserID; obj.CreateDate = DateTime.Now; obj.ModifyBy = UtilityService.User.UserID; obj.ModifyDate = DateTime.Now; db.tb_Menu_Role.Add(obj); db.SaveChanges(); } } } } } catch (Exception ex) { result.MessageCode = ""; result.MessageText = ex.Message; } return(result); } }
public JsonResult SavePositionTransfer(PositionTransferViewModel data) { ResponseData result = new Models.ResponseData(); if (data.MopID != 0) { result = new PositionTransferRepository().UpdateByEntity(data); } else { result = new PositionTransferRepository().AddByEntity(data); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveCertificate(UserCertificateViewModel data) { ResponseData result = new Models.ResponseData(); if (data.UcID != 0) { result = new EmployeeRepository().UpdateCertificateByEntity(data); } else { result = new EmployeeRepository().AddCertificateByEntity(data); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveHistory(UserHistoryViewModel data) { ResponseData result = new Models.ResponseData(); if (data.UhID != 0) { result = new EmployeeRepository().UpdateHistoryByEntity(data); } else { result = new EmployeeRepository().AddHistoryByEntity(data); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SavePosition(UserPositionViewModel data, HttpPostedFileBase fileUpload) { ResponseData result = new Models.ResponseData(); if (data.UpID != 0) { result = new EmployeeRepository().UpdatePositionByEntity(data, fileUpload); } else { result = new EmployeeRepository().AddPositionByEntity(data, fileUpload); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveExcellent(UserExcellentViewModel data) { ResponseData result = new Models.ResponseData(); if (data.UeID != 0) { result = new EmployeeRepository().UpdateExcellentByEntity(data); } else { result = new EmployeeRepository().AddExcellentByEntity(data); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveTraining(UserTrainningViewModel data) { ResponseData result = new Models.ResponseData(); if (data.UtID != 0) { result = new EmployeeRepository().UpdateTrainingByEntity(data); } else { result = new EmployeeRepository().AddTrainingByEntity(data); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveCapabilityDetail(CapabilityDetailViewModel model) { ResponseData result = new Models.ResponseData(); if (model.CapID != 0) { result = new CapabilityDetailRepository().UpdateByEntity(model); } else { result = new CapabilityDetailRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveInsignia(InsigniaViewModel model) { ResponseData result = new Models.ResponseData(); if (model.InsID != 0) { result = new InsigniaRepository().UpdateByEntity(model); } else { result = new InsigniaRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveNationality(NationalityViewModel model) { ResponseData result = new Models.ResponseData(); if (model.NatID != 0) { result = new NationalityRepository().UpdateByEntity(model); } else { result = new NationalityRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveReligion(ReligionViewModel model) { ResponseData result = new Models.ResponseData(); if (model.RelD != 0) { result = new ReligionRepository().UpdateByEntity(model); } else { result = new ReligionRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveHoliday(HolidayViewModel model) { ResponseData result = new Models.ResponseData(); if (model.HolID != 0) { result = new HolidayRepository().UpdateByEntity(model); } else { result = new HolidayRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveDepartment(DepartmentViewModel model) { ResponseData result = new Models.ResponseData(); if (model.DepID != 0) { result = new DepartmentRepository().UpdateByEntity(model); } else { result = new DepartmentRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveLeaveType(LeaveTypeViewModel model) { ResponseData result = new Models.ResponseData(); if (model.LevID != 0) { result = new LeaveTypeRepository().UpdateByEntity(model); } else { result = new LeaveTypeRepository().AddByEntity(model); } return(Json(result, JsonRequestBehavior.AllowGet)); }