Beispiel #1
0
        /// <summary>
        /// 房间资源同步
        /// </summary>
        /// <param name="model">au=>add or update(添加或修改);del=>删除</param>
        /// <returns></returns>
        public string SyncResource(string model)
        {
            string result = string.Empty;

            if (ConfigurationManager.AppSettings["IsPutZY"].ToString().Equals("Y"))
            {
                try
                {
                    ResourceService.ResourceService srv = new ResourceService.ResourceService
                    {
                        Timeout = 5000,
                        Url     = ConfigurationManager.AppSettings["ResourceUrl"].ToString()
                    };
                    if (model.Equals("au"))
                    {
                        result = srv.AddOrUpdateRoom(JsonConvert.SerializeObject(Entity));
                    }
                    else
                    {
                        result = srv.DeleteResource(Entity.RMID);
                    }
                }
                catch (Exception ex)
                {
                    result = ex.ToString();
                }
            }
            else
            {
                result = "已配置不同步";
            }
            return(result);
        }
Beispiel #2
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                //if (obj.PopulateDataSet("select 1 from Mstr_WorkPlace where WPNo='" + bc.Entity.WPNo + "'").Tables[0].Rows.Count > 0)
                //{
                //    flag = "3";
                //}
                //else
                //{
                if (bc.Entity.WPStatus == "use")
                {
                    flag = "4";
                }
                else
                {
                    int r = bc.delete();
                    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.DeleteResource(bc.Entity.WPNo);
                        }
                        catch (Exception ex)
                        {
                            syncResult = ex.ToString();
                        }
                        collection.Add(new JsonStringValue("sync", syncResult));

                        #endregion
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "delete"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

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

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

                if (obj.PopulateDataSet("select 1 from Op_ContractBBRentalDetail where BBNo='" + bc.Entity.BBNo + "'").Tables[0].Rows.Count > 0)
                {
                    flag = "3";
                }
                else
                {
                    if (bc.Entity.BBStatus == "use")
                    {
                        flag = "4";
                    }
                    else
                    {
                        int r = bc.delete();
                        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.DeleteResource(bc.Entity.BBNo);
                            }
                            catch (Exception ex)
                            {
                                syncResult = ex.ToString();
                            }
                            collection.Add(new JsonStringValue("sync", syncResult));

                            #endregion
                        }
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "delete"));
            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());
        }
Beispiel #4
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                if (bc.Entity.RMStatus == "use")
                {
                    flag = "4";
                }
                else
                {
                    int r = bc.delete();
                    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.DeleteResource(bc.Entity.RMID);
                        }
                        catch (Exception ex)
                        {
                            syncResult = ex.ToString();
                        }
                        collection.Add(new JsonStringValue("sync", syncResult));

                        #endregion
                    }
                }
            }
            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("RMLOCNo1S"), jp.getValue("RMLOCNo2S"), jp.getValue("RMLOCNo3S"),
                                                                     jp.getValue("RMLOCNo4S"), jp.getValue("CustNoS"), jp.getValue("RMStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }