예제 #1
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                if (bc.Entity.AuditStatus != "0")
                {
                    flag = "3";
                }
                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("RMIDS"), jp.getValue("OldMeterNoS"), jp.getValue("NewMeterNoS"), jp.getValue("OldMeterTypeS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
예제 #2
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Op.BusinessChangeMeter bc = new project.Business.Op.BusinessChangeMeter();
                bc.load(jp.getValue("id"));
                if (bc.Entity.AuditStatus != "0")
                {
                    flag = "3";
                }
                else
                {
                    collection.Add(new JsonStringValue("RMID", bc.Entity.RMID));
                    collection.Add(new JsonStringValue("OldMeterNo", bc.Entity.OldMeterNo));
                    collection.Add(new JsonStringValue("OldMeterType", bc.Entity.OldMeterType));
                    collection.Add(new JsonStringValue("OldMeterLastReadout", bc.Entity.OldMeterLastReadout.ToString("0.####")));
                    collection.Add(new JsonStringValue("OldMeterReadout", bc.Entity.OldMeterReadout.ToString("0.####")));
                    collection.Add(new JsonStringValue("OldMeterReadings", bc.Entity.OldMeterReadings.ToString("0.####")));
                    collection.Add(new JsonStringValue("NewMeterNo", bc.Entity.NewMeterNo));
                    collection.Add(new JsonStringValue("NewMeterName", bc.Entity.NewMeterName));
                    collection.Add(new JsonStringValue("NewMeterSize", bc.Entity.NewMeterSize));
                    collection.Add(new JsonStringValue("NewMeterReadout", bc.Entity.NewMeterReadout.ToString("0.####")));
                    collection.Add(new JsonStringValue("NewMeterRate", bc.Entity.NewMeterRate.ToString("0.####")));
                    collection.Add(new JsonStringValue("NewMeterDigit", bc.Entity.NewMeterDigit.ToString("0.####")));
                    collection.Add(new JsonStringValue("CMOperator", bc.Entity.CMOperator));
                    collection.Add(new JsonStringValue("CMDate", ParseStringForDate(bc.Entity.CMDate)));
                }
            }
            catch
            { flag = "2"; }

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

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

            try
            {
                Business.Op.BusinessChangeMeter bc = new project.Business.Op.BusinessChangeMeter();
                bc.load(jp.getValue("id"));
                string InfoMsg = bc.audit(user.Entity.UserName);
                if (InfoMsg != "")
                {
                    flag = "3";
                    collection.Add(new JsonStringValue("InfoMsg", InfoMsg));
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "audit"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("RMIDS"), jp.getValue("OldMeterNoS"), jp.getValue("NewMeterNoS"), jp.getValue("OldMeterTypeS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }
예제 #4
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Op.BusinessChangeMeter bc = new project.Business.Op.BusinessChangeMeter();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    //bc.Entity.RMID = jp.getValue("RMID");
                    bc.Entity.OldMeterNo = jp.getValue("OldMeterNo");

                    string isOk = "1";
                    try
                    {
                        Business.Base.BusinessMeter bm = new Business.Base.BusinessMeter();
                        bm.load(jp.getValue("OldMeterNo"));
                        bc.Entity.RMID = bm.Entity.MeterRMID;
                    }
                    catch
                    {
                        isOk = "0";
                    }

                    if (isOk == "1")
                    {
                        DataTable dt = obj.PopulateDataSet("select cnt=COUNT(1) from Mstr_Meter where MeterNo='" + jp.getValue("NewMeterNo") + "'").Tables[0];
                        if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                        {
                            flag = "3"; //新表记编号已存在
                        }
                        else
                        {
                            bc.Entity.OldMeterLastReadout = ParseDecimalForString(jp.getValue("OldMeterLastReadout"));
                            bc.Entity.OldMeterReadout     = ParseDecimalForString(jp.getValue("OldMeterReadout"));
                            bc.Entity.OldMeterReadings    = ParseDecimalForString(jp.getValue("OldMeterReadings"));
                            bc.Entity.NewMeterNo          = jp.getValue("NewMeterNo");
                            bc.Entity.NewMeterName        = jp.getValue("NewMeterName");
                            bc.Entity.NewMeterSize        = jp.getValue("NewMeterSize");
                            bc.Entity.NewMeterReadout     = ParseDecimalForString(jp.getValue("NewMeterReadout"));
                            bc.Entity.NewMeterRate        = ParseDecimalForString(jp.getValue("NewMeterRate"));
                            bc.Entity.NewMeterDigit       = ParseIntForString(jp.getValue("NewMeterDigit"));
                            bc.Entity.CMOperator          = jp.getValue("CMOperator");
                            bc.Entity.CMDate = ParseDateForString(jp.getValue("CMDate"));
                            int r = bc.Save();

                            if (r <= 0)
                            {
                                flag = "2";
                            }
                        }
                    }
                    else
                    {
                        flag = "4";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(1) from Mstr_Meter where MeterNo='" + jp.getValue("NewMeterNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3"; //新表记编号已存在
                    }
                    else
                    {
                        DataTable dt1 = obj.PopulateDataSet("select MeterType from Mstr_Meter where MeterNo='" + jp.getValue("OldMeterNo") + "'").Tables[0];
                        if (dt1.Rows.Count == 0)
                        {
                            flag = "4"; //旧表记编号不存在
                        }
                        else
                        {
                            //bc.Entity.RMID = jp.getValue("RMID");
                            bc.Entity.OldMeterNo = jp.getValue("OldMeterNo");

                            Business.Base.BusinessMeter bm = new Business.Base.BusinessMeter();
                            bm.load(jp.getValue("OldMeterNo"));
                            bc.Entity.RMID = bm.Entity.MeterRMID;

                            bc.Entity.OldMeterType        = dt1.Rows[0]["MeterType"].ToString();
                            bc.Entity.OldMeterLastReadout = ParseDecimalForString(jp.getValue("OldMeterLastReadout"));
                            bc.Entity.OldMeterReadout     = ParseDecimalForString(jp.getValue("OldMeterReadout"));
                            bc.Entity.OldMeterReadings    = ParseDecimalForString(jp.getValue("OldMeterReadings"));
                            bc.Entity.NewMeterNo          = jp.getValue("NewMeterNo");
                            bc.Entity.NewMeterName        = jp.getValue("NewMeterName");
                            bc.Entity.NewMeterSize        = jp.getValue("NewMeterSize");
                            bc.Entity.NewMeterReadout     = ParseDecimalForString(jp.getValue("NewMeterReadout"));
                            bc.Entity.NewMeterRate        = ParseDecimalForString(jp.getValue("NewMeterRate"));
                            bc.Entity.NewMeterDigit       = ParseIntForString(jp.getValue("NewMeterDigit"));
                            bc.Entity.CMOperator          = jp.getValue("CMOperator");
                            bc.Entity.CMDate = ParseDateForString(jp.getValue("CMDate"));

                            bc.Entity.CMCreateDate = GetDate();
                            bc.Entity.CMCreator    = user.Entity.UserName;
                            int r = bc.Save();
                            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("RMIDS"), jp.getValue("OldMeterNoS"), jp.getValue("NewMeterNoS"), jp.getValue("OldMeterTypeS"), ParseIntForString(jp.getValue("page")))));
            return(collection.ToString());
        }