public ActionResult Edit(hr_employee model, HttpPostedFileBase imageFile) { if (ModelState.IsValid) { if (imageFile != null) { string extension = Path.GetExtension(imageFile.FileName); if (!(extension.Equals(".jpg") || extension.Equals(".JPG"))) { ModelState.AddModelError(string.Empty, "Not an accepted image type!"); ViewBag.emp_branch_id = new SelectList(_branchService.GetAll(), "branch_id", "branch_name", model.emp_branch_id); ViewBag.emp_type_id = new SelectList(_employeeTypeService.GetAll(), "emp_type_id", "emp_type_name", model.emp_type_id); return(View(model)); } string fileName = model.emp_code + extension; model.emp_image = "~/File/Employee/" + fileName; fileName = Path.Combine(Server.MapPath("~/File/Employee/"), fileName); imageFile.SaveAs(fileName); } _employeeService.Edit(model); return(RedirectToAction("Index")); } ViewBag.emp_type_id = new SelectList(_employeeTypeService.GetAll(), "emp_type_id", "emp_type_name", model.emp_type_id); ViewBag.emp_branch_id = new SelectList(_branchService.GetAll(), "branch_id", "branch_name", model.emp_branch_id); return(View(model)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } hr_employee hr_employee = _employeeService.GetById(id); if (hr_employee == null) { return(HttpNotFound()); } ViewBag.emp_type_id = new SelectList(_employeeTypeService.GetAll(), "emp_type_id", "emp_type_name", hr_employee.emp_type_id); ViewBag.emp_branch_id = new SelectList(_branchService.GetAll(), "branch_id", "branch_name", hr_employee.emp_branch_id); return(View(hr_employee)); }
//受理完成 public bool finish(int id, string remark, DataSet ds, Model.ims.ims_emp_score modelScore, string scoreApply, string score) { hr_employee emp = new hr_employee(); Personal_Score pscore = new Personal_Score(); Model.Personal_Score model = new Model.Personal_Score(); List <string> strSqlList = new List <string>(); string strSql = string.Empty; strSql = string.Format(@"update ims_complaint_points set state='{0}',hand_data='{1}',hand_remark='{2}' where id='{3}'", 2, DateTime.Now, remark, id); strSqlList.Add(strSql); if (ds != null && ds.Tables[0].Rows.Count > 0) { //被投诉人 if (score != "0") { strSql = string.Format(@"insert into ims_emp_score(Factory_Id,d_id,d_name,emp_id,emp_name,rule_id,rule_name,isPlus,score,check_empId,check_empName,check_date,check_remark,score_source,complaint_id) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')", modelScore.Factory_Id, int.Parse(ds.Tables[0].Rows[0]["d_id"].ToString()), ds.Tables[0].Rows[0]["dname"].ToString(), int.Parse(ds.Tables[0].Rows[0]["sued_empId"].ToString()), ds.Tables[0].Rows[0]["sued_empName"].ToString(), modelScore.rule_id, modelScore.rule_name, modelScore.isPlus, Convert.ToDecimal(PageValidate.InputText("-" + score, 16)), modelScore.check_empId, modelScore.check_empName, modelScore.check_date, modelScore.check_remark, modelScore.score_source, id); strSqlList.Add(strSql); } //申请人 if (scoreApply != "0") { DataSet de = emp.GetList("ID='" + ds.Tables[0].Rows[0]["apply_empId"].ToString() + "'"); if (de != null & de.Tables[0].Rows.Count > 0) { strSql = string.Format(@"insert into ims_emp_score(Factory_Id,d_id,d_name,emp_id,emp_name,rule_id,rule_name,isPlus,score,check_empId,check_empName,check_date,check_remark,score_source,complaint_id) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')", modelScore.Factory_Id, int.Parse(de.Tables[0].Rows[0]["d_id"].ToString()), de.Tables[0].Rows[0]["dname"].ToString(), int.Parse(ds.Tables[0].Rows[0]["apply_empId"].ToString()), ds.Tables[0].Rows[0]["apply_empName"].ToString(), modelScore.rule_id, modelScore.rule_name, modelScore.isPlus, Convert.ToDecimal(PageValidate.InputText("-" + scoreApply, 16)), modelScore.check_empId, modelScore.check_empName, modelScore.check_date, modelScore.check_remark, modelScore.score_source, id); strSqlList.Add(strSql); } } } int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList); if (rows >= 0) { return(true); } else { return(false); } //StringBuilder strSql = new StringBuilder(); //strSql.Append(" update ims_complaint_points set state='2',hand_data='" + DateTime.Now + "',hand_remark='" + remark + "' where id='" + id + "' "); //int rows = DbHelperMySQL.ExecuteSql(strSql.ToString()); //if (rows > 0) //{ // return true; //} //else //{ // return false; //} }