示例#1
0
        public void UpdateRent(RentInfo rentInfo)
        {
            StringBuilder strSql = new StringBuilder();

            if (IsExistsRentNo(rentInfo.RentNo))
            {
                //Update
                strSql.Append("Update Rent_Rent set ");
                strSql.Append(" RDName='" + rentInfo.RDName + "',RSName='" + rentInfo.RSName + "',RRName='" + rentInfo.RRName + "',");
                strSql.Append(" RPSParentName = '" + rentInfo.RPSParentName + "', RPSName = '" + rentInfo.RPSName + "',RAddress='" + rentInfo.RAddress + "',RDoor='" + rentInfo.RDoor + "',");
                strSql.Append(" RTotalDoor='" + rentInfo.RTotalDoor + "',RRoomType='" + rentInfo.RRoomType + "',RDirection='" + rentInfo.RDirection + "',");
                strSql.Append(" RStructure='" + rentInfo.RStructure + "',RBuildingType='" + rentInfo.RBuildingType + "',RFloor='" + rentInfo.RFloor + "', ");
                strSql.Append(" RTotalFloor='" + rentInfo.RTotalFloor + "', RHouseAge='" + rentInfo.RHouseAge + "',RProperty='" + rentInfo.RProperty + "', ");
                strSql.Append(" RRentArea='" + rentInfo.RRentArea + "' ,RBuildArea='" + rentInfo.RBuildArea + "', ROwner='" + rentInfo.ROwner + "',");
                strSql.Append(" ROwnerTel='" + rentInfo.ROwnerTel + "' ,RIDCard='" + rentInfo.RIDCard + "', RLocationDescription='" + rentInfo.RLocationDescription + "',");
                strSql.Append(" RMapID='" + rentInfo.RMapID + "' ,RPSID='" + rentInfo.RPSID + "',");
                strSql.Append(" RModifiedBy='" + rentInfo.RModifiedBy + "',");
                strSql.Append(" RModifiedDate='" + rentInfo.RModifiedDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "',RRentType='" + rentInfo.RentType + "',ROwnType='" + rentInfo.OwnType + "'");
                strSql.Append(" where RentNo = '" + rentInfo.RentNo + "'");
                SysLogHelper.AddLog(rentInfo.RModifiedBy, "修改房源信息ID:" + rentInfo.RentNo, "修改-房源信息");
            }
            else
            {
                //Insert
                strSql.Append("Insert into Rent_Rent ([RentNO],[RDName],[RSName],[RRName]," +
                              "[RPSName],[RAddress],[RDoor],[RTotalDoor]," +
                              "[RRoomType],[RDirection],[RStructure],[RBuildingType]," +
                              "[RFloor] ,[RTotalFloor],[RHouseAge] ,[RProperty]," +
                              "[RRentArea],[RBuildArea],[ROwner],[ROwnerTel]," +
                              "[RIDCard],[RLocationDescription],[RMapID],[RPSID]," +
                              "[RCreatedBy],[RCreatedDate],[RModifiedBy]," +
                              "[RModifiedDate],[RPSParentName],[RRentType],[ROwntype],[IsAvailable],[IsObsoleted],[RentNumber]) values (");
                strSql.Append("'" + rentInfo.RentNo + "','" + rentInfo.RDName + "','" + rentInfo.RSName + "','" + rentInfo.RRName + "',");
                strSql.Append("'" + rentInfo.RPSName + "','" + rentInfo.RAddress + "','" + rentInfo.RDoor + "','" + rentInfo.RTotalDoor + "',");
                strSql.Append("'" + rentInfo.RRoomType + "','" + rentInfo.RDirection + "','" + rentInfo.RStructure + "','" + rentInfo.RBuildingType + "',");
                strSql.Append("'" + rentInfo.RFloor + "','" + rentInfo.RTotalFloor + "','" + rentInfo.RHouseAge + "','" + rentInfo.RProperty + "',");
                strSql.Append("'" + rentInfo.RRentArea + "','" + rentInfo.RBuildArea + "','" + rentInfo.ROwner + "','" + rentInfo.ROwnerTel + "',");
                strSql.Append("'" + rentInfo.RIDCard + "','" + rentInfo.RLocationDescription + "','" + rentInfo.RMapID + "','" + rentInfo.RPSID + "',");
                strSql.Append("'" + rentInfo.RCreatedBy + "','" + rentInfo.RCreatedDate.ToString("yyyy-MM-dd hh:mm:ss") + "','" + rentInfo.RCreatedBy + "',");
                strSql.Append("'" + rentInfo.RCreatedDate.ToString("yyyy-MM-dd hh:mm:ss") + "','" + rentInfo.RPSParentName + "','" + rentInfo.RentType + "','" + rentInfo.OwnType + "','" + rentInfo.IsAvailable + "','" + rentInfo.IsObsoleted + "','0'");
                strSql.Append(")");
                UpdateRentExternal(rentInfo);
                SysLogHelper.AddLog(rentInfo.RCreatedBy, "添加房源信息ID:" + rentInfo.RentNo, "添加-房源信息");
            }
            MySQLHelper.ExecuteNonQuery(SqlConnString, MySQLHelper.CreateCommand(strSql.ToString()));
            if (!string.IsNullOrEmpty(rentInfo.Longitude) && !string.IsNullOrEmpty(rentInfo.Latitude))
            {
                StringBuilder strSql1 = new StringBuilder();
                if (IsExistsMapInfo(rentInfo.RentNo))
                {
                    strSql1.Append("Update Rent_Map set Longitude='" + rentInfo.Longitude + "', Latitude='" + rentInfo.Latitude + "' where RentNO='" + rentInfo.RentNo + "'");
                }
                else
                {
                    strSql1.Append("Insert into Rent_Map values('" + rentInfo.RentNo + "', '" + rentInfo.Longitude + "', '" + rentInfo.Latitude + "')");
                }

                MySQLHelper.ExecuteNonQuery(SqlConnString, MySQLHelper.CreateCommand(strSql1.ToString()));
            }
        }
示例#2
0
        public void UploadPersonInfo(RentAttribute info)
        {
            //type: 0-出租屋,1-印章系统
            RentInfo rent = new RentInfo(info.RentNo);

            string sql = "insert into T_Person_Info values ('" + Guid.NewGuid().ToString() + "','" + info.RRAID.ToString() + "','" + info.RRAContactName + "','" + info.RRAIDCard + "','0','" + DateTime.Now.ToString() + "','0','','RZF','" + rent.RAddress + "','" + rent.RPSName + "','" + rent.RPSName + "','0','','')";

            MySQLHelper.ExecuteNonQuery(MySQLHelper.DataSynConnectionString, MySQLHelper.CreateCommand(sql));
        }
示例#3
0
        public string AddRentAttribute(RentAttribute rentAttribute)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();

            //strSql1.Append(" Update Rent_Rent set IsAvailable=1");
            //strSql1.Append(" where RentNo = '" + rentAttribute.RentNo + "'");

            //Update
            strSql.Append("INSERT INTO Rent_RentAttribute ([RentNo],[RRAContactName],[RRAContactTel],[RRANationName],[RRAIDCard]," +
                          "[RRentPrice],[RRAContactProvince],[RRAStartDate],[RRAEndDate],[RRARealEndDate],[RRACheckOutPerson],[RRACheckOutReason],[RRADescription],[RRACreatedBy]," +
                          "[RRACreatedDate],[RRAModifiedBy],[RRAModifiedDate],[RRAIsActive],[RRAStatus],[AppId],[Body],[MchId],[TradeNO],[TotalFee],[PrepayID]) values (");
            strSql.Append(" '" + rentAttribute.RentNo + "',");
            strSql.Append(" '" + rentAttribute.RRAContactName + "',");
            strSql.Append(" '" + rentAttribute.RRAContactTel + "',");
            strSql.Append(" '" + rentAttribute.RRANationName + "',");
            strSql.Append(" '" + rentAttribute.RRAIDCard + "',");
            strSql.Append(" '" + rentAttribute.RRentPrice + "', ");
            strSql.Append(" '" + rentAttribute.RRAContactProvince + "' ,");
            strSql.Append(" '" + rentAttribute.RRAStartDate + "','" + rentAttribute.RRAEndDate + "',null,'','',");
            strSql.Append(" '" + rentAttribute.RRADescription + "',");
            strSql.Append(" '" + rentAttribute.RRACreatedBy + "',");
            strSql.Append(" '" + rentAttribute.RRACreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "', ");
            strSql.Append("'" + rentAttribute.RRACreatedBy + "','" + rentAttribute.RRACreatedDate.ToString("yyyy-MM-dd HH:mm:ss") + "', 0 ,'" + rentAttribute.Status + "','','','','',0,''");
            strSql.Append(" )");
            strSql.Append(" select @@identity");


            List <SqlCommand> listSQL = new List <SqlCommand>();

            listSQL.Add(MySQLHelper.CreateCommand(strSql.ToString()));

            DataSet ds = MySQLHelper.ExecuteDataset(SqlConnString, MySQLHelper.CreateCommand(strSql.ToString()));


            string    sql = "select top 1 * from Rent_RentAttribute where RentNo = '" + rentAttribute.RentNo + "' order by RRAID desc";
            DataTable dt2 = MySQLHelper.ExecuteDataset(SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            SMS.CommonServices service    = new SMS.CommonServices();
            string             approveMsg = ConfigurationManager.AppSettings["ApproveMessage"].ToString();
            RentInfo           info       = new RentInfo(rentAttribute.RentNo);

            service.SendMsg(info.ROwnerTel, approveMsg);

            CFUserInfo  userInfo = new CFUserInfo(info.RIDCard, false);
            LockManager manager  = new LockManager();

            manager.SendMessageToDevice(userInfo.DeviceID, approveMsg, dt2.Rows[0]["RRAID"].ToString(), userInfo.IDCard);

            SysLogHelper.AddLog(rentAttribute.RRACreatedBy, "增加租赁信息ID:" + rentAttribute.RentNo, "增加-租赁信息");

            return(dt2.Rows[0]["RRAID"].ToString());
        }
示例#4
0
        public void UpdateRentExternal(RentInfo rentInfo, bool isService)
        {
            string    sql = "select * from Rent_External where rent_No='" + rentInfo.RentNo + "'";
            DataTable dt  = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            if (dt.Rows.Count > 0)
            {
                sql = "update Rent_External set HZHouseID='" + rentInfo.RHouseID.ToString() + "',HZRentID='" + rentInfo.RRentID + "',HZUploadDate='" + DateTime.Now.ToString() + "',RentRealOwner='" + rentInfo.RRealOwner + "',RentRealOwnerID='" + rentInfo.RRealIDCard + "',RentRealOwnerPhone='" + rentInfo.RRealOwnerTel + "' where rent_No='" + rentInfo.RentNo + "'";
            }
            else
            {
                sql = "insert into Rent_External values ('" + rentInfo.RentNo + "','','" + rentInfo.RHouseID + "','" + rentInfo.RRentID + "','" + DateTime.Now.ToString() + "','" + rentInfo.ROwner + "','" + rentInfo.RIDCard + "','" + rentInfo.ROwnerTel + "')";
            }
            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
        }
示例#5
0
        public void UpdateRentExternal(RentInfo rentInfo)
        {
            string    sql = "select * from Rent_External where rent_No='" + rentInfo.RentNo + "'";
            DataTable dt  = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            if (dt.Rows.Count > 0)
            {
                sql = "insert into Rent_External values ('" + rentInfo.RentNo + "','','" + rentInfo.RHouseID + "','" + rentInfo.RRentID + "','" + DateTime.Now.ToString() + "','" + rentInfo.ROwner + "','" + rentInfo.RIDCard + "','" + rentInfo.ROwnerTel + "')";
            }
            else
            {
                sql = "insert into Rent_External values ('" + rentInfo.RentNo + "','','','',null,'" + rentInfo.ROwner + "','" + rentInfo.RIDCard + "','" + rentInfo.ROwnerTel + "')";
            }
            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
        }
示例#6
0
        public string UploadRentInfoToHZ(RentInfo info, RentAttribute attInfo)
        {
            // 准备代理人(二房东)信息相关参数
            Dictionary <string, string> landLord = new Dictionary <string, string>();

            landLord.Add("PRINCIPALNAME", info.ROwner);
            landLord.Add("IDENTITYID", info.RIDCard);
            landLord.Add("LINKMOBILE", info.ROwnerTel);
            landLord.Add("DAYRENTADDRESS", info.RAddress);
            landLord.Add("DEPARTMENTOFREGISTER", info.RPSParentName);
            landLord.Add("LOCALPOLICESTATION", info.RPSName);
            landLord.Add("LOCALBRANCH", info.RPSParentName);


            //rent.Add("rentName", info.ROwner);
            //rent.Add("rentIdentityID", info.RIDCard);
            //rent.Add("rentTel", info.ROwnerTel);


            // 准备房屋信息相关参数
            Dictionary <string, string> roomInfo = new Dictionary <string, string>();

            roomInfo.Add("HOUSENUMBER", "110");
            roomInfo.Add("LANDLORDNAME", info.RRealOwner);
            roomInfo.Add("LANDLORDIDENTITYID", info.RRealIDCard);
            roomInfo.Add("LANDLORDLINKTEL", info.RRealOwnerTel);


            #region
            //原文件对照表
            //houseInfo.Add("holderName", info.RRealOwner);
            //houseInfo.Add("holderIdentityID", info.RRealIDCard);
            //houseInfo.Add("holderTel", info.RRealOwnerTel);
            //houseInfo.Add("departmentOfRegister", info.RPSParentName);
            //houseInfo.Add("localPoliceStation", info.RPSName);
            //houseInfo.Add("localBranch", info.RPSParentName);


            //string building = string.Empty;
            //string address = string.Empty;
            //string tempAddr = info.RAddress;
            //int temNum = 0;
            //for (int i = 0; i < tempAddr.Length; i++)
            //{
            //    if (int.TryParse(tempAddr.Substring(i, 1), out temNum))
            //    {
            //        building = tempAddr.Substring(0, i);
            //        address = tempAddr.Substring(i);
            //        break;
            //    }
            //}

            //houseInfo.Add("building", building);
            //houseInfo.Add("address", address);
            #endregion


            // 准备住客相关参数
            Dictionary <string, string> tenantRenter = new Dictionary <string, string>();
            tenantRenter.Add("ID", string.IsNullOrEmpty(attInfo.TenantID) ? "" : attInfo.TenantID);
            tenantRenter.Add("TENANTRENTERNAME", attInfo.RRAContactName);
            tenantRenter.Add("IDENTITYID", attInfo.RRAIDCard);
            tenantRenter.Add("TENANTRENTERPHONE", attInfo.RRAContactTel);
            string sex = "1";
            if (attInfo.RRAIDCard.Length == 18)
            {
                sex = attInfo.RRAIDCard.Substring(14, 3);
            }
            if (attInfo.RRAIDCard.Length == 15)
            {
                sex = attInfo.RRAIDCard.Substring(12, 3);
            }
            if (int.Parse(sex) % 2 == 0)
            {
                tenantRenter.Add("SEX", "女");
            }
            else
            {
                tenantRenter.Add("SEX", "男");
            }

            tenantRenter.Add("NATION", "");
            tenantRenter.Add("HOUSEADDRESS", "");
            //tenantRenter.Add("isLongValidDate", "0");
            tenantRenter.Add("STARTVALIDDATE", "");
            tenantRenter.Add("ENDVALIDDATE", "");
            tenantRenter.Add("ISFOREIGNER", "否");
            tenantRenter.Add("NATIONALITY", "中国");
            tenantRenter.Add("STARTRENTDATE", attInfo.RRAStartDate.ToString("yyyy/MM/dd"));

            if (attInfo.RRARealEndDate.HasValue)
            {
                tenantRenter.Add("ENDRENTDATE", attInfo.RRARealEndDate.Value.ToString("yyyy/MM/dd"));
            }
            else
            {
                tenantRenter.Add("ENDRENTDATE", attInfo.RRAEndDate.ToString("yyyy/MM/dd"));
            }
            tenantRenter.Add("IDENTITYPIC", "");
            tenantRenter.Add("CHECKINROOMHOUSE", "110");

            #region
            //原 准备住客相关参数 对照表
            //Dictionary<string, string> tenant = new Dictionary<string, string>();
            //tenant.Add("id", string.IsNullOrEmpty(attInfo.TenantID) ? "" : attInfo.TenantID);
            //tenant.Add("tenantName", attInfo.RRAContactName);
            //tenant.Add("tenantIdentityID", attInfo.RRAIDCard);
            //tenant.Add("tenantTel", attInfo.RRAContactTel);
            //string sex = "1";
            //if (attInfo.RRAIDCard.Length == 18)
            //{
            //    sex = attInfo.RRAIDCard.Substring(14, 3);
            //}
            //if (attInfo.RRAIDCard.Length == 15)
            //{
            //    sex = attInfo.RRAIDCard.Substring(12, 3);
            //}
            //if (int.Parse(sex) % 2 == 0)
            //{
            //    tenant.Add("tenantSex", "女");
            //}
            //else
            //{
            //    tenant.Add("tenantSex", "男");
            //}

            //tenant.Add("tenantNation", "暂无");
            //tenant.Add("tenantAddress", info.RAddress);
            //tenant.Add("isLongValidDate", "0");
            //tenant.Add("startValidDate", attInfo.RRAStartDate.ToString("yyyy/MM/dd"));
            //tenant.Add("endValidDate", attInfo.RRAEndDate.ToString("yyyy/MM/dd"));
            //tenant.Add("isForeigner", "0");
            //tenant.Add("nationality", "中国");
            //tenant.Add("startRentDate", attInfo.RRAStartDate.ToString("yyyy/MM/dd"));
            //if (attInfo.RRARealEndDate.HasValue)
            //    tenant.Add("endRentDate", attInfo.RRARealEndDate.Value.ToString("yyyy/MM/dd"));
            //else
            //    tenant.Add("endRentDate", attInfo.RRAEndDate.ToString("yyyy/MM/dd"));
            #endregion

            // 准备访问url
            string url = "http://221.196.148.107:8081/dailyrentconsole/outservice/hzxxadddailydata";
            //string url = "http://117.9.114.110:8081/dailyrentconsole/outservice/hzxxadddailydata";


            //string url = ConfigurationManager.AppSettings["HZDataService"];

            //{"landLordId":"402881c265338a290165353fe1c80000","roomInfoId":"402881c265338a290165353fe1cc0001","tenantRenterId":"402881c265338a290165353fe1ce0002","result":"success"}
            //{"rentID":"402881a65f5c6974015f5c79a4250000","houseID":"402881a65f5c6974015f5c79a42a0001","tenantID":"402881a65f5c6974015f5c79a42b0002","result":"success"}

            Dictionary <string, string> other = new Dictionary <string, string>();
            string ret = LigerRM.Common.WebRequestHelper.WebRequestPoster.Post(url + "?landLord=" + JSONHelper.ToJson(landLord) + "&roomInfo=" + JSONHelper.ToJson(roomInfo) + "&tenantRenter=" + JSONHelper.ToJson(tenantRenter));
            Dictionary <string, string> dic = new Dictionary <string, string>();
            dic = JSONHelper.FromJson <Dictionary <string, string> >(ret);
            if (dic["result"].ToLower() == "success")
            {
                string roomInfoId     = dic["roomInfoId"];
                string landLordId     = dic["landLordId"];
                string tenantRenterId = dic["tenantRenterId"];
                attInfo.TenantID = tenantRenterId;
                info.RRentID     = roomInfoId;
                info.RHouseID    = landLordId;
                RentInfoHelper helper = new RentInfoHelper();
                helper.UpdateRentExternal(info, true);

                RentAttributeHelper attrHelper = new RentAttributeHelper();
                attrHelper.UpdateExternalInfo(attInfo);

                AddUploadLog(info.RentNo, attInfo.RRAID.ToString(), ret, "0", string.Empty);
            }
            else
            {
                AddUploadLog(info.RentNo, attInfo.RRAID.ToString(), ret, "1", string.Empty);
            }
            return(ret);
        }