protected void pageSave(string doType) { string id = Utils.GetQueryStringValue("id"); var model = new Eyousoft_yhq.Model.ProductType(); #region 实体赋值 model.TpMark = "1"; model.TypeName = Utils.GetFormValue(txtproductName.UniqueID); model.OrderBy = Utils.GetInt(Utils.GetFormValue(txtOrderByNum.UniqueID)); //model.AdminName = Utils.GetFormValue("ddlAname"); string[] ADNamelist = Utils.GetFormValue("AdminList").TrimEnd(',').Split(','); IList <Eyousoft_yhq.Model.AdminNameList> items = new List <Eyousoft_yhq.Model.AdminNameList>(); for (int j = 0; j < ADNamelist.Length; j++) { var ADModel = new Eyousoft_yhq.Model.AdminNameList(); ADModel.AdminN = ADNamelist[j]; items.Add(ADModel); } model.AdminName = items; model.xianlu = (Eyousoft_yhq.Model.XianLu)Utils.GetInt(Utils.GetFormValue("ddlxianlu")); string stroldupload = Utils.GetFormValue("hideFileInfo"); string newupload = Utils.GetFormValue(this.upload1.ClientHideID); if (!string.IsNullOrEmpty(newupload)) { if (!string.IsNullOrEmpty(newupload)) { model.TypeImg = newupload.Split('|')[1]; } } else { model.TypeImg = stroldupload; } #endregion #region 提交保存 bool result = false; string msg = ""; Response.Clear(); Eyousoft_yhq.BLL.ProductType BLL = new Eyousoft_yhq.BLL.ProductType(); if (doType == "add") { result = BLL.Add(model); msg = result ? "添加成功!" : "添加失败!"; Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); } else { model.TypeID = Utils.GetInt(id); result = BLL.Update(model); msg = result ? "修改成功!" : "修改失败!"; Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); } Response.End(); #endregion }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Eyousoft_yhq.Model.ProductType model) { if (model.TypeID == 0) { return(false); } return(dal.Update(model)); }
protected void pageSave(string doType) { string id = Utils.GetQueryStringValue("id"); var model = new Eyousoft_yhq.Model.ProductType(); #region 实体赋值 model.TpMark = "1"; model.TypeName = Utils.GetFormValue(txtproductName.UniqueID); model.OrderBy = Utils.GetInt(Utils.GetFormValue(txtOrderByNum.UniqueID)); //model.AdminName = Utils.GetFormValue("ddlAname"); string[] ADNamelist = Utils.GetFormValue("AdminList").TrimEnd(',').Split(','); IList<Eyousoft_yhq.Model.AdminNameList> items = new List<Eyousoft_yhq.Model.AdminNameList>(); for (int j = 0; j < ADNamelist.Length; j++) { var ADModel = new Eyousoft_yhq.Model.AdminNameList(); ADModel.AdminN = ADNamelist[j]; items.Add(ADModel); } model.AdminName = items; model.xianlu = (Eyousoft_yhq.Model.XianLu)Utils.GetInt(Utils.GetFormValue("ddlxianlu")); string stroldupload = Utils.GetFormValue("hideFileInfo"); string newupload = Utils.GetFormValue(this.upload1.ClientHideID); if (!string.IsNullOrEmpty(newupload)) { if (!string.IsNullOrEmpty(newupload)) { model.TypeImg = newupload.Split('|')[1]; } } else { model.TypeImg = stroldupload; } #endregion #region 提交保存 bool result = false; string msg = ""; Response.Clear(); Eyousoft_yhq.BLL.ProductType BLL = new Eyousoft_yhq.BLL.ProductType(); if (doType == "add") { result = BLL.Add(model); msg = result ? "添加成功!" : "添加失败!"; Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); } else { model.TypeID = Utils.GetInt(id); result = BLL.Update(model); msg = result ? "修改成功!" : "修改失败!"; Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); } Response.End(); #endregion }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Eyousoft_yhq.Model.ProductType model) { return(dal.Add(model)); }