public void GetDeptName() { string name = ""; try { string id = UrlHelper.ReqStr("id"); Model.Department_Model model = Bll.GetModelByKeyValue(id); name = model.DeptName; } catch { } CurrentContext.Response.Write(name); }
private void OptData() { /******** 可修改区域 Start ********/ Model.Department_Model model = GetNewDataModel(CurrentContext); /******** 可修改区域 End ********/ bool issuccess = false; string msg = string.Empty; try { if (IsAdd) { issuccess = bll.AddModel(model); msg = issuccess ? "添加成功。" : "添加失败!"; } else { issuccess = bll.UpdateModel(model); msg = issuccess ? "修改成功。" : "修改失败!"; } string[] DepartmentPathAndDeptLevel = bllExt.AnalyzeDepartmentPathAndDeptLevel(model.DepartmentID.ToString()); model.DeptFullID = DepartmentPathAndDeptLevel[0]; model.DeptFullName = DepartmentPathAndDeptLevel[1]; model.DeptLevel = int.Parse(DepartmentPathAndDeptLevel[2]); bll.UpdateModel(model); } catch (Exception ex) { issuccess = false; msg = string.Format("{0} {1}", msg, ex.Message); } ReturnMsg(issuccess, enumReturnTitle.OptData, msg); }
/******** 获取数据 可修改区域 Start ********/ private Model.Department_Model GetNewDataModel(HttpContext context) { Model.Department_Model model = new Model.Department_Model(); if (IsEdit) { model = bll.GetModelByKeyValue(_pKeyValue); if (null == model) { throw new HasNotRecordException(_pKeyValue); } } model.DepartmentID = string.IsNullOrWhiteSpace(_pKeyValue) ? 0 : int.Parse(_pKeyValue); model.DeptName = UrlHelper.ReqStrByGetOrPost(context, "DeptName"); model.PDepartmentID = UrlHelper.ReqIntByGetOrPost(context, "PDepartmentID"); model.DeptDesc = UrlHelper.ReqStrByGetOrPost(context, "DeptDesc"); return(model); }