Esempio n. 1
0
        public void DeleteRentAttribute(RentAttribute rentAttribute)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();

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

            //Update
            strSql.Append(" Update Rent_RentAttribute set RRAIsActive=1, RRAStatus='5', ");
            strSql.Append(" RRAModifiedBy='" + rentAttribute.RRAModifiedBy + "',");
            strSql.Append(" RRAModifiedDate='" + rentAttribute.RRAModifiedDate.Value.ToString("yyyy-MM-dd hh:mm:ss") + "'");
            strSql.Append(" where RRAID = '" + rentAttribute.RRAID + "'");
            SysLogHelper.AddLog(rentAttribute.RRAModifiedBy, "删除租赁信息ID:" + rentAttribute.RentNo, "删除-租赁信息");

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

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

            MySQLHelper.ExecuteNonQueryTrans(SqlConnString, listSQL);

            //清除密码和IC卡信息
            ClearPasswordToLock(rentAttribute.RRAID.ToString());
        }
Esempio n. 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));
        }
Esempio n. 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());
        }
Esempio n. 4
0
        /// <summary>
        /// 删除密码和IC卡
        /// </summary>
        /// <param name="aarId"></param>
        /// <returns></returns>
        public string ClearPasswordToLock(string aarId)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();
            RentAttribute a  = new RentAttribute(int.Parse(aarId));
            DataTable     dt = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand("select * from Rent_Locks where rentno='" + a.RentNo + "'")).Tables[0];

            if (dt.Rows.Count > 0)
            {
                string returnStr1 = string.Empty;
                if (dt.Rows[0]["DeviceType"].ToString() == "1") //新锁
                {
                    NewLockManager managerNew = new NewLockManager();
                    //清空临时卡
                    string iCCard = managerNew.delAction(a.RRAContactTel, "临时卡片", a.RRAStartDate.ToString(), a.RRAEndDate.ToString(), dt.Rows[0]["DeviceID"].ToString(), "1");
                    //清空临时密码
                    string password = managerNew.delAction(a.RRAContactTel, "临时密码", a.RRAStartDate.ToString(), a.RRAEndDate.ToString(), dt.Rows[0]["DeviceID"].ToString(), "1");
                    Dictionary <string, object> retIC = new Dictionary <string, object>();
                    retIC = JSONHelper.FromJson <Dictionary <string, object> >(iCCard);
                    Dictionary <string, object> retPass = new Dictionary <string, object>();
                    retPass = JSONHelper.FromJson <Dictionary <string, object> >(password);
                    if (retIC["ret"].ToString() == "1" || retPass["ret"].ToString() == "1")
                    {
                        returnStr1 = "ICCard:" + retIC["msg"].ToString() + "Pass:"******"msg"].ToString();
                    }
                }
                else  //旧锁
                {
                    string sql = "select * from Rent_Locks_ICCards where LockID='" + dt.Rows[0]["DeviceID"].ToString() + "' and StartDate='" + a.RRAStartDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and EndDate='" + a.RRAEndDate.ToString("yyyy-MM-dd HH:mm:ss") + "'";

                    LockManager manager = new LockManager();
                    DataTable   dt1     = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];
                    foreach (DataRow row in dt1.Rows)
                    {
                        string returnStr = manager.UpdatePassengerInfoToDevice(dt.Rows[0]["DeviceID"].ToString(), row["ICCard"].ToString(), "", "", "", a.RRAStartDate.ToString("yyyyMMddHHmm").Substring(2, 10), a.RRAEndDate.ToString("yyyyMMddHHmm").Substring(2, 10), "2");
                    }

                    returnStr1 = manager.UpdatePassengerInfoToDevice(dt.Rows[0]["DeviceID"].ToString(), "", "", "", a.RRANationName, a.RRAStartDate.ToString("yyyyMMddHHmm").Substring(2, 10), a.RRAEndDate.ToString("yyyyMMddHHmm").Substring(2, 10), "4");
                }

                dic.Add("ret", "0");
                dic.Add("msg", returnStr1);
            }
            else
            {
                dic.Add("ret", "1");
                dic.Add("msg", "未发现智能锁信息,无法添加密码");
            }
            return(JSONHelper.ToJson(dic));
        }
Esempio n. 5
0
        public void UpdateExternalInfo(RentAttribute info)
        {
            string    sql = "select * from Rent_RentAttribute_External where RRAID=" + info.RRAID.ToString();
            DataTable dt  = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            if (dt.Rows.Count > 0)
            {
                sql = "Update Rent_RentAttribute_External set HZTenantID='" + info.TenantID + "' where RRAID=" + info.RRAID.ToString();
            }
            else
            {
                sql = "Insert into Rent_RentAttribute_External values (" + info.RRAID.ToString() + ",'" + info.TenantID + "','" + DateTime.Now.ToString() + "')";
            }
            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
        }
Esempio n. 6
0
        public void UpdateStatus(string id, string status)
        {
            string sql = "update Rent_RentAttribute set RRAStatus='" + status + "' where RRAID=" + id;

            MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));

            RentAttribute a = new RentAttribute(id);

            sql = "select * from  Rent_RentAttribute where RRAID=" + id;
            DataSet ds = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));

            if (ds.Tables[0].Rows.Count > 0)
            {
                sql = "Update Rent_Rent set IsAvailable=1,RentNumber=1 where RentNo = '" + ds.Tables[0].Rows[0]["RentNo"].ToString() + "'";
                MySQLHelper.ExecuteNonQuery(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql));
            }
        }
Esempio n. 7
0
        public void UpdateRentAttribute(RentAttribute rentAttribute)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" Update Rent_RentAttribute set ");
            strSql.Append(" RRAContactName='" + rentAttribute.RRAContactName + "',");
            strSql.Append(" RRAContactTel='" + rentAttribute.RRAContactTel + "',RRANationName='" + rentAttribute.RRANationName + "',");
            strSql.Append(" RRAIDCard = '" + rentAttribute.RRAIDCard + "', RRentPrice = '" + rentAttribute.RRentPrice + "',");
            strSql.Append(" RRAContactProvince='" + rentAttribute.RRAContactProvince + "',");
            strSql.Append(" RRAStartDate='" + rentAttribute.RRAStartDate + "',RRAEndDate='" + rentAttribute.RRAEndDate + "',");
            strSql.Append(" RRADescription='" + rentAttribute.RRADescription + "',");
            strSql.Append(" RRAModifiedBy='" + rentAttribute.RRAModifiedBy + "',");
            strSql.Append(" RRAModifiedDate='" + rentAttribute.RRAModifiedDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'");
            strSql.Append(" where RRAID = '" + rentAttribute.RRAID + "'");
            SysLogHelper.AddLog(rentAttribute.RRAModifiedBy, "修改租赁信息ID:" + rentAttribute.RentNo, "修改-租赁信息");

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

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

            MySQLHelper.ExecuteNonQueryTrans(SqlConnString, listSQL);
        }
Esempio n. 8
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);
        }