private string unreserveaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); bc.load(jp.getValue("id")); if (bc.Entity.RMStatus == "reserve") { int r = bc.unreserve(); if (r <= 0) { flag = "4"; } } else { flag = "3"; } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "unreserve")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"), jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString()); }
private string createList(string RMID, string RMLOCNo1, string RMLOCNo2, string RMLOCNo3, string RMLOCNo4, string RMCurrentRMNo, string RMStatus, 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='14%'>房间编号</th>"); sb.Append("<th width='8%'>房间号</th>"); sb.Append("<th width='14%'>园区/建设期/楼栋/楼层</th>"); sb.Append("<th width='8%'>出租类型</th>"); sb.Append("<th width='8%'>出租面积</th>"); sb.Append("<th width='6%'>状态</th>"); sb.Append("<th width='6%'>是否禁用</th>"); sb.Append("<th width='15%'>租客名称</th>"); sb.Append("<th width='8%'>预留日期</th>"); sb.Append("<th width='8%'>操作</th>"); sb.Append("</tr>"); sb.Append("</thead>"); int r = 1; sb.Append("<tbody>"); Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); foreach (Entity.Base.EntityRoom it in bc.GetListQuery(RMID, RMLOCNo1, RMLOCNo2, RMLOCNo3, RMLOCNo4, RMCurrentRMNo, string.Empty, RMStatus, null, page, pageSize)) { sb.Append("<tr class=\"text-c\" id=\"" + it.RMID + "\">"); sb.Append("<td style=\"text-align:center;\">" + r.ToString() + "</td>"); sb.Append("<td>" + it.RMID + "</td>"); sb.Append("<td>" + it.RMNo + "</td>"); sb.Append("<td>" + it.RMLOCNo1Name + "/" + it.RMLOCNo2Name + "/" + it.RMLOCNo3Name + "/" + it.RMLOCNo4Name + "</td>"); sb.Append("<td>" + it.RMRentTypeName + "</td>"); sb.Append("<td>" + it.RMRentSize.ToString("0.####") + "</td>"); sb.Append("<td class=\"td-status\"><span class=\"label " + (it.RMStatus == "use" ? "label-success" : "") + " radius\">" + it.RMStatusName + "</span></td>"); sb.Append("<td class=\"td-status\"><span class=\"label " + (it.RMISEnable == false ? "label-success" : "") + " radius\">" + (it.RMISEnable == false ? "正常" : "已禁用") + "</span></td>"); sb.Append("<td>" + it.RMCurrentCustName + "</td>"); sb.Append("<td>" + ParseStringForDate(it.RMEndReservedDate) + "</td>"); if (it.RMStatus == "use") { sb.Append("<td></td>"); } else if (it.RMStatus == "free") { sb.Append("<td><input class=\"btn btn-primary radius size-MINI\" style=\"padding:0px 10px; margin:0px;\" type=\"button\" value=\"预留\" onclick=\"reserve('" + it.RMID + "')\" /></td>"); } else { sb.Append("<td><input class=\"btn btn-primary radius size-MINI\" style=\"padding:0px 10px; margin:0px;\" type=\"button\" value=\"取消预留\" onclick=\"unreserve('" + it.RMID + "')\" /></td>"); } sb.Append("</tr>"); r++; } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(bc.GetListCount(RMID, RMLOCNo1, RMLOCNo2, RMLOCNo3, RMLOCNo4, RMCurrentRMNo, string.Empty, RMStatus, null), pageSize, page, 7)); return(sb.ToString()); }
private string createList(string RMLOCNo1, string RMLOCNo2, string RMLOCNo3, string RMLOCNo4, string RMID, string CustName, int page) { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); try { 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='30%'>房间编号</th>"); sb.Append("<th width='70%'>当前客户</th>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); Business.Base.BusinessRoom pt = new project.Business.Base.BusinessRoom(); foreach (Entity.Base.EntityRoom it in pt.GetListQuery(RMID, RMLOCNo1, RMLOCNo2, RMLOCNo3, RMLOCNo4, string.Empty, CustName, string.Empty, false, page, 15)) { string guid = Guid.NewGuid().ToString().Substring(0, 6); sb.Append("<tr class=\"text-c\" id='" + guid + "' onclick='submit(\"" + it.RMID + "\",\"" + guid + "\")'>"); sb.Append("<td style='white-space: nowrap;'>" + it.RMID + "<input type='hidden' id='it" + guid + "' value='" + it.RMID + "' /></td>"); sb.Append("<td style='white-space: nowrap;'>" + it.RMCurrentCustName + "</td>"); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); sb.Append(Paginat(pt.GetListCount(RMID, RMLOCNo1, RMLOCNo2, RMLOCNo3, RMLOCNo4, string.Empty, CustName, string.Empty, false), 15, page, 5)); } catch { } return(sb.ToString()); }
private string validaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); bc.load(jp.getValue("id")); bc.Entity.RMISEnable = !bc.Entity.RMISEnable; int r = bc.valid(); if (r <= 0) { flag = "2"; } else { #region 步到资源系统 string syncResult = string.Empty; try { ResourceService.ResourceService srv = new ResourceService.ResourceService(); srv.Url = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString(); syncResult = srv.AddOrUpdateRoom(JsonConvert.SerializeObject(bc.Entity)); } catch (Exception ex) { syncResult = ex.ToString(); } collection.Add(new JsonStringValue("sync", syncResult)); #endregion } if (bc.Entity.RMISEnable) { collection.Add(new JsonStringValue("stat", "<span class=\"label radius\">禁用</span>")); } else { collection.Add(new JsonStringValue("stat", "<span class=\"label label-success radius\">正常</span>")); } collection.Add(new JsonStringValue("id", jp.getValue("id"))); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "valid")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"), jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); bc.load(jp.getValue("id")); if (bc.Entity.RMStatus == "use") { flag = "4"; } else { int r = bc.delete(); if (r <= 0) { flag = "2"; } else { #region 步到资源系统 string syncResult = string.Empty; try { ResourceService.ResourceService srv = new ResourceService.ResourceService(); srv.Url = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString(); syncResult = srv.DeleteResource(bc.Entity.RMID); } catch (Exception ex) { syncResult = ex.ToString(); } collection.Add(new JsonStringValue("sync", syncResult)); #endregion } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "delete")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"), jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.RMLOCNo1 = jp.getValue("RMLOCNo1"); bc.Entity.RMLOCNo2 = jp.getValue("RMLOCNo2"); bc.Entity.RMLOCNo3 = jp.getValue("RMLOCNo3"); bc.Entity.RMLOCNo4 = jp.getValue("RMLOCNo4"); bc.Entity.RMRentType = jp.getValue("RMRentType"); bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics")); bc.Entity.RMBuildSize = ParseDecimalForString(jp.getValue("RMBuildSize")); bc.Entity.RMRentSize = ParseDecimalForString(jp.getValue("RMRentSize")); bc.Entity.RMAddr = jp.getValue("RMAddr"); bc.Entity.RMRemark = jp.getValue("RMRemark"); bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition")); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } else { collection.Add(new JsonStringValue("ZYSync", bc.SyncResource("au"))); } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_Room where RMID='" + jp.getValue("RMID") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.RMID = jp.getValue("RMID"); bc.Entity.RMNo = jp.getValue("RMNo"); bc.Entity.RMLOCNo1 = jp.getValue("RMLOCNo1"); bc.Entity.RMLOCNo2 = jp.getValue("RMLOCNo2"); bc.Entity.RMLOCNo3 = jp.getValue("RMLOCNo3"); bc.Entity.RMLOCNo4 = jp.getValue("RMLOCNo4"); bc.Entity.RMRentType = jp.getValue("RMRentType"); bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics")); bc.Entity.RMBuildSize = ParseDecimalForString(jp.getValue("RMBuildSize")); bc.Entity.RMRentSize = ParseDecimalForString(jp.getValue("RMRentSize")); bc.Entity.RMAddr = jp.getValue("RMAddr"); bc.Entity.RMRemark = jp.getValue("RMRemark"); bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition")); bc.Entity.RMCreator = user.Entity.UserName; bc.Entity.RMCreateDate = GetDate(); int r = bc.Save("insert"); if (r <= 0) { flag = "2"; } else { collection.Add(new JsonStringValue("ZYSync", bc.SyncResource("au"))); } } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"), jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page"))))); return(collection.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()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.RMLOCNo1 = jp.getValue("RMLOCNo1"); bc.Entity.RMLOCNo2 = jp.getValue("RMLOCNo2"); bc.Entity.RMLOCNo3 = jp.getValue("RMLOCNo3"); bc.Entity.RMLOCNo4 = jp.getValue("RMLOCNo4"); bc.Entity.RMRentType = jp.getValue("RMRentType"); bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics")); bc.Entity.RMBuildSize = ParseDecimalForString(jp.getValue("RMBuildSize")); bc.Entity.RMRentSize = ParseDecimalForString(jp.getValue("RMRentSize")); bc.Entity.RMAddr = jp.getValue("RMAddr"); bc.Entity.RMRemark = jp.getValue("RMRemark"); bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition")); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } else { #region 步到资源系统 string syncResult = string.Empty; try { ResourceService.ResourceService srv = new ResourceService.ResourceService(); srv.Url = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString(); syncResult = srv.AddOrUpdateRoom(JsonConvert.SerializeObject(bc.Entity)); } catch (Exception ex) { syncResult = ex.ToString(); } collection.Add(new JsonStringValue("sync", syncResult)); #endregion } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_Room where RMID='" + jp.getValue("RMID") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.RMID = jp.getValue("RMID"); bc.Entity.RMNo = jp.getValue("RMNo"); bc.Entity.RMLOCNo1 = jp.getValue("RMLOCNo1"); bc.Entity.RMLOCNo2 = jp.getValue("RMLOCNo2"); bc.Entity.RMLOCNo3 = jp.getValue("RMLOCNo3"); bc.Entity.RMLOCNo4 = jp.getValue("RMLOCNo4"); bc.Entity.RMRentType = jp.getValue("RMRentType"); bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics")); bc.Entity.RMBuildSize = ParseDecimalForString(jp.getValue("RMBuildSize")); bc.Entity.RMRentSize = ParseDecimalForString(jp.getValue("RMRentSize")); bc.Entity.RMAddr = jp.getValue("RMAddr"); bc.Entity.RMRemark = jp.getValue("RMRemark"); bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition")); bc.Entity.RMCreator = user.Entity.UserName; bc.Entity.RMCreateDate = GetDate(); int r = bc.Save("insert"); if (r <= 0) { flag = "2"; } else { #region 步到资源系统 string syncResult = string.Empty; try { ResourceService.ResourceService srv = new ResourceService.ResourceService(); srv.Url = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString(); syncResult = srv.AddOrUpdateRoom(JsonConvert.SerializeObject(bc.Entity)); } catch (Exception ex) { syncResult = ex.ToString(); } collection.Add(new JsonStringValue("sync", syncResult)); #endregion } } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"), jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString()); }