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

            try
            {
                Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.RMLOCNo1         = jp.getValue("RMLOCNo1");
                    bc.Entity.RMLOCNo2         = jp.getValue("RMLOCNo2");
                    bc.Entity.RMLOCNo3         = jp.getValue("RMLOCNo3");
                    bc.Entity.RMLOCNo4         = jp.getValue("RMLOCNo4");
                    bc.Entity.RMRentType       = jp.getValue("RMRentType");
                    bc.Entity.IsStatistics     = bool.Parse(jp.getValue("IsStatistics"));
                    bc.Entity.RMBuildSize      = ParseDecimalForString(jp.getValue("RMBuildSize"));
                    bc.Entity.RMRentSize       = ParseDecimalForString(jp.getValue("RMRentSize"));
                    bc.Entity.RMAddr           = jp.getValue("RMAddr");
                    bc.Entity.RMRemark         = jp.getValue("RMRemark");
                    bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition"));

                    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_Room where RMID='" + jp.getValue("RMID") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.RMID             = jp.getValue("RMID");
                        bc.Entity.RMNo             = jp.getValue("RMNo");
                        bc.Entity.RMLOCNo1         = jp.getValue("RMLOCNo1");
                        bc.Entity.RMLOCNo2         = jp.getValue("RMLOCNo2");
                        bc.Entity.RMLOCNo3         = jp.getValue("RMLOCNo3");
                        bc.Entity.RMLOCNo4         = jp.getValue("RMLOCNo4");
                        bc.Entity.RMRentType       = jp.getValue("RMRentType");
                        bc.Entity.IsStatistics     = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.RMBuildSize      = ParseDecimalForString(jp.getValue("RMBuildSize"));
                        bc.Entity.RMRentSize       = ParseDecimalForString(jp.getValue("RMRentSize"));
                        bc.Entity.RMAddr           = jp.getValue("RMAddr");
                        bc.Entity.RMRemark         = jp.getValue("RMRemark");
                        bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition"));

                        bc.Entity.RMCreator    = user.Entity.UserName;
                        bc.Entity.RMCreateDate = 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("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"),
                                                                     jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page")))));

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

            try
            {
                Business.Base.BusinessRoom bc = new project.Business.Base.BusinessRoom();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.RMLOCNo1         = jp.getValue("RMLOCNo1");
                    bc.Entity.RMLOCNo2         = jp.getValue("RMLOCNo2");
                    bc.Entity.RMLOCNo3         = jp.getValue("RMLOCNo3");
                    bc.Entity.RMLOCNo4         = jp.getValue("RMLOCNo4");
                    bc.Entity.RMRentType       = jp.getValue("RMRentType");
                    bc.Entity.IsStatistics     = bool.Parse(jp.getValue("IsStatistics"));
                    bc.Entity.RMBuildSize      = ParseDecimalForString(jp.getValue("RMBuildSize"));
                    bc.Entity.RMRentSize       = ParseDecimalForString(jp.getValue("RMRentSize"));
                    bc.Entity.RMAddr           = jp.getValue("RMAddr");
                    bc.Entity.RMRemark         = jp.getValue("RMRemark");
                    bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition"));

                    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.AddOrUpdateRoom(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_Room where RMID='" + jp.getValue("RMID") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.RMID             = jp.getValue("RMID");
                        bc.Entity.RMNo             = jp.getValue("RMNo");
                        bc.Entity.RMLOCNo1         = jp.getValue("RMLOCNo1");
                        bc.Entity.RMLOCNo2         = jp.getValue("RMLOCNo2");
                        bc.Entity.RMLOCNo3         = jp.getValue("RMLOCNo3");
                        bc.Entity.RMLOCNo4         = jp.getValue("RMLOCNo4");
                        bc.Entity.RMRentType       = jp.getValue("RMRentType");
                        bc.Entity.IsStatistics     = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.RMBuildSize      = ParseDecimalForString(jp.getValue("RMBuildSize"));
                        bc.Entity.RMRentSize       = ParseDecimalForString(jp.getValue("RMRentSize"));
                        bc.Entity.RMAddr           = jp.getValue("RMAddr");
                        bc.Entity.RMRemark         = jp.getValue("RMRemark");
                        bc.Entity.HaveAirCondition = bool.Parse(jp.getValue("HaveAirCondition"));

                        bc.Entity.RMCreator    = user.Entity.UserName;
                        bc.Entity.RMCreateDate = 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.AddOrUpdateRoom(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("RMIDS"), jp.getValue("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"),
                                                                     jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }