Example #1
0
        public List <ry_Property> GetAllProperties()
        {
            using (SqlConnection sqlConn = new SqlConnection(connString))
            {
                using (SqlCommand cmd = new SqlCommand("Select * from ry_Property", sqlConn))
                {
                    sqlConn.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        ry_Property property = new ry_Property();

                        property.propertyType        = reader[2].ToString();
                        property.areaSize            = reader[3].ToString();
                        property.demand              = reader[4].ToString();
                        property.Status              = reader[5].ToString();
                        property.rentOrSale          = reader[6].ToString();
                        property.propertyDescription = reader[7].ToString();
                        property.agentName           = reader[8].ToString();
                        property.agentContactNumber  = reader[9].ToString();
                        listProperties.Add(property);
                    }
                }
            }
            return(listProperties);
        }
Example #2
0
 public void deleteData(ry_Property obj)
 {
     using (SqlConnection sqlConn = new SqlConnection(connString))
     {
         using (SqlCommand cmd = new SqlCommand("usp_DeleteProperty", sqlConn))
         {
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             sqlConn.Open();
             cmd.Parameters.AddWithValue("@propertyID", obj.propertyID);
             cmd.Parameters.AddWithValue("@Cnic", obj.Cnic);
             cmd.ExecuteNonQuery();
         }
     }
 }
Example #3
0
        protected void ListView_Property_ItemDeleting(object sender, ListViewDeleteEventArgs e)
        {
            Label       PropertyId  = ((Label)ListView_Property.Items[e.ItemIndex].FindControl("lbl_PropertyId"));
            Label       cnic        = ((Label)ListView_Property.Items[e.ItemIndex].FindControl("lbl_Cnic"));
            ry_Property objProperty = new ry_Property();

            objProperty.Cnic       = cnic.Text;
            objProperty.propertyID = Convert.ToInt32(PropertyId.Text);
            objProperty.delete(objProperty);
            ry_Client objClient = new ry_Client();

            objClient.Cnic = cnic.Text;
            objClient.delete(objClient);
            ListView_Property.EditIndex = -1;
            Response.Redirect("AdminPanel.aspx");
        }
Example #4
0
 protected void btn_PropertiesInformation_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         ry_Property Property = new ry_Property();
         Property.propertyType        = propertyType.SelectedItem.Value;
         Property.areaSize            = areaSize.Text;
         Property.demand              = demand.Text;
         Property.location            = location.Text;
         Property.Status              = status.Text;
         Property.rentOrSale          = rentOrSale.SelectedItem.Value;
         Property.propertyDescription = propertyDescription.Text;
         Property.agentName           = agentName.Text;
         Property.agentContactNumber  = agentContactNumber.Text;
         Property.Image = ImageBytes(propertyImage);
         PropertyBL.Add(Property);
         Response.Redirect("ClientInformation.aspx");
     }
 }
Example #5
0
 public void updateData(ry_Property obj)
 {
     using (SqlConnection sqlConn = new SqlConnection(connString))
     {
         using (SqlCommand cmd = new SqlCommand("usp_UpdateProperty", sqlConn))
         {
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             sqlConn.Open();
             cmd.Parameters.AddWithValue("@Cnic", obj.Cnic);
             cmd.Parameters.AddWithValue("@propertyType", obj.propertyType);
             cmd.Parameters.AddWithValue("@areaSize", obj.areaSize);
             cmd.Parameters.AddWithValue("@location", obj.location);
             cmd.Parameters.AddWithValue("@demand", obj.demand);
             cmd.Parameters.AddWithValue("@Status", obj.Status);
             cmd.Parameters.AddWithValue("@rentOrSale", obj.rentOrSale);
             cmd.Parameters.AddWithValue("@propertyDescription", obj.propertyDescription);
             cmd.Parameters.AddWithValue("@agentName", obj.agentName);
             cmd.Parameters.AddWithValue("@agentContactNumber", obj.agentContactNumber);
             cmd.Parameters.AddWithValue("@Image", obj.Image);
             cmd.ExecuteNonQuery();
         }
     }
 }
Example #6
0
        protected void ListView_Property_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            Label   cnic             = ((Label)ListView_Property.Items[e.ItemIndex].FindControl("lbl_Cnic"));
            TextBox firstName        = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_firstName"));
            TextBox lastName         = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_lastName"));
            TextBox email            = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_email"));
            TextBox contactNumber    = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_contactNumber"));
            TextBox postalAddress    = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_postalAddress"));
            TextBox permenantAddress = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_permenantAddress"));


            Label           PropertyId          = ((Label)ListView_Property.Items[e.ItemIndex].FindControl("lbl_PropertyId"));
            TextBox         location            = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_location"));
            RadioButtonList propertyType        = ((RadioButtonList)ListView_Property.Items[e.ItemIndex].FindControl("propertyType"));
            TextBox         areaSize            = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_areaSize"));
            TextBox         demand              = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_demand"));
            RadioButtonList rentOrSale          = ((RadioButtonList)ListView_Property.Items[e.ItemIndex].FindControl("rentOrSale"));
            TextBox         Status              = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_status"));
            TextBox         propertyDescription = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_propertyDescription"));
            TextBox         agentName           = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_agentName"));
            TextBox         agentContactNumber  = ((TextBox)ListView_Property.Items[e.ItemIndex].FindControl("tb_agentContactNumber"));
            FileUpload      Image_Property      = ((FileUpload)ListView_Property.Items[e.ItemIndex].FindControl("CountrySidepropertyImage"));
            Image           Image_CSP_ASP       = ((Image)ListView_Property.Items[e.ItemIndex].FindControl("img"));


            ry_Client objClient = new ry_Client();

            objClient.Cnic             = cnic.Text;
            objClient.firstName        = firstName.Text;
            objClient.lastName         = lastName.Text;
            objClient.email            = email.Text;
            objClient.contactNumber    = contactNumber.Text;
            objClient.postalAddress    = postalAddress.Text;
            objClient.permenantAddress = permenantAddress.Text;
            objClient.update(objClient);

            ry_Property objProperty = new ry_Property();

            objProperty.Cnic                = cnic.Text;
            objProperty.propertyID          = Convert.ToInt32(PropertyId.Text);
            objProperty.location            = location.Text;
            objProperty.propertyType        = propertyType.SelectedValue;
            objProperty.areaSize            = areaSize.Text;
            objProperty.demand              = demand.Text;
            objProperty.rentOrSale          = rentOrSale.SelectedValue;
            objProperty.Status              = Status.Text;
            objProperty.propertyDescription = propertyDescription.Text;
            objProperty.agentName           = agentName.Text;
            objProperty.agentContactNumber  = agentContactNumber.Text;
            if (Image_Property.HasFile)
            {
                objProperty.Image = ImageBytes(Image_Property);
            }
            else
            {
                objProperty.Image = new byte[0];
            }
            objProperty.update(objProperty);
            ListView_Property.EditIndex = -1;
            Response.Redirect("AdminPanel.aspx");
        }