private string validaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessCustInfo bc = new project.Business.Base.BusinessCustInfo(); bc.load(jp.getValue("id")); bc.Entity.Valid = !bc.Entity.Valid; int r = bc.valid(); if (r <= 0) { flag = "2"; } if (bc.Entity.Valid) { collection.Add(new JsonStringValue("stat", "<span class=\"label label-success radius\">有效</span>")); } else { collection.Add(new JsonStringValue("stat", "<span class=\"label radius\">已失效</span>")); } collection.Add(new JsonStringValue("id", jp.getValue("id"))); } catch { flag = "2"; } collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("type", "valid")); return(collection.ToString()); }
private string createList(string Name, string Addr, int page) { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); 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='50%'>客户名称</th>"); sb.Append("<th width='25%'>地址</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, Addr, 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("<td style='white-space: nowrap;'>" + it.Addr + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetCustInfoListCount(string.Empty, user.Entity.AccID, string.Empty, Name, Addr, true), 15, page, 5)); return(sb.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessCustInfo bc = new project.Business.Base.BusinessCustInfo(); bc.load(jp.getValue("id")); if (obj.ExecuteDataSet("select 1 from WO_WorkOrder where CustNo='" + bc.Entity.CustNo + "' 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(jp.getValue("CustNameS"), int.Parse(jp.getValue("page"))))); return(collection.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; string result = "";; try { Business.Base.BusinessCustInfo bc = new project.Business.Base.BusinessCustInfo(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("CustNo", bc.Entity.CustNo)); collection.Add(new JsonStringValue("CustName", bc.Entity.CustName)); collection.Add(new JsonStringValue("CustType", bc.Entity.CustType)); collection.Add(new JsonStringValue("Contact", bc.Entity.Contact)); collection.Add(new JsonStringValue("Tel", bc.Entity.Tel)); collection.Add(new JsonStringValue("Addr", bc.Entity.Addr)); collection.Add(new JsonStringValue("Website", bc.Entity.Website)); 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 createList(string CustName, int page) { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); 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=\"5%\">序号</th>"); sb.Append("<th width='15%'>客户编号</th>"); sb.Append("<th width='20%'>客户名称</th>"); sb.Append("<th width='15%'>客户类型</th>"); sb.Append("<th width='15%'>联系人</th>"); sb.Append("<th width='15%'>电话</th>"); sb.Append("<th width='10%'>创建日期</th>"); sb.Append("<th width='5%'>状态</th>"); sb.Append("</tr>"); sb.Append("</thead>"); int r = 1; sb.Append("<tbody>"); Business.Base.BusinessCustInfo bc = new project.Business.Base.BusinessCustInfo(); foreach (Entity.Base.EntityCustInfo it in bc.GetCustInfoListQuery(string.Empty, user.Entity.AccID, string.Empty, CustName, "", null, page, pageSize)) { sb.Append("<tr class=\"text-c\" id=\"" + it.InnerEntityOID + "\">"); sb.Append("<td align='center'>" + r.ToString() + "</td>"); sb.Append("<td>" + it.CustNo + "</td>"); sb.Append("<td>" + it.CustName + "</td>"); sb.Append("<td>" + it.CustTypeName + "</td>"); sb.Append("<td>" + it.Contact + "</td>"); sb.Append("<td>" + it.Tel + "</td>"); sb.Append("<td>" + ParseStringForDate(it.RegDate) + "</td>"); sb.Append("<td class=\"td-status\"><span class=\"label " + (it.Valid ? "label-success" : "") + " radius\">" + (it.Valid ? "有效" : "已失效") + "</span></td>"); sb.Append("</tr>"); r++; } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(bc.GetCustInfoListCount(string.Empty, user.Entity.AccID, string.Empty, CustName, "", null), pageSize, page, 7)); return(sb.ToString()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessCustInfo bc = new project.Business.Base.BusinessCustInfo(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.CustName = jp.getValue("CustName"); bc.Entity.CustType = jp.getValue("CustType"); bc.Entity.Contact = jp.getValue("Contact"); bc.Entity.Tel = jp.getValue("Tel"); bc.Entity.Addr = jp.getValue("Addr"); bc.Entity.Website = jp.getValue("Website"); bc.Entity.Remark = jp.getValue("Remark"); int r = bc.Save(); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.ExecuteDataSet("select cnt=COUNT(*) from Base_Cust_Info where CustNo=N'" + jp.getValue("CustNo") + "' and AccID='" + user.Entity.AccID + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.CustNo = jp.getValue("CustNo"); bc.Entity.CustName = jp.getValue("CustName"); bc.Entity.CustType = jp.getValue("CustType"); bc.Entity.Contact = jp.getValue("Contact"); bc.Entity.Tel = jp.getValue("Tel"); bc.Entity.Addr = jp.getValue("Addr"); bc.Entity.Website = jp.getValue("Website"); bc.Entity.Remark = jp.getValue("Remark"); bc.Entity.AccID = user.Entity.AccID; bc.Entity.Valid = true; bc.Entity.RegDate = GetDate(); int r = bc.Save(); 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(jp.getValue("CustNameS"), int.Parse(jp.getValue("page"))))); return(collection.ToString()); }
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()); }