Пример #1
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessBillboard bc = new project.Business.Base.BusinessBillboard();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.BBName            = jp.getValue("BBName");
                    bc.Entity.BBSPNo            = jp.getValue("BBSPNo");
                    bc.Entity.BBLOCNo           = jp.getValue("BBLOCNo");
                    bc.Entity.BBAddr            = jp.getValue("BBAddr");
                    bc.Entity.BBSize            = jp.getValue("BBSize");
                    bc.Entity.BBType            = jp.getValue("BBType");
                    bc.Entity.BBINPriceDay      = ParseDecimalForString(jp.getValue("BBINPriceDay"));
                    bc.Entity.BBOUTPriceDay     = ParseDecimalForString(jp.getValue("BBOUTPriceDay"));
                    bc.Entity.BBINPriceMonth    = ParseDecimalForString(jp.getValue("BBINPriceMonth"));
                    bc.Entity.BBOUTPriceMonth   = ParseDecimalForString(jp.getValue("BBOUTPriceMonth"));
                    bc.Entity.BBINPriceQuarter  = ParseDecimalForString(jp.getValue("BBINPriceQuarter"));
                    bc.Entity.BBOUTPriceQuarter = ParseDecimalForString(jp.getValue("BBOUTPriceQuarter"));
                    bc.Entity.BBINPriceYear     = ParseDecimalForString(jp.getValue("BBINPriceYear"));
                    bc.Entity.BBOUTPriceYear    = ParseDecimalForString(jp.getValue("BBOUTPriceYear"));
                    bc.Entity.BBDeposit         = ParseDecimalForString(jp.getValue("BBDeposit"));
                    bc.Entity.BBImage           = jp.getValue("BBImage");
                    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_Billboard where BBNo='" + jp.getValue("BBNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.BBNo              = jp.getValue("BBNo");
                        bc.Entity.BBName            = jp.getValue("BBName");
                        bc.Entity.BBSPNo            = jp.getValue("BBSPNo");
                        bc.Entity.BBLOCNo           = jp.getValue("BBLOCNo");
                        bc.Entity.BBAddr            = jp.getValue("BBAddr");
                        bc.Entity.BBSize            = jp.getValue("BBSize");
                        bc.Entity.BBType            = jp.getValue("BBType");
                        bc.Entity.BBINPriceDay      = ParseDecimalForString(jp.getValue("BBINPriceDay"));
                        bc.Entity.BBOUTPriceDay     = ParseDecimalForString(jp.getValue("BBOUTPriceDay"));
                        bc.Entity.BBINPriceMonth    = ParseDecimalForString(jp.getValue("BBINPriceMonth"));
                        bc.Entity.BBOUTPriceMonth   = ParseDecimalForString(jp.getValue("BBOUTPriceMonth"));
                        bc.Entity.BBINPriceQuarter  = ParseDecimalForString(jp.getValue("BBINPriceQuarter"));
                        bc.Entity.BBOUTPriceQuarter = ParseDecimalForString(jp.getValue("BBOUTPriceQuarter"));
                        bc.Entity.BBINPriceYear     = ParseDecimalForString(jp.getValue("BBINPriceYear"));
                        bc.Entity.BBOUTPriceYear    = ParseDecimalForString(jp.getValue("BBOUTPriceYear"));
                        bc.Entity.BBDeposit         = ParseDecimalForString(jp.getValue("BBDeposit"));
                        bc.Entity.BBImage           = jp.getValue("BBImage");
                        bc.Entity.IsStatistics      = bool.Parse(jp.getValue("IsStatistics"));

                        bc.Entity.BBCreator    = user.Entity.UserName;
                        bc.Entity.BBCreateDate = 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("BBNoS"), jp.getValue("BBNameS"), jp.getValue("BBAddrS"), jp.getValue("BBStatusS"),
                                                                     jp.getValue("BBTypeS"), jp.getValue("BBSPNoS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString());
        }
Пример #2
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessBillboard bc = new project.Business.Base.BusinessBillboard();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.BBName            = jp.getValue("BBName");
                    bc.Entity.BBSPNo            = jp.getValue("BBSPNo");
                    bc.Entity.BBLOCNo           = jp.getValue("BBLOCNo");
                    bc.Entity.BBAddr            = jp.getValue("BBAddr");
                    bc.Entity.BBSize            = jp.getValue("BBSize");
                    bc.Entity.BBType            = jp.getValue("BBType");
                    bc.Entity.BBINPriceDay      = ParseDecimalForString(jp.getValue("BBINPriceDay"));
                    bc.Entity.BBOUTPriceDay     = ParseDecimalForString(jp.getValue("BBOUTPriceDay"));
                    bc.Entity.BBINPriceMonth    = ParseDecimalForString(jp.getValue("BBINPriceMonth"));
                    bc.Entity.BBOUTPriceMonth   = ParseDecimalForString(jp.getValue("BBOUTPriceMonth"));
                    bc.Entity.BBINPriceQuarter  = ParseDecimalForString(jp.getValue("BBINPriceQuarter"));
                    bc.Entity.BBOUTPriceQuarter = ParseDecimalForString(jp.getValue("BBOUTPriceQuarter"));
                    bc.Entity.BBINPriceYear     = ParseDecimalForString(jp.getValue("BBINPriceYear"));
                    bc.Entity.BBOUTPriceYear    = ParseDecimalForString(jp.getValue("BBOUTPriceYear"));
                    bc.Entity.BBDeposit         = ParseDecimalForString(jp.getValue("BBDeposit"));
                    bc.Entity.BBImage           = jp.getValue("BBImage");
                    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.AddOrUpdateBillboard(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_Billboard where BBNo='" + jp.getValue("BBNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.BBNo              = jp.getValue("BBNo");
                        bc.Entity.BBName            = jp.getValue("BBName");
                        bc.Entity.BBSPNo            = jp.getValue("BBSPNo");
                        bc.Entity.BBLOCNo           = jp.getValue("BBLOCNo");
                        bc.Entity.BBAddr            = jp.getValue("BBAddr");
                        bc.Entity.BBSize            = jp.getValue("BBSize");
                        bc.Entity.BBType            = jp.getValue("BBType");
                        bc.Entity.BBINPriceDay      = ParseDecimalForString(jp.getValue("BBINPriceDay"));
                        bc.Entity.BBOUTPriceDay     = ParseDecimalForString(jp.getValue("BBOUTPriceDay"));
                        bc.Entity.BBINPriceMonth    = ParseDecimalForString(jp.getValue("BBINPriceMonth"));
                        bc.Entity.BBOUTPriceMonth   = ParseDecimalForString(jp.getValue("BBOUTPriceMonth"));
                        bc.Entity.BBINPriceQuarter  = ParseDecimalForString(jp.getValue("BBINPriceQuarter"));
                        bc.Entity.BBOUTPriceQuarter = ParseDecimalForString(jp.getValue("BBOUTPriceQuarter"));
                        bc.Entity.BBINPriceYear     = ParseDecimalForString(jp.getValue("BBINPriceYear"));
                        bc.Entity.BBOUTPriceYear    = ParseDecimalForString(jp.getValue("BBOUTPriceYear"));
                        bc.Entity.BBDeposit         = ParseDecimalForString(jp.getValue("BBDeposit"));
                        bc.Entity.BBImage           = jp.getValue("BBImage");
                        bc.Entity.IsStatistics      = bool.Parse(jp.getValue("IsStatistics"));

                        bc.Entity.BBCreator    = user.Entity.UserName;
                        bc.Entity.BBCreateDate = 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.AddOrUpdateBillboard(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("BBNoS"), jp.getValue("BBNameS"), jp.getValue("BBAddrS"), jp.getValue("BBStatusS"),
                                                                     jp.getValue("BBTypeS"), jp.getValue("BBSPNoS"), ParseIntForString(jp.getValue("page"))))); return(collection.ToString());
        }