private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessDict bc = new project.Business.Base.BusinessDict(); bc.load(jp.getValue("id"), type, user.Entity.AccID); if (type == "CustType") { if (obj.ExecuteDataSet("select 1 from Base_Cust_Info where CustType='" + bc.Entity.DictNo + "' and AccID='" + user.Entity.AccID + "'").Tables[0].Rows.Count > 0) { flag = "3"; } } if (flag == "1") { int r = bc.delete(); if (r <= 0) { flag = "2"; } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "delete")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList())); return(collection.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; string result = "";; try { Business.Base.BusinessDict bc = new project.Business.Base.BusinessDict(); bc.load(jp.getValue("id"), type, user.Entity.AccID); collection.Add(new JsonStringValue("DictNo", bc.Entity.DictNo)); collection.Add(new JsonStringValue("DictName", bc.Entity.DictName)); collection.Add(new JsonStringValue("Remark", bc.Entity.Remark)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); result = collection.ToString(); return(result); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessDict bc = new project.Business.Base.BusinessDict(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id"), type, user.Entity.AccID); bc.Entity.DictName = jp.getValue("DictName"); bc.Entity.Remark = jp.getValue("Remark"); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.ExecuteDataSet("select cnt=COUNT(*) from Base_Dict where DictNo=N'" + jp.getValue("DictNo") + "' and DictType='" + jp.getValue("DictType") + "' and AccID='" + user.Entity.AccID + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.DictNo = jp.getValue("DictNo"); bc.Entity.DictName = jp.getValue("DictName"); bc.Entity.Remark = jp.getValue("Remark"); bc.Entity.AccID = user.Entity.AccID; bc.Entity.DictType = type; int r = bc.Save("insert"); if (r <= 0) { flag = "2"; } } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList())); return(collection.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessDict bc = new project.Business.Base.BusinessDict(); bc.load(jp.getValue("id"), user.Entity.AccID, jp.getValue("DictType")); int r = bc.delete(); if (r <= 0) { flag = "2"; } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "delete")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("DictType")))); return(collection.ToString()); }
protected override void Page_Load(object sender, EventArgs e) { try { HttpCookie hc = getCookie("1"); if (hc != null) { string str = hc.Value.Replace("%3D", "="); userid = Encrypt.DecryptDES(str, "1"); user.load(userid); CheckRight(user.Entity, "platform/UserInfo.aspx"); if (!Page.IsCallback) { list = createList(string.Empty, 1); custType = "<select class=\"input-text required\" id=\"CustType\" data-valid=\"isNonEmpty\" data-error=\"请选择客户类型\">"; custType += "<option value=\"\" selected>请选择客户类型</option>"; Business.Base.BusinessDict dict = new project.Business.Base.BusinessDict(); foreach (Entity.Base.EntityDict it in dict.GetDictListQuery(string.Empty, string.Empty, user.Entity.AccID, "CustType")) { custType += "<option value='" + it.DictNo + "'>" + it.DictName + "</option>"; } custType += "</select>"; } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }