private string createList(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.BusinessWorkPlace pt = new project.Business.Base.BusinessWorkPlace();
                foreach (Entity.Base.EntityWorkPlace it in pt.GetListQuery(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
                                                                           Request.QueryString["RMID"].ToString(), string.Empty, page, 15))
                {
                    sb.Append("<tr class=\"text-c\" id='" + it.WPNo + "' onclick='submit(\"" + it.WPNo + "\")'>");
                    sb.Append("<td style='white-space: nowrap;'>" + it.WPNo + "<input type='hidden' id='it" + it.WPNo + "' value='" + it.WPNo + "' /></td>");
                    sb.Append("<td style='white-space: nowrap;'>" + it.WPSeat.ToString() + "</td>");
                    sb.Append("</tr>");
                }
                sb.Append("</tbody>");
                sb.Append("</table>");
                sb.Append(Paginat(pt.GetListCount(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
                                                  Request.QueryString["RMID"].ToString(), string.Empty), 15, page, 5));
            }
            catch { }
            return(sb.ToString());
        }
Exemple #2
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                bc.load(jp.getValue("id"));

                //if (obj.PopulateDataSet("select 1 from Mstr_WorkPlace where WPNo='" + bc.Entity.WPNo + "'").Tables[0].Rows.Count > 0)
                //{
                //    flag = "3";
                //}
                //else
                //{
                if (bc.Entity.WPStatus == "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.WPNo);
                        }
                        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("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }
Exemple #3
0
        private string validaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                bc.load(jp.getValue("id"));
                bc.Entity.WPISEnable = !bc.Entity.WPISEnable;

                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.AddOrUpdateWorkPlace(JsonConvert.SerializeObject(bc.Entity));
                    }
                    catch (Exception ex)
                    {
                        syncResult = ex.ToString();
                    }
                    collection.Add(new JsonStringValue("sync", syncResult));

                    #endregion
                }
                if (bc.Entity.WPISEnable)
                {
                    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("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Exemple #4
0
        private string createList(string WPNo, string WPType, string WPLOCNo1, string WPLOCNo2, string WPLOCNo3, string WPLOCNo4, string WPRMID, string WPStatus, 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=\"4%\">序号</th>");
            sb.Append("<th width='15%'>工位编号</th>");
            sb.Append("<th width='12%'>房间编号</th>");
            sb.Append("<th width='15%'>园区/建设期/楼栋/楼层</th>");
            sb.Append("<th width='11%'>所属项目</th>");
            sb.Append("<th width='5%'>人数</th>");
            sb.Append("<th width='7%'>每工位单价</th>");
            sb.Append("<th width='6%'>状态</th>");
            sb.Append("<th width='6%'>是否禁用</th>");
            sb.Append("<th width='21%'>地址</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            int r = 1;

            sb.Append("<tbody>");
            Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
            foreach (Entity.Base.EntityWorkPlace it in bc.GetListQuery(WPNo, WPType, WPLOCNo1, WPLOCNo2, WPLOCNo3, WPLOCNo4, WPRMID, WPStatus, page, pageSize))
            {
                sb.Append("<tr class=\"text-c\" id=\"" + it.WPNo + "\">");
                sb.Append("<td style=\"text-align:center;\">" + r.ToString() + "</td>");
                sb.Append("<td>" + it.WPNo + "</td>");
                sb.Append("<td>" + it.WPRMID + "</td>");
                sb.Append("<td>" + it.WPLOCNo1Name + "/" + it.WPLOCNo2Name + "/" + it.WPLOCNo3Name + "/" + it.WPLOCNo4Name + "</td>");
                sb.Append("<td>" + it.WPProject + "</td>");
                sb.Append("<td>" + it.WPSeat + "</td>");
                sb.Append("<td>" + it.WPSeatPrice.ToString("0.####") + "</td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.WPStatus == "use" ? "label-success" : "") + " radius\">" + it.WPStatusName + "</span></td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.WPISEnable == false ? "label-success" : "") + " radius\">" + (it.WPISEnable == false ? "正常" : "已禁用") + "</span></td>");
                sb.Append("<td>" + it.WPAddr + "</td>");
                sb.Append("</tr>");
                r++;
            }
            sb.Append("</tbody>");
            sb.Append("</table>");

            sb.Append(Paginat(bc.GetListCount(WPNo, WPType, WPLOCNo1, WPLOCNo2, WPLOCNo3, WPLOCNo4, WPRMID, WPStatus), pageSize, page, 7));

            return(sb.ToString());
        }
Exemple #5
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                bc.load(jp.getValue("id"));

                //if (obj.PopulateDataSet("select 1 from Mstr_WorkPlace where WPNo='" + bc.Entity.WPNo + "'").Tables[0].Rows.Count > 0)
                //{
                //    flag = "3";
                //}
                //else
                //{
                if (bc.Entity.WPStatus == "use")
                {
                    flag = "4";
                }
                else
                {
                    int r = bc.delete();
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        collection.Add(new JsonStringValue("ZYSync", bc.SyncResource("del")));
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "delete"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }
Exemple #6
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.WPType       = jp.getValue("WPType");
                    bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                    bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                    bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                    bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                    bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                    bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                    bc.Entity.WPRMID       = jp.getValue("WPRMID");
                    bc.Entity.WPProject    = jp.getValue("WPProject");
                    bc.Entity.WPAddr       = jp.getValue("WPAddr");
                    bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                    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_WorkPlace where WPNo='" + jp.getValue("WPNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.WPNo         = jp.getValue("WPNo");
                        bc.Entity.WPType       = jp.getValue("WPType");
                        bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                        bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                        bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                        bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                        bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                        bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                        bc.Entity.WPRMID       = jp.getValue("WPRMID");
                        bc.Entity.WPProject    = jp.getValue("WPProject");
                        bc.Entity.WPAddr       = jp.getValue("WPAddr");
                        bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.WPCreator    = user.Entity.UserName;
                        bc.Entity.WPCreateDate = 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("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }
Exemple #7
0
        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());
        }
Exemple #8
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.WPType       = jp.getValue("WPType");
                    bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                    bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                    bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                    bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                    bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                    bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                    bc.Entity.WPRMID       = jp.getValue("WPRMID");
                    bc.Entity.WPProject    = jp.getValue("WPProject");
                    bc.Entity.WPAddr       = jp.getValue("WPAddr");
                    bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                    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.AddOrUpdateWorkPlace(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_WorkPlace where WPNo='" + jp.getValue("WPNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.WPNo         = jp.getValue("WPNo");
                        bc.Entity.WPType       = jp.getValue("WPType");
                        bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                        bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                        bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                        bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                        bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                        bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                        bc.Entity.WPRMID       = jp.getValue("WPRMID");
                        bc.Entity.WPProject    = jp.getValue("WPProject");
                        bc.Entity.WPAddr       = jp.getValue("WPAddr");
                        bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.WPCreator    = user.Entity.UserName;
                        bc.Entity.WPCreateDate = 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.AddOrUpdateWorkPlace(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("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }