private string getRMaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; Business.Base.BusinessLocation bc = new Business.Base.BusinessLocation(); bc.load(jp.getValue("RMLOCNo3")); string building = ""; Business.Base.BusinessLocation loc2 = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in loc2.GetListQuery(string.Empty, string.Empty, bc.Entity.ParentLOCNo)) { if (it.LOCNo == jp.getValue("RMLOCNo3")) { building += "<span class=\"btn btn-primary radius\" id=\"" + it.LOCNo + "\">" + it.LOCName + "</span>"; } else { building += "<span class=\"btn btn-default radius\" id=\"" + it.LOCNo + "\" onclick=\"getRM('" + it.LOCNo + "')\">" + it.LOCName + "</span>"; } } collection.Add(new JsonStringValue("building", building)); collection.Add(new JsonStringValue("rmlist", getRMList(jp.getValue("RMLOCNo1"), jp.getValue("RMLOCNo2"), jp.getValue("RMLOCNo3"), jp.getValue("RMID"), jp.getValue("CustName"), jp.getValue("RMStatus")))); collection.Add(new JsonStringValue("type", "select")); collection.Add(new JsonStringValue("flag", flag)); 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, "pm/Op/GenOrder.aspx"); if (!Page.IsCallback) { list = createList("", "", "", "", "", "", GetDate().AddMonths(-1).ToString("yyyy-MM"), GetDate().ToString("yyyy-MM"), ""); Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); RMLOCNo1Str += "<select id=\"RMLOCNo1\" class=\"input-text required\" style=\"width:120px;\">"; RMLOCNo1Str += "<option value=''>全部</option>"; foreach (Entity.Base.EntityLocation it in loc.GetListQuery(string.Empty, string.Empty, "null")) { RMLOCNo1Str += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; } RMLOCNo1Str += "</select>"; Business.Base.BusinessContractType bc = new Business.Base.BusinessContractType(); ContractType += "<select id=\"ContractType\" class=\"input-text required\" style=\"width:120px;\">"; ContractType += "<option value=''>全部</option>"; foreach (Entity.Base.EntityContractType it in bc.GetListQuery(string.Empty, string.Empty)) { ContractType += "<option value='" + it.ContractTypeNo + "'>" + it.ContractTypeName + "</option>"; } ContractType += "</select>"; SPNoStr = "<select class=\"input-text size-MINI\" id=\"SPNo\" style=\"width:120px;\" >"; SPNoStr += "<option value=\"\" selected>全部</option>"; Business.Base.BusinessServiceProvider sp = new Business.Base.BusinessServiceProvider(); foreach (Entity.Base.EntityServiceProvider item in sp.GetListQuery("", "", true)) { SPNoStr += "<option value='" + item.SPNo + "'>" + item.SPShortName + "</option>"; } SPNoStr += "</select>"; } } else { Response.Write(errorpage); return; } } catch { Response.Write(errorpage); return; } }
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); id = Request.QueryString["id"].ToString(); if (!Page.IsCallback) { string LOCNo = string.Empty; if (Request.QueryString["LOCNo"] != null) { LOCNo = Request.QueryString["LOCNo"].ToString(); } list = createList(string.Empty, string.Empty, string.Empty, LOCNo, string.Empty, string.Empty, 1); Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); RMLOCNo1Str += "<select id=\"RMLOCNo1\" class=\"input-text required size-MINI\" style=\"width:120px\">"; RMLOCNo1Str += "<option value=''>全部</option>"; foreach (Entity.Base.EntityLocation it in loc.GetListQuery(string.Empty, string.Empty, "null")) { RMLOCNo1Str += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; } RMLOCNo1Str += "</select>"; } } else { GotoErrorPage(); } } catch { GotoErrorPage(); } }
private string getRMList(string RMLOCNo1, string RMLOCNo2, string RMLOCNo3, string RMID, string CustName, string RMStatus) { StringBuilder sb = new StringBuilder(); Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in loc.GetListQuery(string.Empty, string.Empty, RMLOCNo3)) { sb.Append("<div class=\"mb-10\" style=\"clear:both;\">"); sb.Append("<h3>" + it.LOCName + "</h3>"); Business.Base.BusinessRoom br = new Business.Base.BusinessRoom(); foreach (Entity.Base.EntityRoom it1 in br.GetListQuery(RMID, RMLOCNo1, RMLOCNo2, RMLOCNo3, it.LOCNo, string.Empty, CustName, RMStatus, false)) { sb.Append("<div class=\"div-room pd-10 radius cl mr-10 mb-10\">"); if (it1.RMStatus == "free") { sb.Append("<div class=\"room-status c-red \"><label class=\"c-green\">空闲</label></div>"); } else if (it1.RMStatus == "use") { sb.Append("<div class=\"room-status\"><label class=\"c-red\">已租</label></div>"); } else { sb.Append("<div class=\"room-status c-red\"> <label class=\"c-orange\">预留</label></div>"); } sb.Append("<div class=\"room-text\">" + it1.RMNo + "</div>"); sb.Append("<div class=\"text-c div-name va-m\"><strong>" + it1.RMCurrentCustName + "</strong></div>"); sb.Append("<span class=\"span-w text-l dil-b f-l va-m\">" + it1.RMRentSize.ToString("0.####") + "平米</span>"); //<span class=\"span-w text-r dil-b f-l va-m\"></span> sb.Append("</div>"); } sb.Append("</div>"); } return(sb.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("RMID", bc.Entity.RMID)); collection.Add(new JsonStringValue("RMNo", bc.Entity.RMNo)); collection.Add(new JsonStringValue("RMLOCNo1", bc.Entity.RMLOCNo1)); collection.Add(new JsonStringValue("RMLOCNo2", bc.Entity.RMLOCNo2)); collection.Add(new JsonStringValue("RMLOCNo3", bc.Entity.RMLOCNo3)); collection.Add(new JsonStringValue("RMLOCNo4", bc.Entity.RMLOCNo4)); collection.Add(new JsonStringValue("RMRentType", bc.Entity.RMRentType)); collection.Add(new JsonStringValue("RMBuildSize", bc.Entity.RMBuildSize.ToString("0.####"))); collection.Add(new JsonStringValue("RMRentSize", bc.Entity.RMRentSize.ToString("0.####"))); collection.Add(new JsonStringValue("RMAddr", bc.Entity.RMAddr)); collection.Add(new JsonStringValue("RMRemark", bc.Entity.RMRemark)); collection.Add(new JsonStringValue("HaveAirCondition", (bc.Entity.HaveAirCondition ? "true" : "false"))); collection.Add(new JsonStringValue("IsStatistics", (bc.Entity.IsStatistics ? "true" : "false"))); string subtype = ""; int row = 0; Business.Base.BusinessLocation bt = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.RMLOCNo1)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row", row)); collection.Add(new JsonStringValue("subtype", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.RMLOCNo2)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row1", row)); collection.Add(new JsonStringValue("subtype1", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.RMLOCNo3)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row2", row)); collection.Add(new JsonStringValue("subtype2", subtype)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); 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, "pm/Base/Room.aspx"); if (!Page.IsCallback) { if (user.Entity.UserType.ToUpper() != "ADMIN") { string sqlstr = "select a.RightCode from Sys_UserRight a left join sys_menu b on a.MenuId=b.MenuID " + "where a.UserType='" + user.Entity.UserType + "' and menupath='pm/Base/Room.aspx'"; DataTable dt = obj.PopulateDataSet(sqlstr).Tables[0]; if (dt.Rows.Count > 0) { string rightCode = dt.Rows[0]["RightCode"].ToString(); if (rightCode.IndexOf("insert") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 添加</a> "; } if (rightCode.IndexOf("update") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 修改</a> "; } if (rightCode.IndexOf("delete") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\"></i> 删除</a> "; } if (rightCode.IndexOf("vilad") >= 0) { Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 启用/停用</a> "; } } } else { Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 添加</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 修改</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\"></i> 删除</a> "; Buttons += "<a href=\"javascript:;\" onclick=\"valid()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\"></i> 启用/停用</a> "; } list = createList(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, 1); Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); RMLOCNo1Str += "<select id=\"RMLOCNo1\" class=\"input-text required\" data-valid=\"isNonEmpty\" data-error=\"园区不能为空\">"; RMLOCNo1StrS += "<select id=\"RMLOCNo1S\" class=\"input-text required size-MINI\" style=\"width:120px\">"; RMLOCNo1Str += "<option value=''>请选择园区</option>"; RMLOCNo1StrS += "<option value=''>全部</option>"; foreach (Entity.Base.EntityLocation it in loc.GetListQuery(string.Empty, string.Empty, "null")) { RMLOCNo1Str += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; RMLOCNo1StrS += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; } RMLOCNo1Str += "</select>"; RMLOCNo1StrS += "</select>"; } } else { Response.Write(errorpage); return; } } catch { Response.Write(errorpage); return; } }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("WPNo", bc.Entity.WPNo)); collection.Add(new JsonStringValue("WPType", bc.Entity.WPType)); collection.Add(new JsonStringValue("WPSeat", bc.Entity.WPSeat.ToString())); collection.Add(new JsonStringValue("WPSeatPrice", bc.Entity.WPSeatPrice.ToString("0.####"))); collection.Add(new JsonStringValue("WPLOCNo1", bc.Entity.WPLOCNo1)); collection.Add(new JsonStringValue("WPLOCNo2", bc.Entity.WPLOCNo2)); collection.Add(new JsonStringValue("WPLOCNo3", bc.Entity.WPLOCNo3)); collection.Add(new JsonStringValue("WPLOCNo4", bc.Entity.WPLOCNo4)); collection.Add(new JsonStringValue("WPRMID", bc.Entity.WPRMID)); collection.Add(new JsonStringValue("WPProject", bc.Entity.WPProject)); collection.Add(new JsonStringValue("WPAddr", bc.Entity.WPAddr)); collection.Add(new JsonStringValue("IsStatistics", (bc.Entity.IsStatistics ? "true" : "false"))); string subtype = ""; int row = 0; Business.Base.BusinessLocation bt = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.WPLOCNo1)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row", row)); collection.Add(new JsonStringValue("subtype", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.WPLOCNo2)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row1", row)); collection.Add(new JsonStringValue("subtype1", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.WPLOCNo3)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row2", row)); collection.Add(new JsonStringValue("subtype2", subtype)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); 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", "="); string userid = Encrypt.DecryptDES(str, "1"); user.load(userid); if (!IsCallback) { int r = 0; string locno2 = ""; //园区 Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); RMLOCNo1Str += "<select id=\"RMLOCNo1\" class=\"input-text size-MINI\" style=\"width:120px;vertical-align:middle\">"; foreach (Entity.Base.EntityLocation it in loc.GetListQuery(string.Empty, string.Empty, "null")) { if (r == 0) { RMLOCNo1Str += "<option value='" + it.LOCNo + "' selected='selected'>" + it.LOCName + "</option>"; locno = it.LOCNo; } else { RMLOCNo1Str += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; } r++; } RMLOCNo1Str += "</select>"; //建设期 r = 0; Business.Base.BusinessLocation loc1 = new Business.Base.BusinessLocation(); RMLOCNo2Str += "<select id=\"RMLOCNo2\" class=\"input-text size-MINI\" style=\"width:120px;vertical-align:middle\">"; foreach (Entity.Base.EntityLocation it in loc1.GetListQuery(string.Empty, string.Empty, locno)) { if (r == 0) { RMLOCNo2Str += "<option value='" + it.LOCNo + "' selected='selected'>" + it.LOCName + "</option>"; locno1 = it.LOCNo; } else { RMLOCNo2Str += "<option value='" + it.LOCNo + "'>" + it.LOCName + "</option>"; } r++; } RMLOCNo2Str += "</select>"; //楼栋 r = 0; Business.Base.BusinessLocation loc2 = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in loc2.GetListQuery(string.Empty, string.Empty, locno1)) { if (r == 0) { RMLOCNo3Str += "<span class=\"btn btn-primary radius\" id=\"" + it.LOCNo + "\">" + it.LOCName + "</span>"; locno2 = it.LOCNo; } else { RMLOCNo3Str += "<span class=\"btn btn-default radius\" id=\"" + it.LOCNo + "\" onclick=\"getRM('" + it.LOCNo + "')\">" + it.LOCName + "</span>"; } r++; } rmlist = getRMList(locno, locno1, locno2, "", "", ""); DataSet ds = GetParkProfile(); #region 园区概况 Temp DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { packprofile += "<dl>"; packprofile += "<dt>楼栋</dt>"; packprofile += "<dd class=\" text-r\">" + dt.Rows[0]["BUILDING"].ToString() + "</dd>"; packprofile += "<dt>房间</dt>"; packprofile += "<dd class=\" text-r\">" + dt.Rows[0]["ROOM"].ToString() + "</dd>"; packprofile += "<dt>空置</dt>"; packprofile += "<dd class=\" text-r\">" + dt.Rows[0]["VACANCY"].ToString() + "</dd>"; packprofile += "<dt>空置率</dt>"; packprofile += "<dd class=\" text-r\">" + (ParseDecimalForString(dt.Rows[0]["VACANCYRATE"].ToString()) * 100).ToString("0.####") + "%</dd>"; packprofile += "<dt>日/月新租</dt>"; packprofile += "<dd class=\" text-r\">" + dt.Rows[0]["DAYRENTAL"].ToString() + "/" + dt.Rows[0]["MONTHRENTAL"].ToString() + "</dd>"; packprofile += "<dt>日/月退租申请</dt>"; packprofile += "<dd class=\" text-r\">" + dt.Rows[0]["DAYLEASE"].ToString() + "/" + dt.Rows[0]["MONTHLEASE"].ToString() + "</dd>"; packprofile += "</dl>"; } #endregion #region 事务提醒 Tmp3 trans += "<dl>"; DataTable dt2 = ds.Tables[2]; for (int i = 0; i < 6; i++) { if (i < dt2.Rows.Count) { trans += "<dt>" + dt2.Rows[i]["TranName"].ToString() + "</dd>"; trans += "<dd class=\"text-r\">" + dt2.Rows[i]["Cnt"].ToString() + "</dt>"; } else { trans += "<dt></dd>"; trans += "<dd class=\"text-r\"></dt>"; } } trans += "</dl>"; #endregion #region 合同到期提醒 Temp2 DataTable dt1 = ds.Tables[1]; expireRemind += "<table class=\"table\"><tbody><tr><th>客户名称</th><th>合同类别</th><th>退租状态</th><th>合同到期日期</th></tr>"; if (dt1.Rows.Count > 0) { for (int i = 0; i < dt1.Rows.Count; i++) { expireRemind += "<tr><td>" + dt1.Rows[i]["CustName"].ToString() + "</td>"; expireRemind += "<td>" + dt1.Rows[i]["CntType"].ToString() + "</td>"; expireRemind += "<td>" + dt1.Rows[i]["LeaveStatus"].ToString() + "</td>"; expireRemind += "<td>" + ParseStringForDate(ParseDateForString(dt1.Rows[i]["EndDate"].ToString())) + "</td></tr>"; } } else { expireRemind += "<tr ><td colspan=\"4\" style=\"text-align:center;\">无数据</td></tr>"; } expireRemind += "<tr></tr></tbody></table>"; //expire += "<dl>"; //expire += "<dt class=\"titles\">客户</dd>"; //expire += "<dd class=\"titles text-r\" style=\"color:orange \">到期日期</dt>"; //foreach (DataRow dr in dt1.Rows) //{ // expire += "<dd>" + dr["CustName"].ToString() + "</dd>"; // expire += "<dt class=\"text-r\"><a href=\"#\">" + ParseStringForDate(ParseDateForString(dr["EndDate"].ToString())) + "</a></dt>"; //} //expire += "</dl>"; #endregion #region 新租提醒 Temp4 DataTable dt4 = ds.Tables[3]; newRentRemind += "<table class=\"table\"><tbody><tr><th>客户名称</th><th>合同类别</th><th>合同状态</th><th>合同签订日期</th></tr>"; if (dt4.Rows.Count > 0) { for (int i = 0; i < dt4.Rows.Count; i++) { newRentRemind += "<tr><td>" + dt4.Rows[i]["CustName"].ToString() + "</td>"; newRentRemind += "<td>" + dt4.Rows[i]["CntType"].ToString() + "</td>"; newRentRemind += "<td>" + dt4.Rows[i]["CntStatus"].ToString() + "</td>"; newRentRemind += "<td>" + ParseStringForDate(ParseDateForString(dt4.Rows[i]["SingnDate"].ToString())) + "</td></tr>"; } } else { newRentRemind += "<tr ><td colspan=\"4\" style=\"text-align:center;\">无数据</td></tr>"; } newRentRemind += "<tr></tr></tbody></table>"; #endregion #region 预约退租提醒 Temp5 DataTable dt5 = ds.Tables[4]; reservationRemind += "<table class=\"table\"><tbody><tr><th>客户名称</th><th>合同类别</th><th>退租状态</th><th>预计退租日期</th></tr>"; if (dt5.Rows.Count > 0) { for (int i = 0; i < dt5.Rows.Count; i++) { reservationRemind += "<tr><td>" + dt5.Rows[i]["CustName"].ToString() + "</td>"; reservationRemind += "<td>" + dt5.Rows[i]["CntType"].ToString() + "</td>"; reservationRemind += "<td>" + dt5.Rows[i]["LeaveStatus"].ToString() + "</td>"; reservationRemind += "<td>" + ParseStringForDate(ParseDateForString(dt5.Rows[i]["LeaveDate"].ToString())) + "</td></tr>"; } } else { reservationRemind += "<tr ><td colspan=\"4\" style=\"text-align:center;\">无数据</td></tr>"; } reservationRemind += "<tr></tr></tbody></table>"; #endregion #region 退租提醒 Temp6 DataTable dt6 = ds.Tables[5]; endRentRemind += "<table class=\"table\"><tbody><tr><th>客户名称</th><th>合同类别</th><th>退租状态</th><th>实际退租日期</th></tr>"; if (dt6.Rows.Count > 0) { for (int i = 0; i < dt6.Rows.Count; i++) { endRentRemind += "<tr><td>" + dt6.Rows[i]["CustName"].ToString() + "</td>"; endRentRemind += "<td>" + dt6.Rows[i]["CntType"].ToString() + "</td>"; endRentRemind += "<td>" + dt6.Rows[i]["LeaveStatus"].ToString() + "</td>"; endRentRemind += "<td>" + ParseStringForDate(ParseDateForString(dt6.Rows[i]["LeaveDate"].ToString())) + "</td></tr>"; } } else { endRentRemind += "<tr ><td colspan=\"4\" style=\"text-align:center;\">无数据</td></tr>"; } endRentRemind += "<tr></tr></tbody></table>"; #endregion } } else { Response.Write("<script type='text/javascript'>window.parent.window.location.href='login.aspx';</script>"); return; } } catch (Exception ex) { Response.Write("<script type='text/javascript'>window.parent.window.location.href='login.aspx';</script>"); return; } }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLocation bc = new project.Business.Base.BusinessLocation(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.LOCName = jp.getValue("LOCName"); bc.Entity.ParentLOCNo = jp.getValue("ParentLOCNo"); if (bc.Entity.ParentLOCNo == "") { bc.Entity.LOCLevel = 1; } else { Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); loc.load(bc.Entity.ParentLOCNo); bc.Entity.LOCLevel = loc.Entity.LOCLevel + 1; } int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_Location where LOCNo='" + jp.getValue("LOCNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.LOCNo = jp.getValue("LOCNo"); bc.Entity.LOCName = jp.getValue("LOCName"); bc.Entity.ParentLOCNo = jp.getValue("ParentLOCNo"); if (bc.Entity.ParentLOCNo == "") { bc.Entity.LOCLevel = 1; } else { Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); loc.load(bc.Entity.ParentLOCNo); bc.Entity.LOCLevel = loc.Entity.LOCLevel + 1; } 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 updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessMeter bc = new project.Business.Base.BusinessMeter(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("MeterNo", bc.Entity.MeterNo)); collection.Add(new JsonStringValue("MeterName", bc.Entity.MeterName)); collection.Add(new JsonStringValue("MeterType", bc.Entity.MeterType)); collection.Add(new JsonStringValue("MeterLOCNo1", bc.Entity.MeterLOCNo1)); collection.Add(new JsonStringValue("MeterLOCNo2", bc.Entity.MeterLOCNo2)); collection.Add(new JsonStringValue("MeterLOCNo3", bc.Entity.MeterLOCNo3)); collection.Add(new JsonStringValue("MeterLOCNo4", bc.Entity.MeterLOCNo4)); collection.Add(new JsonStringValue("MeterRate", bc.Entity.MeterRate.ToString("0.####"))); collection.Add(new JsonStringValue("MeterDigit", bc.Entity.MeterDigit.ToString())); collection.Add(new JsonStringValue("MeterUsageType", bc.Entity.MeterUsageType)); collection.Add(new JsonStringValue("MeterNatureType", bc.Entity.MeterNatureType)); collection.Add(new JsonStringValue("MeterReadout", bc.Entity.MeterReadout.ToString("0.####"))); collection.Add(new JsonStringValue("MeterReadoutDate", ParseStringForDate(bc.Entity.MeterReadoutDate))); collection.Add(new JsonStringValue("MeterRMID", bc.Entity.MeterRMID)); collection.Add(new JsonStringValue("MeterSize", bc.Entity.MeterSize)); collection.Add(new JsonStringValue("MeterRelatedMeterNo", bc.Entity.MeterRelatedMeterNo)); collection.Add(new JsonStringValue("Addr", bc.Entity.Addr)); string subtype = ""; int row = 0; Business.Base.BusinessLocation bt = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.MeterLOCNo1)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row", row)); collection.Add(new JsonStringValue("subtype", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.MeterLOCNo2)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row1", row)); collection.Add(new JsonStringValue("subtype1", subtype)); row = 0; subtype = ""; foreach (Entity.Base.EntityLocation it in bt.GetListQuery(string.Empty, string.Empty, bc.Entity.MeterLOCNo3)) { subtype += it.LOCNo + ":" + it.LOCName + ";"; row++; } collection.Add(new JsonNumericValue("row2", row)); collection.Add(new JsonStringValue("subtype2", subtype)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }