private string createList(string SRVSPName) { 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='30%'>工位类型编号</th>"); sb.Append("<th width='45%'>工位类型名称</th>"); sb.Append("<th width='20%'>座位数</th>"); sb.Append("</tr>"); sb.Append("</thead>"); int r = 1; sb.Append("<tbody>"); Business.Base.BusinessWorkPlaceType bc = new project.Business.Base.BusinessWorkPlaceType(); foreach (Entity.Base.EntityWorkPlaceType it in bc.GetListQuery(string.Empty, SRVSPName)) { sb.Append("<tr class=\"text-c\" id=\"" + it.WPTypeNo + "\">"); sb.Append("<td style=\"text-align:center;\">" + r.ToString() + "</td>"); sb.Append("<td style=\"text-align:left;\">" + it.WPTypeNo + "</td>"); sb.Append("<td style=\"text-align:left;\">" + it.WPTypeName + "</td>"); sb.Append("<td style=\"text-align:left;\">" + it.WPTypeSeat + "</td>"); sb.Append("</tr>"); r++; } sb.Append("</tbody>"); sb.Append("</table>"); return(sb.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessWorkPlaceType bc = new project.Business.Base.BusinessWorkPlaceType(); bc.load(jp.getValue("id")); if (obj.PopulateDataSet("select 1 from Mstr_WorkPlace where WPType='" + bc.Entity.WPTypeNo + "'").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("WPTypeNameS")))); return(collection.ToString()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessWorkPlaceType bc = new project.Business.Base.BusinessWorkPlaceType(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.WPTypeName = jp.getValue("WPTypeName"); bc.Entity.WPTypeSeat = ParseIntForString(jp.getValue("WPTypeSeat")); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_WorkPlaceType where WPTypeNo='" + jp.getValue("WPTypeNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.WPTypeNo = jp.getValue("WPTypeNo"); bc.Entity.WPTypeName = jp.getValue("WPTypeName"); bc.Entity.WPTypeSeat = ParseIntForString(jp.getValue("WPTypeSeat")); 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(jp.getValue("WPTypeNameS")))); return(collection.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessWorkPlaceType bc = new project.Business.Base.BusinessWorkPlaceType(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("WPTypeNo", bc.Entity.WPTypeNo)); collection.Add(new JsonStringValue("WPTypeName", bc.Entity.WPTypeName)); collection.Add(new JsonStringValue("WPTypeSeat", bc.Entity.WPTypeSeat.ToString())); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }