public ActionResult AddEmployeeInfo() { EmployeeInfoAddModel model = new EmployeeInfoAddModel(); model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); SelectList driveLicenseStateSelectList = new SelectList(EmployeeInfoBLL.GetDriveLicenseStates(), "DriveLicenseStateID", "DriveLicenseStateName"); List <SelectListItem> liDriveLicenseState = new List <SelectListItem>(); liDriveLicenseState.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0", Selected = true }); liDriveLicenseState.AddRange(driveLicenseStateSelectList); model.DriveLicenseStateSelectList = liDriveLicenseState; SelectList driveTypeSelectList = new SelectList(EmployeeInfoBLL.GetDriveTypes(), "DriveTypeID", "DriveTypeName"); List <SelectListItem> liDriveType = new List <SelectListItem>(); liDriveType.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0", Selected = true }); liDriveType.AddRange(driveTypeSelectList); model.DriveTypeSelectList = liDriveType; return(PartialView("_AddEmployeeInfo", model)); }
public ActionResult EditEmployeeInfo(int id) { var result = EmployeeInfoBLL.GetEmployeeInfoByID(id); if (result.DataResult == null) { return(Content(result.Message)); } var model = result.DataResult; model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); SelectList driveLicenseStateSelectList = new SelectList(EmployeeInfoBLL.GetDriveLicenseStates(), "DriveLicenseStateID", "DriveLicenseStateName"); List <SelectListItem> liDriveLicenseState = new List <SelectListItem>(); liDriveLicenseState.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0" }); liDriveLicenseState.AddRange(driveLicenseStateSelectList); model.DriveLicenseStateSelectList = liDriveLicenseState; SelectList driveTypeSelectList = new SelectList(EmployeeInfoBLL.GetDriveTypes(), "DriveTypeID", "DriveTypeName"); List <SelectListItem> liDriveType = new List <SelectListItem>(); liDriveType.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0" }); liDriveType.AddRange(driveTypeSelectList); model.DriveTypeSelectList = liDriveType; return(PartialView("_EditEmployeeInfo", result.DataResult)); }
public ActionResult AddEmployeeInfoNew() { EditEmployeeInfoModel model = new EditEmployeeInfoModel(); // 证件类型 model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); // 默认选中驾驶员 model.IsDriver = true; return(PartialView("_AddEmployeeInfoNew", model)); }
public ActionResult AddEmployeeInfoNew(EditEmployeeInfoModel model) { if (ModelState.IsValid) { var result = EmployeeInfoBLL.AddEmployeeInfoNew(model, base.CurrentUserID); base.DoLog(OperationTypeEnum.Add, result, "EmployeeName:" + model.EmployeeName); return(Json(result)); } else { // 证件类型 model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); return(PartialView("_AddEmployeeInfoNew", model)); } }
public ActionResult EditEmployeeInfoNew(EditEmployeeInfoModel model) { // 获取当前员工已经被哪些车使用过 如果对应的员工类型已经关联了相关的车辆 则不能取消绑定 List <VehicleEmployeeInfoDDLModel> list = EmployeeInfoBLL.GetEmployeeInfoUsedToVehicle(model.ID); if (list != null && list.Count > 0) { if (!model.IsDriver) { if (list.Find(o => o.Type == 1) != null) { ModelState.AddModelError("DriveCode", DataAnnotations.DriverError); } } if (!model.IsCarrier && ModelState.IsValid) { if (list.Find(o => o.Type == 2) != null) { ModelState.AddModelError("DriveCode", DataAnnotations.CarrierError); } } } if (ModelState.IsValid) { var result = EmployeeInfoBLL.EditEmployeeInfoNew(model, base.CurrentUserID); base.DoLog(OperationTypeEnum.Edit, result, "ID:" + model.ID); return(Json(result)); } else { // 证件类型 model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); return(PartialView("_EditEmployeeInfoNew", model)); } }
public ActionResult EditEmployeeInfoNew(int id) { var result = EmployeeInfoBLL.GetNewEmployeeInfoByID(id); if (result.DataResult == null) { return(Content(result.Message)); } var model = result.DataResult; // 证件类型 model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); // 获取当前员工已经被哪些车使用过 如果对应的员工类型已经关联了相关的车辆 单位信息就不能修改 List <VehicleEmployeeInfoDDLModel> list = EmployeeInfoBLL.GetEmployeeInfoUsedToVehicle(model.ID); model.OldStrucID = model.StrucID.Value; ViewBag.IsUpdateStruc = 1; if (list != null && list.Count > 0) { ViewBag.IsUpdateStruc = 0; } return(PartialView("_EditEmployeeInfoNew", result.DataResult)); }
public ActionResult AddEmployeeInfo(EmployeeInfoAddModel model) { //if (model.CertificateTypeID == 1) //{ // bool isIDcard = IsIDcard(model.CertificateCode); // if (!isIDcard) { // ModelState.AddModelError("CertificateCode", DataAnnotations.IDcardError); // } //} //if (model.IsDriver == true && string.IsNullOrEmpty(model.DriveCode)) //{ // ModelState.AddModelError("DriveCode", DataAnnotations.NeedDriveCode); //} //if (model.IsDriver == true && string.IsNullOrEmpty(model.DriveCodeValidTime)) //{ // ModelState.AddModelError("DriveCodeValidTime", DataAnnotations.MustInputDriveCodeValidTime); //} if (model.IsDriver == true && model.DriveLicenseStateID == 0) { ModelState.AddModelError("DriveLicenseStateID", DataAnnotations.MustInputDriveLicenseStateID); } //if (model.IsDriver == true && model.DriveTypeID.Equals("0")) //{ // ModelState.AddModelError("DriveTypeID", DataAnnotations.MustInputDriveTypeID); //} //if (model.IsCarrier == true && string.IsNullOrEmpty(model.EmergePhone)) //{ // ModelState.AddModelError("EmergePhone", DataAnnotations.NeedEmergePhone); //} //if (model.IsCarrier == true && string.IsNullOrEmpty(model.CarrierCode)) //{ // ModelState.AddModelError("CarrierCode", DataAnnotations.NeedCarrierCode); //} if (ModelState.IsValid) { var result = EmployeeInfoBLL.AddEmployeeInfo(model, base.CurrentUserID); base.DoLog(OperationTypeEnum.Add, result, "EmployeeName:" + model.EmployeeName); return(Json(result)); } else { model.CertificateTypeSelectList = new SelectList(EmployeeInfoBLL.GetCertificateTypes(), "CertificateTypeID", "CertificateTypeName"); SelectList driveLicenseStateSelectList = new SelectList(EmployeeInfoBLL.GetDriveLicenseStates(), "DriveLicenseStateID", "DriveLicenseStateName"); List <SelectListItem> liDriveLicenseState = new List <SelectListItem>(); liDriveLicenseState.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0", Selected = true }); liDriveLicenseState.AddRange(driveLicenseStateSelectList); model.DriveLicenseStateSelectList = liDriveLicenseState; SelectList driveTypeSelectList = new SelectList(EmployeeInfoBLL.GetDriveTypes(), "DriveTypeID", "DriveTypeName"); List <SelectListItem> liDriveType = new List <SelectListItem>(); liDriveType.Add(new SelectListItem { Text = DisplayText.PleaseSelect, Value = "0", Selected = true }); liDriveType.AddRange(driveTypeSelectList); model.DriveTypeSelectList = liDriveType; return(PartialView("_AddEmployeeInfo", model)); } }