private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; string result = "";; try { Business.Base.BusinessRegion bc = new project.Business.Base.BusinessRegion(); bc.load(jp.getValue("id"), user.Entity.AccID); collection.Add(new JsonStringValue("RegionNo", bc.Entity.RegionNo)); collection.Add(new JsonStringValue("RegionName", bc.Entity.RegionName)); //collection.Add(new JsonStringValue("Parent", bc.Entity.Parent)); //collection.Add(new JsonStringValue("ParentName", bc.Entity.ParentName)); } 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"; int level = 1; try { //if (jp.getValue("Parent") != "") //{ // Business.Base.BusinessRegion parent = new project.Business.Base.BusinessRegion(); // parent.load(jp.getValue("Parent"), user.Entity.AccID); // level = parent.Entity.Level; //} Business.Base.BusinessRegion bc = new project.Business.Base.BusinessRegion(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id"), user.Entity.AccID); bc.Entity.RegionName = jp.getValue("RegionName"); //bc.Entity.Parent = jp.getValue("Parent"); bc.Entity.Level = level; int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.ExecuteDataSet("select 1 from Base_Region where RegionNo=N'" + jp.getValue("RegionNo") + "' and AccID='" + user.Entity.AccID + "'").Tables[0]; if (dt.Rows.Count > 0) { flag = "3"; } else { bc.Entity.RegionNo = jp.getValue("RegionNo"); bc.Entity.RegionName = jp.getValue("RegionName"); //bc.Entity.Parent = jp.getValue("Parent"); bc.Entity.Level = level; bc.Entity.AccID = user.Entity.AccID; 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.BusinessRegion bc = new project.Business.Base.BusinessRegion(); bc.load(jp.getValue("id"), user.Entity.AccID); if (obj.ExecuteDataSet("select 1 from WO_WorkOrder where Region='" + bc.Entity.RegionNo + "' and AccID='" + user.Entity.AccID + "'").Tables[0].Rows.Count > 0) { flag = "3"; } else { if (obj.ExecuteDataSet("select 1 from Base_Region where Parent='" + bc.Entity.RegionNo + "' and AccID='" + user.Entity.AccID + "'").Tables[0].Rows.Count > 0) { flag = "3"; } else { 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()); }
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); if (!Page.IsCallback) { CheckRight(user.Entity, "Order/WorkOrder.aspx"); list = createList(string.Empty, string.Empty, GetDate().AddDays(-GetDate().Day + 1).ToString("yyyy-MM-dd"), GetDate().ToString("yyyy-MM-dd"), string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "", "", 1); orderType = "<select class=\"input-text required\" id=\"OrderType\" data-valid=\"isNonEmpty\" data-error=\"请选择工单类型\">"; orderType += "<option value=\"\" selected>请选择工单类型</option>"; orderTypeS = "<select class=\"input-text required\" id=\"OrderTypeS\" style=\"width:100px\">"; orderTypeS += "<option value=\"\" selected>全部</option>"; Business.Base.BusinessOrderType type = new project.Business.Base.BusinessOrderType(); foreach (Entity.Base.EntityOrderType it in type.GetOrderTypeListQuery(string.Empty, string.Empty, string.Empty, user.Entity.AccID)) { orderType += "<option value='" + it.OrderTypeNo + "'>" + it.OrderTypeName + "</option>"; orderTypeS += "<option value='" + it.OrderTypeNo + "'>" + it.OrderTypeName + "</option>"; } orderType += "</select>"; orderTypeS += "</select>"; alloDept = "<select class=\"input-text required size-S\" id=\"AlloDeptS\" style=\"width:100px\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; alloDept += "<option value=\"\" selected>请选择</option>"; Business.Sys.BusinessDept allodt = new project.Business.Sys.BusinessDept(); foreach (Entity.Sys.EntityDept it in allodt.GetDeptListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { alloDept += "<option value='" + it.DeptNo + "'>" + it.DeptName + "</option>"; } alloDept += "</select>"; alloUser = "******"input-text required size-S\" id=\"AlloUserS\" style=\"width:100px\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; alloUser += "<option value=\"\" selected>请选择</option>"; Business.Sys.BusinessUserInfo allous = new project.Business.Sys.BusinessUserInfo(); foreach (Entity.Sys.EntityUserInfo it in allous.GetUserInfoListQuery(string.Empty, user.Entity.AccID, string.Empty, string.Empty)) { alloUser += "<option value='" + it.UserNo + "'>" + it.UserName + "</option>"; } alloUser += "</select>"; region = "<select class=\"input-text required size-S\" id=\"RegionS\" style=\"width:80px\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; region += "<option value=\"\" selected>请选择</option>"; Business.Base.BusinessRegion reg = new project.Business.Base.BusinessRegion(); foreach (Entity.Base.EntityRegion it in reg.GetRegionListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { region += "<option value='" + it.RegionNo + "'>" + it.RegionName + "</option>"; } region += "</select>"; status = "<select class=\"input-text required size-S\" id=\"StatusS\" style=\"width:80px\" data-valid=\"\" data-error=\"\">"; status += "<option value=\"\" selected>请选择</option>"; Business.Base.BusinessStatus st = new project.Business.Base.BusinessStatus(); foreach (Entity.Base.EntityStatus it in st.GetStatusListQuery(string.Empty, string.Empty, user.Entity.AccID)) { status += "<option value='" + it.StatusNo + "'>" + it.StatusName + "</option>"; } status += "</select>"; } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }
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, "pm/Base/AutoAllocation.aspx"); if (!Page.IsCallback) { list = createList(string.Empty, string.Empty); orderType = "<select class=\"input-text required size-S\" id=\"OrderType\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; orderTypeS = "<select class=\"input-text size-S\" id=\"OrderTypeS\" style=\"width:120px;\">"; orderType += "<option value=\"\" selected></option>"; orderTypeS += "<option value=\"\" selected>全部</option>"; Business.Base.BusinessOrderType type = new project.Business.Base.BusinessOrderType(); foreach (Entity.Base.EntityOrderType it in type.GetOrderTypeListQuery(string.Empty, string.Empty, string.Empty, user.Entity.AccID)) { orderType += "<option value='" + it.OrderTypeNo + "'>" + it.OrderTypeName + "</option>"; orderTypeS += "<option value='" + it.OrderTypeNo + "'>" + it.OrderTypeName + "</option>"; } orderType += "</select>"; orderTypeS += "</select>"; region = "<select class=\"input-text required size-S\" id=\"RegionNo\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; regionS = "<select class=\"input-text size-S\" id=\"RegionNoS\" style=\"width:120px;\">"; region += "<option value=\"\" selected></option>"; regionS += "<option value=\"\" selected>全部</option>"; Business.Base.BusinessRegion reg = new project.Business.Base.BusinessRegion(); foreach (Entity.Base.EntityRegion it in reg.GetRegionListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { region += "<option value='" + it.RegionNo + "'>" + it.RegionName + "</option>"; regionS += "<option value='" + it.RegionNo + "'>" + it.RegionName + "</option>"; } region += "</select>"; regionS += "</select>"; dept = "<select class=\"input-text required size-S\" id=\"DeptNo\" data-valid=\"isNonEmpty\" data-error=\"请选择\">"; dept += "<option value=\"\" selected></option>"; Business.Sys.BusinessDept allodt = new project.Business.Sys.BusinessDept(); foreach (Entity.Sys.EntityDept it in allodt.GetDeptListQuery(string.Empty, string.Empty, user.Entity.AccID, string.Empty)) { dept += "<option value='" + it.DeptNo + "'>" + it.DeptName + "</option>"; } dept += "</select>"; } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }
private string createList(string Name, int page) { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); if (Request.QueryString["type"] == "dept") { sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">"); sb.Append("<thead>"); sb.Append("<tr class=\"text-c\">"); sb.Append("<th width='35%'>部门编号</th>"); sb.Append("<th width='65%'>部门名称</th>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); Business.Sys.BusinessDept pt = new project.Business.Sys.BusinessDept(); foreach (Entity.Sys.EntityDept it in pt.GetDeptListQuery(string.Empty, Name, user.Entity.AccID, string.Empty, page, 15)) { sb.Append("<tr class=\"text-c\" id='" + it.DeptNo + "' onclick='submit(\"" + it.DeptNo + "\")'>"); sb.Append("<td style='white-space: nowrap;'>" + it.DeptNo + "<input type='hidden' id='it" + it.DeptNo + "' value='" + it.DeptName + "' /></td>"); sb.Append("<td style='white-space: nowrap;'>" + it.DeptName + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetDeptListCount(string.Empty, Name, user.Entity.AccID, string.Empty), 15, page, 5)); } else if (Request.QueryString["type"] == "user") { sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">"); sb.Append("<thead>"); sb.Append("<tr class=\"text-c\">"); sb.Append("<th width='25%'>用户编号</th>"); sb.Append("<th width='35%'>用户名称</th>"); sb.Append("<th width='40%'>所属部门</th>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); Business.Sys.BusinessUserInfo pt = new project.Business.Sys.BusinessUserInfo(); foreach (Entity.Sys.EntityUserInfo it in pt.GetUserInfoListQuery(string.Empty, user.Entity.AccID, string.Empty, Name, page, 15)) { sb.Append("<tr class=\"text-c\" id='" + it.UserNo + "' onclick='submit(\"" + it.UserNo + "\")'>"); sb.Append("<td style='white-space: nowrap;'>" + it.UserNo + "<input type='hidden' id='it" + it.UserNo + "' value='" + it.UserName + "' /></td>"); sb.Append("<td style='white-space: nowrap;'>" + it.UserName + "</td>"); sb.Append("<td style='white-space: nowrap;'>" + it.DeptName + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetUserInfoListCount(string.Empty, user.Entity.AccID, string.Empty, Name), 15, page, 5)); } else if (Request.QueryString["type"] == "region") { sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">"); sb.Append("<thead>"); sb.Append("<tr class=\"text-c\">"); sb.Append("<th width='35%'>地区编号</th>"); sb.Append("<th width='65%'>地区名称</th>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); Business.Base.BusinessRegion pt = new project.Business.Base.BusinessRegion(); foreach (Entity.Base.EntityRegion it in pt.GetRegionListQuery(string.Empty, Name, user.Entity.AccID, string.Empty, page, 15)) { sb.Append("<tr class=\"text-c\" id='" + it.RegionNo + "' onclick='submit(\"" + it.RegionNo + "\")'>"); sb.Append("<td style='white-space: nowrap;'>" + it.RegionNo + "<input type='hidden' id='it" + it.RegionNo + "' value='" + it.RegionName + "' /></td>"); sb.Append("<td style='white-space: nowrap;'>" + it.RegionName + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetRegionListCount(string.Empty, Name, user.Entity.AccID, string.Empty), 15, page, 5)); } else if (Request.QueryString["type"] == "cust") { sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">"); sb.Append("<thead>"); sb.Append("<tr class=\"text-c\">"); sb.Append("<th width='35%'>客户编号</th>"); sb.Append("<th width='65%'>客户名称</th>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); Business.Base.BusinessCustInfo pt = new project.Business.Base.BusinessCustInfo(); foreach (Entity.Base.EntityCustInfo it in pt.GetCustInfoListQuery(string.Empty, user.Entity.AccID, string.Empty, Name, "", true, page, 15)) { sb.Append("<tr class=\"text-c\" id='" + it.CustNo + "' onclick='submit(\"" + it.CustNo + "\")'>"); sb.Append("<td style='white-space: nowrap;'>" + it.CustNo + "<input type='hidden' id='it" + it.CustNo + "' value='" + it.CustName + "' /></td>"); sb.Append("<td style='white-space: nowrap;'>" + it.CustName + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetCustInfoListCount(string.Empty, user.Entity.AccID, string.Empty, Name, "", true), 15, page, 5)); } return(sb.ToString()); }