public ActionResult Edit(Models.CorporateEmployeeGradeModel data) { try { if (ModelState.IsValid) { long cid = 0; long.TryParse(User.Identity.GetUserId(), out cid); CLayer.EmployeeGrades empGrade = new CLayer.EmployeeGrades(); { empGrade.GradeID = data.GradeID; empGrade.GradeCode = data.GradeCode; empGrade.GradeDescription = data.GradeDescription; empGrade.B2B_ID = cid; }; BLayer.EmployeeGrades.Save(empGrade); ViewBag.Saved = true; } else { ViewBag.Saved = false; } return(RedirectToAction("Index")); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }
// GET: CorporateEmployeeGrades/Edit/5 public ActionResult Edit(int id) { try { ViewBag.Saved = false; Models.CorporateEmployeeGradeModel data = new Models.CorporateEmployeeGradeModel() { GradeID = 0 }; CLayer.EmployeeGrades employeegrades = BLayer.EmployeeGrades.Get(id); if (employeegrades != null) { data = new Models.CorporateEmployeeGradeModel() { GradeID = employeegrades.GradeID, GradeCode = employeegrades.GradeCode, GradeDescription = employeegrades.GradeDescription, B2B_ID = employeegrades.B2B_ID } } ; return(PartialView("~/Views/CorporateEmployeeGrades/_Edit.cshtml", data)); } catch (Exception ex) { Common.LogHandler.HandleError(ex); return(Redirect("~/ErrorPage")); } }
public int Save(CLayer.EmployeeGrades taxTi) { List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pGradeId", DataPlug.DataType._BigInt, taxTi.GradeID)); param.Add(Connection.GetParameter("pGradeCode", DataPlug.DataType._Varchar, taxTi.GradeCode)); param.Add(Connection.GetParameter("pGradeDescription", DataPlug.DataType._Varchar, taxTi.GradeDescription)); param.Add(Connection.GetParameter("pB2BID", DataPlug.DataType._BigInt, taxTi.B2B_ID)); int result = Connection.ExecuteQuery("EmployeeGrade_Save", param); return(result); }
public CLayer.EmployeeGrades GetById(int EmployeeGradesId) { CLayer.EmployeeGrades taxTi = null; List <DataPlug.Parameter> param = new List <DataPlug.Parameter>(); param.Add(Connection.GetParameter("pGradeID", DataPlug.DataType._BigInt, EmployeeGradesId)); DataTable dt = Connection.GetTable("EmployeeGradeById_Get", param); if (dt.Rows.Count > 0) { taxTi = new CLayer.EmployeeGrades(); taxTi.GradeID = Connection.ToInteger(dt.Rows[0]["GradeID"]); taxTi.GradeCode = Connection.ToString(dt.Rows[0]["GradeCode"]); taxTi.GradeDescription = Connection.ToString(dt.Rows[0]["GradeDescription"]); } return(taxTi); }
public static int Save(CLayer.EmployeeGrades t) { DataLayer.EmployeeGrades taxtitsave = new DataLayer.EmployeeGrades(); // t.Validate(); return(taxtitsave.Save(t)); }