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 validaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                int r = bc.valid();
                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
                }
                if (bc.Entity.RMISEnable)
                {
                    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("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());
        }
Beispiel #5
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());
        }
Beispiel #6
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());
        }
        private string refundsubmitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                DateTime leaveDate = Convert.ToDateTime(jp.getValue("RefundDate"));
                Business.Op.BusinessContract bc = new Business.Op.BusinessContract();
                bc.load(jp.getValue("id"));
                if (bc.Entity.ContractStartDate >= leaveDate)
                {
                    flag = "2";
                }
                else if (bc.Entity.ContractStatus != "2")
                {
                    flag = "3";
                }
                else
                {
                    string infoMsg = bc.ConfirmLeaveWithNoFee(leaveDate);
                    if (infoMsg != "")
                    {
                        collection.Add(new JsonStringValue("InfoBar", infoMsg));
                        flag = "4";
                    }
                    else
                    {
                        collection.Add(new JsonStringValue("liststr", createList(jp.getValue("ContractNoS"), jp.getValue("ContractNoManualS"), jp.getValue("ContractTypeS"),
                                                                                 jp.getValue("ContractSPNoS"), jp.getValue("ContractCustNoS"), jp.getValue("MinContractSignedDate"), jp.getValue("MaxContractSignedDate"),
                                                                                 jp.getValue("MinContractEndDate"), jp.getValue("MaxContractEndDate"), jp.getValue("OffLeaseStatusS"), jp.getValue("MinOffLeaseActulDate"),
                                                                                 jp.getValue("MaxOffLeaseActulDate"), ParseIntForString(jp.getValue("page")))));


                        #region  步到管家
                        try
                        {
                            string status = string.Empty;
                            string date   = string.Empty;
                            bc.CheckCustStatus(out status, out date);
                            ButlerSrv.AppService appService = new ButlerSrv.AppService {
                                Timeout = 5000
                            };
                            appService.UpdateCustomer(bc.Entity.ContractCustNo, status, date);
                        }
                        catch (Exception ex)
                        {
                            collection.Add(new JsonStringValue("syncButlerException", ex.ToString()));
                        }
                        #endregion

                        #region  步到资源系统
                        string syncResult = string.Empty;
                        try
                        {
                            ResourceService.ResourceService srv = new ResourceService.ResourceService
                            {
                                Timeout = 5000,
                                Url     = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString()
                            };
                            string Items = "";
                            Business.Base.BusinessCustomer cust = new Business.Base.BusinessCustomer();
                            cust.load(bc.Entity.ContractCustNo);
                            var dt = obj.PopulateDataSet("SELECT WPNo FROM Op_ContractWPRentalDetail WHERE RefRP='" + bc.Entity.RowPointer + "' GROUP BY WPNo").Tables[0];
                            foreach (DataRow dr in dt.Rows)
                            {
                                SycnResourceStatus rs = new SycnResourceStatus();
                                rs.SysID         = 1; //1.订单
                                rs.ResourceID    = dr["WPNo"].ToString();
                                rs.BusinessID    = bc.Entity.RowPointer;
                                rs.BusinessNo    = bc.Entity.ContractNo;
                                rs.BusinessType  = 1;//1租赁,2物业
                                rs.RentBeginTime = bc.Entity.FeeStartDate;
                                rs.RentEndTime   = leaveDate;
                                rs.Status        = 2;
                                rs.RentType      = 1;
                                rs.UpdateTime    = GetDate();
                                rs.UpdateUser    = user.Entity.UserName;
                                Items           += (Items == "" ? "" : ",") + JsonConvert.SerializeObject(rs);
                            }
                            syncResult = srv.LeaseOut("[" + Items + "]");
                        }
                        catch (Exception ex)
                        {
                            syncResult = ex.ToString();
                        }
                        collection.Add(new JsonStringValue("sync", syncResult));
                        #endregion
                    }
                }
            }
            catch { }

            collection.Add(new JsonStringValue("type", "refundsubmit"));
            collection.Add(new JsonStringValue("flag", flag));
            return(collection.ToString());
        }
Beispiel #8
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());
        }