Ejemplo n.º 1
0
        private string reserveaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessConferenceRoom bc = new project.Business.Base.BusinessConferenceRoom();
                bc.load(jp.getValue("id"));
                if (bc.Entity.CRStatus == "free")
                {
                    bc.Entity.CRCurrentCustNo   = jp.getValue("ReserveCust");
                    bc.Entity.CRReservedDate    = GetDate();
                    bc.Entity.CRBegReservedDate = ParseDateForString(jp.getValue("BegReserveDate"));
                    bc.Entity.CREndReservedDate = ParseDateForString(jp.getValue("EndReserveDate"));
                    int r = bc.reserve();
                    if (r <= 0)
                    {
                        flag = "4";
                    }
                }
                else
                {
                    flag = "3";
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "reserve"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("CRNoS"), jp.getValue("CRNameS"), jp.getValue("CRAddrS"), jp.getValue("CRStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Ejemplo n.º 2
0
        private string unreserveaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessConferenceRoom bc = new project.Business.Base.BusinessConferenceRoom();
                bc.load(jp.getValue("id"));
                if (bc.Entity.CRStatus == "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("CRNoS"), jp.getValue("CRNameS"), jp.getValue("CRAddrS"), jp.getValue("CRStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Ejemplo n.º 3
0
        private string validaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                int r = bc.valid();
                if (r <= 0)
                {
                    flag = "2";
                }
                if (bc.Entity.CRISEnable)
                {
                    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("CRNoS"), jp.getValue("CRNameS"), jp.getValue("CRAddrS"), jp.getValue("CRStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Ejemplo n.º 4
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                collection.Add(new JsonStringValue("CRNo", bc.Entity.CRNo));
                collection.Add(new JsonStringValue("CRName", bc.Entity.CRName));
                collection.Add(new JsonStringValue("CRCapacity", bc.Entity.CRCapacity));
                collection.Add(new JsonStringValue("CRINPriceHour", bc.Entity.CRINPriceHour.ToString("0.####")));
                collection.Add(new JsonStringValue("CRINPriceHalfDay", bc.Entity.CRINPriceHalfDay.ToString("0.####")));
                collection.Add(new JsonStringValue("CRINPriceDay", bc.Entity.CRINPriceDay.ToString("0.####")));
                collection.Add(new JsonStringValue("CROUTPriceHour", bc.Entity.CROUTPriceHour.ToString("0.####")));
                collection.Add(new JsonStringValue("CROUTPriceHalfDay", bc.Entity.CROUTPriceHalfDay.ToString("0.####")));
                collection.Add(new JsonStringValue("CROUTPriceDay", bc.Entity.CROUTPriceDay.ToString("0.####")));
                collection.Add(new JsonStringValue("CRDeposit", bc.Entity.CRDeposit.ToString("0.####")));
                collection.Add(new JsonStringValue("CRAddr", bc.Entity.CRAddr));

                //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.CRLOCNo1))
                //{
                //    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.CRLOCNo2))
                //{
                //    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.CRLOCNo3))
                //{
                //    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());
        }
Ejemplo n.º 5
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                //if (obj.PopulateDataSet("select 1 from Mstr_ConferenceRoom where CRNo='" + bc.Entity.CRNo + "'").Tables[0].Rows.Count > 0)
                //{
                //    flag = "3";
                //}
                //else
                //{
                if (bc.Entity.CRStatus == "use")
                {
                    flag = "4";
                }
                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("CRNoS"), jp.getValue("CRNameS"), jp.getValue("CRAddrS"), jp.getValue("CRStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Ejemplo n.º 6
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessConferenceRoom bc = new project.Business.Base.BusinessConferenceRoom();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.CRName            = jp.getValue("CRName");
                    bc.Entity.CRCapacity        = jp.getValue("CRCapacity");
                    bc.Entity.CRINPriceHour     = ParseDecimalForString(jp.getValue("CRINPriceHour"));
                    bc.Entity.CRINPriceHalfDay  = ParseDecimalForString(jp.getValue("CRINPriceHalfDay"));
                    bc.Entity.CRINPriceDay      = ParseDecimalForString(jp.getValue("CRINPriceDay"));
                    bc.Entity.CROUTPriceHour    = ParseDecimalForString(jp.getValue("CROUTPriceHour"));
                    bc.Entity.CROUTPriceHalfDay = ParseDecimalForString(jp.getValue("CROUTPriceHalfDay"));
                    bc.Entity.CROUTPriceDay     = ParseDecimalForString(jp.getValue("CROUTPriceDay"));
                    bc.Entity.CRDeposit         = ParseDecimalForString(jp.getValue("CRDeposit"));
                    bc.Entity.CRAddr            = jp.getValue("CRAddr");

                    int r = bc.Save("update");

                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_ConferenceRoom where CRNo='" + jp.getValue("CRNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.CRNo              = jp.getValue("CRNo");
                        bc.Entity.CRName            = jp.getValue("CRName");
                        bc.Entity.CRCapacity        = jp.getValue("CRCapacity");
                        bc.Entity.CRINPriceHour     = ParseDecimalForString(jp.getValue("CRINPriceHour"));
                        bc.Entity.CRINPriceHalfDay  = ParseDecimalForString(jp.getValue("CRINPriceHalfDay"));
                        bc.Entity.CRINPriceDay      = ParseDecimalForString(jp.getValue("CRINPriceDay"));
                        bc.Entity.CROUTPriceHour    = ParseDecimalForString(jp.getValue("CROUTPriceHour"));
                        bc.Entity.CROUTPriceHalfDay = ParseDecimalForString(jp.getValue("CROUTPriceHalfDay"));
                        bc.Entity.CROUTPriceDay     = ParseDecimalForString(jp.getValue("CROUTPriceDay"));
                        bc.Entity.CRDeposit         = ParseDecimalForString(jp.getValue("CRDeposit"));
                        bc.Entity.CRAddr            = jp.getValue("CRAddr");

                        bc.Entity.CRCreator    = user.Entity.UserName;
                        bc.Entity.CRCreateDate = GetDate();

                        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("CRNoS"), jp.getValue("CRNameS"), jp.getValue("CRAddrS"), jp.getValue("CRStatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Ejemplo n.º 7
0
        //protected string CRLOCNo1Str = "";
        //protected string CRLOCNo1StrS = "";

        private string createList(string CRNo, string CRName, string CRAddr, string CRStatus, 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='8%'>会议室编号</th>");
            sb.Append("<th width='12%'>会议室名称</th>");
            sb.Append("<th width='7%'>容纳人数</th>");
            sb.Append("<th width='7%'>对内价格/小时</th>");
            sb.Append("<th width='7%'>对内价格/半天</th>");
            sb.Append("<th width='7%'>对内价格/全天</th>");
            sb.Append("<th width='7%'>对外价格/小时</th>");
            sb.Append("<th width='7%'>对外价格/半天</th>");
            sb.Append("<th width='7%'>对外价格/全天</th>");
            sb.Append("<th width='7%'>押金</th>");
            sb.Append("<th width='6%'>状态</th>");
            sb.Append("<th width='6%'>是否禁用</th>");
            sb.Append("<th width='8%'>操作</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            int r = 1;

            sb.Append("<tbody>");
            Business.Base.BusinessConferenceRoom bc = new project.Business.Base.BusinessConferenceRoom();
            foreach (Entity.Base.EntityConferenceRoom it in bc.GetListQuery(CRNo, CRName, CRAddr, CRStatus, page, pageSize))
            {
                sb.Append("<tr class=\"text-c\" id=\"" + it.CRNo + "\">");
                sb.Append("<td style=\"text-align:center;\">" + r.ToString() + "</td>");
                sb.Append("<td>" + it.CRNo + "</td>");
                sb.Append("<td>" + it.CRName + "</td>");
                sb.Append("<td>" + it.CRCapacity + "</td>");
                sb.Append("<td>" + it.CRINPriceHour.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CRINPriceHalfDay.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CRINPriceDay.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CROUTPriceHour.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CROUTPriceHalfDay.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CROUTPriceDay.ToString("0.####") + "</td>");
                sb.Append("<td>" + it.CRDeposit.ToString("0.####") + "</td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.CRStatus == "use" ? "label-success" : "") + " radius\">" + it.CRStatusName + "</span></td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.CRISEnable == false ? "label-success" : "") + " radius\">" + (it.CRISEnable == false ? "正常" : "已禁用") + "</span></td>");
                if (it.CRStatus == "use")
                {
                    sb.Append("<td></td>");
                }
                else if (it.CRStatus == "free")
                {
                    sb.Append("<td><input class=\"btn btn-primary radius size-MINI\" style=\"padding:0px 10px; margin:0px;\" type=\"button\" value=\"预定\" onclick=\"reserve('" + it.CRNo + "')\" /></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.CRNo + "')\" /></td>");
                }
                sb.Append("</tr>");
                r++;
            }
            sb.Append("</tbody>");
            sb.Append("</table>");

            sb.Append(Paginat(bc.GetListCount(CRNo, CRName, CRAddr, CRStatus), pageSize, page, 7));

            return(sb.ToString());
        }