Esempio n. 1
0
        private string validaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessMeterReader bc = new project.Business.Base.BusinessMeterReader();
                bc.load(jp.getValue("id"));
                if (bc.Entity.Status == "open")
                {
                    bc.Entity.Status = "close";
                }
                else
                {
                    bc.Entity.Status = "open";
                }

                int r = bc.Save("update");
                if (r <= 0)
                {
                    flag = "2";
                }

                if (bc.Entity.Status == "close")
                {
                    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("ReaderNoS"), jp.getValue("ReaderNameS"), jp.getValue("StatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Esempio n. 2
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                collection.Add(new JsonStringValue("ReaderNo", bc.Entity.ReaderNo));
                collection.Add(new JsonStringValue("ReaderName", bc.Entity.ReaderName));
            }
            catch
            { flag = "2"; }

            collection.Add(new JsonStringValue("type", "update"));
            collection.Add(new JsonStringValue("flag", flag));

            return(collection.ToString());
        }
Esempio n. 3
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessMeterReader bc = new project.Business.Base.BusinessMeterReader();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.ReaderName = jp.getValue("ReaderName");
                    int r = bc.Save("update");
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    bc.Entity.ReaderNo   = jp.getValue("ReaderNo");
                    bc.Entity.ReaderName = jp.getValue("ReaderName");
                    bc.Entity.Status     = "open";
                    bc.Entity.CreateUser = user.Entity.UserName;
                    bc.Entity.CreateDate = 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("ReaderNoS"), jp.getValue("ReaderNameS"), jp.getValue("StatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Esempio n. 4
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessMeterReader bc = new project.Business.Base.BusinessMeterReader();
                bc.load(jp.getValue("id"));
                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("ReaderNoS"), jp.getValue("ReaderNameS"), jp.getValue("StatusS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
Esempio n. 5
0
        private string createList(string ReaderNo, string ReaderName, string Status, 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='20%'>抄表人编号</th>");
            sb.Append("<th width='40%'>抄表人姓名</th>");
            sb.Append("<th width='15%'>状态</th>");
            sb.Append("<th width='20%'>创建日期</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            int r = 1;

            sb.Append("<tbody>");
            Business.Base.BusinessMeterReader bc = new project.Business.Base.BusinessMeterReader();
            foreach (Entity.Base.EntityMeterReader it in bc.GetListQuery(ReaderNo, ReaderName, Status, page, pageSize))
            {
                sb.Append("<tr class=\"text-c\" id=\"" + it.ReaderNo + "\">");
                sb.Append("<td>" + r.ToString() + "</td>");
                sb.Append("<td>" + it.ReaderNo + "</td>");
                sb.Append("<td>" + it.ReaderName + "</td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.Status == "open" ? "label-success" : "") + " radius\">" + it.StatusName + "</span></td>");
                sb.Append("<td>" + ParseStringForDate(it.CreateDate) + "</td>");
                sb.Append("</tr>");
                r++;
            }
            sb.Append("</tbody>");
            sb.Append("</table>");

            sb.Append(Paginat(bc.GetListCount(ReaderNo, ReaderName, Status), pageSize, page, 7));

            return(sb.ToString());
        }
Esempio n. 6
0
        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/ChangeMeter.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/Op/ChangeMeter.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\">&#xe600;</i> 添加</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("update") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe60c;</i> 修改</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("delete") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\">&#xe6e2;</i> 删除</a>&nbsp;&nbsp;";
                                }
                                if (rightCode.IndexOf("approve") >= 0)
                                {
                                    Buttons += "<a href=\"javascript:;\" onclick=\"audit()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe615;</i> 审核</a>&nbsp;&nbsp;";
                                }
                            }
                        }
                        else
                        {
                            Buttons += "<a href=\"javascript:;\" onclick=\"insert()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe600;</i> 添加</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"update()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe60c;</i> 修改</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"del()\" class=\"btn btn-danger radius\"><i class=\"Hui-iconfont\">&#xe6e2;</i> 删除</a>&nbsp;&nbsp;";
                            Buttons += "<a href=\"javascript:;\" onclick=\"audit()\" class=\"btn btn-primary radius\"><i class=\"Hui-iconfont\">&#xe615;</i> 审核</a>&nbsp;&nbsp;";
                        }

                        list = createList(string.Empty, string.Empty, string.Empty, string.Empty, 1);
                        date = GetDate().ToString("yyyy-MM-dd");

                        CMOperatorStr  = "<select class=\"input-text required\" id=\"CMOperator\" data-valid=\"isNonEmpty\" data-error=\"抄表人不能为空\">";
                        CMOperatorStr += "<option value=\"\" selected></option>";
                        Business.Base.BusinessMeterReader bc1 = new project.Business.Base.BusinessMeterReader();
                        foreach (Entity.Base.EntityMeterReader it in bc1.GetListQuery(string.Empty, string.Empty, "open"))
                        {
                            CMOperatorStr += "<option value='" + it.ReaderNo + "'>" + it.ReaderName + "</option>";
                        }
                        CMOperatorStr += "</select>";
                    }
                }
                else
                {
                    Response.Write(errorpage);
                    return;
                }
            }
            catch
            {
                Response.Write(errorpage);
                return;
            }
        }