Example #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RentInfoHelper rentInfoHelper = new RentInfoHelper();
        //if (rentInfoHelper.IsExistsSameAddressRent(ddlDistrict.Text,ddlStreet.Text,ddlRoad.Text,txtDoor.Text.Trim()))
        //{
        //    string detailAddress = ddlDistrict.Text + "-" + ddlStreet.Text + "-" + ddlRoad.Text + "-" + txtDoor.Text.Trim();
        //    ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:$.ligerDialog.warn('相同的房源名称("+ detailAddress + ")已经存在,请重新填写!');", true);
        //}
        //else
        //{

        //if (string.IsNullOrEmpty(lblRentNo.Text))
        //{
        //    lblRentNo.Text = rentInfoHelper.GetRentNo(ddlDistrict.SelectedValue);
        //}

        RentInfo rentInfo = new RentInfo(lblRentNo.Text);

        rentInfo.RentNo               = lblRentNo.Text;
        rentInfo.RDName               = ddlDistrict.SelectedValue;
        rentInfo.RSName               = ddlStreet.SelectedValue;
        rentInfo.RRName               = ddlRoad.SelectedValue;
        rentInfo.RPSParentName        = ddlPoliceStationParent.SelectedValue;
        rentInfo.RPSName              = ddlPoliceStation.SelectedValue;
        rentInfo.RLocationDescription = txtFee.Text;
        //rentInfo.RPSID = Convert.ToInt32(ddlPoliceStation.SelectedValue);
        rentInfo.RPSID = ddlPoliceStation.SelectedValue;

        rentInfo.RAddress = txtAddress.Text.Trim();
        rentInfo.RDoor    = txtDoor.Text.Trim();

        if (!string.IsNullOrEmpty(txtTotalDoor.Text.Trim()))
        {
            rentInfo.RTotalDoor = Convert.ToInt16(txtTotalDoor.Text.Trim());
        }
        else
        {
            rentInfo.RTotalDoor = 0;
        }

        if (ddlRoomType.SelectedValue != "0")
        {
            rentInfo.RRoomType = ddlRoomType.SelectedItem.Value;
        }
        else
        {
            rentInfo.RRoomType = string.Empty;
        }
        if (ddlDirection.SelectedValue != "0")
        {
            rentInfo.RDirection = ddlDirection.SelectedItem.Value;
        }
        else
        {
            rentInfo.RDirection = string.Empty;
        }
        if (ddlStructure.SelectedValue != "0")
        {
            rentInfo.RStructure = ddlStructure.SelectedItem.Value;
        }
        else
        {
            rentInfo.RStructure = string.Empty;
        }
        if (ddlBuildingType.SelectedValue != "0")
        {
            rentInfo.RBuildingType = ddlBuildingType.SelectedItem.Value;
        }
        else
        {
            rentInfo.RBuildingType = string.Empty;
        }
        if (ddlProperty.SelectedValue != "0")
        {
            rentInfo.RProperty = ddlProperty.SelectedItem.Value;
        }
        else
        {
            rentInfo.RProperty = string.Empty;
        }

        rentInfo.RFloor = txtFloor.Text.Trim();
        if (!string.IsNullOrEmpty(txtTotalFloor.Text.Trim()))
        {
            rentInfo.RTotalFloor = Convert.ToInt16(txtTotalFloor.Text.Trim());
        }
        else
        {
            rentInfo.RTotalFloor = 0;
        }
        rentInfo.RentType  = ddlRentType.SelectedValue;
        rentInfo.OwnType   = ddlOwnType.SelectedValue;
        rentInfo.RHouseAge = Convert.ToInt16(txtHouseAge.Text.Trim());
        rentInfo.RRentArea = Convert.ToDecimal(txtBuildRentArea.Text.Trim());
        rentInfo.ROwner    = txtOwner.Text.Trim();
        rentInfo.ROwnerTel = txtOwnerTel.Text.Trim();
        rentInfo.RIDCard   = txtIDCard.Text.Trim();
        //rentInfo.RLocationDescription = txtLocationDescription.Text.Trim();

        rentInfo.RMapID = 0;

        if (string.IsNullOrEmpty(RentNo))
        {
            rentInfo.RCreatedBy   = SysContext.CurrentUserName;
            rentInfo.RCreatedDate = System.DateTime.Now;
        }
        else
        {
            rentInfo.RModifiedBy   = SysContext.CurrentUserName;
            rentInfo.RModifiedDate = System.DateTime.Now;
        }

        rentInfo.Longitude = txtLangitude.Text;
        rentInfo.Latitude  = txtLatitude.Text;

        rentInfoHelper.UpdateRent(rentInfo);
        Session["RentNo"] = null;
        ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:SubmitDialog('" + rentInfo.RentNo + "');", true);
        //}
    }
Example #2
0
    public string UpdateRentInfo(string RentNo, string RDName, string RSName, string RRName, string RPSName, string RAddress,
                                 string RDoor, string RTotalDoor, string RRoomType, string RDirection, string RStructure, string RBuildingType, string RFloor, string RTotalFloor, string RHouseAge,
                                 decimal RRentArea, string RProperty, string ROwner, string ROwnerTel, string RIDCard, string RLocationDescription, string RPSParentName, string createdBy, string rentType, string ownType)
    {
        RentInfo rentInfo = new RentInfo(RentNo);

        rentInfo.RentNo = RentNo;
        RentInfoHelper helper = new RentInfoHelper();

        rentInfo.RDName = RDName;
        rentInfo.RSName = RSName;
        rentInfo.RRName = RRName;

        rentInfo.RPSParentName = RPSParentName;
        rentInfo.RPSName       = RPSName;
        rentInfo.RPSID         = RPSName;
        //rentInfo.RPSID = int.Parse(RPSName);

        rentInfo.RAddress   = RAddress;
        rentInfo.RDoor      = RDoor;
        rentInfo.RTotalDoor = int.Parse(RTotalDoor);

        rentInfo.RRoomType     = RRoomType;
        rentInfo.RDirection    = RDirection;
        rentInfo.RStructure    = RStructure;
        rentInfo.RBuildingType = RBuildingType;
        rentInfo.RProperty     = RProperty;

        rentInfo.RFloor      = RFloor;
        rentInfo.RTotalFloor = int.Parse(RTotalFloor);

        rentInfo.RHouseAge            = int.Parse(RHouseAge);
        rentInfo.RRentArea            = RRentArea;
        rentInfo.ROwner               = ROwner;
        rentInfo.ROwnerTel            = ROwnerTel;
        rentInfo.RIDCard              = RIDCard;
        rentInfo.RLocationDescription = RLocationDescription;

        rentInfo.RMapID = 0;

        rentInfo.RCreatedBy    = createdBy;
        rentInfo.RCreatedDate  = DateTime.Now;
        rentInfo.RModifiedBy   = createdBy;
        rentInfo.RModifiedDate = DateTime.Now;

        rentInfo.RentType = rentType;
        rentInfo.OwnType  = ownType;

        string      retStr = GetLocationInfo(RAddress, "天津");
        XmlDocument doc    = new XmlDocument();

        doc.LoadXml(retStr);
        XmlNode status = doc.SelectSingleNode("GeocoderSearchResponse/status");

        if (status.InnerText == "0")
        {
            XmlNode lng = doc.SelectSingleNode("GeocoderSearchResponse/result/location/lng");
            XmlNode lat = doc.SelectSingleNode("GeocoderSearchResponse/result/location/lat");
            rentInfo.Longitude = lng.InnerText;
            rentInfo.Latitude  = lat.InnerText;
        }


        //string retStr = GetLocationInfo(RAddress, "天津");
        //if (retStr.IndexOf("lng") > 0)
        //{
        //    int aa = retStr.IndexOf("\"lng\"");
        //    retStr = retStr.Substring(retStr.IndexOf("\"lng\""));
        //    string lng = retStr.Substring(6, retStr.IndexOf("\n"));
        //    lng = lng.Replace("\n", "").Trim().Replace(",", "");
        //    retStr = retStr.Substring(retStr.IndexOf("\"lat\""));
        //    string lat = retStr.Substring(6, retStr.IndexOf("\n"));
        //    lat = lat.Replace("\n", "").Trim().Replace(",", "");
        //    rentInfo.Longitude = lng;
        //    rentInfo.Latitude = lat;
        //}

        RentInfoHelper rentInfoHelper = new RentInfoHelper();

        try
        {
            rentInfoHelper.UpdateRent(rentInfo);
            return("true");
        }
        catch (Exception ex)
        {
            return("false");
        }
    }