コード例 #1
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());
        }
コード例 #2
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());
        }