public void InsertProperty(PropertyModel newProperty)
        {
            DaoProperty daProperty = new DaoProperty();
            newProperty.CreatedDate = System.DateTime.Now;
            daProperty.InsertProperty(newProperty);

        }
        protected void SaveProperty_Click(object sender, EventArgs e)
        {

            PropertyModel newproperty = new PropertyModel();
            if (drpDwnArea.SelectedValue != "Select")
            {
                newproperty.AreaId = Int32.Parse(drpDwnArea.SelectedValue);
                newproperty.BuildingName = txtBuildingName.Text;
                newproperty.FlatNo = Int32.Parse(txtFlatNo.Text);
                newproperty.PinNo = Int64.Parse(txtPinNo.Text);
                if(Session["UserDetails"]!=null)
                newproperty.CreatedBy = (Session["UserDetails"] as LoginModel).UserId;
                //newproperty.CreatedBy = Session["User"].ToString();
                BaoProperty baProperty = new BaoProperty();
                baProperty.InsertProperty(newproperty);
            }
           

            
            
            
          
       
     }
        public bool InsertProperty(PropertyModel newProperty)
        {


            SqlConnection con = null;
            try
            {
                con = new SqlConnection("server=.;database=RMS;integrated security=true");
                SqlCommand com = new SqlCommand("insert into RMS_PROPERTY (Areaid,BUILDING_NAME,FLAT_NO,PIN_NO,CREATED_BY,CREATED_DATE) values ('" + newProperty.AreaId + "','" + newProperty.BuildingName + "','" + newProperty.FlatNo + "','" + newProperty.PinNo + "','"+newProperty.CreatedBy+"','"+newProperty.CreatedDate+"')", con);

                con.Open();
                int count = com.ExecuteNonQuery();
                if (count > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (Exception ex)
            {
                con.Close();
                throw;
            }
            finally
            {

                 con.Close();
            }
            
        }