Exemple #1
0
        public void InsertNewEstate(estaterecord item)
        {
            string insertsql = String.Concat("INSERT INTO realestate(Rcity, Rdistrict_region, Rstreet, Restate_type, Rfloor, Rnumber_of_storeys,",
                                             "Rroom_quantity, Rhaggle, Rproperty_type, Rtitle, Routhouse_legality, Ruse_for_office, Rdescription_short,",
                                             "Rbathroom_note, Rbathroom, Rwalling_type, Rkitchen_note, Rlevel_quantity, Rparking, Rdescription_detail,");

            insertsql = String.Concat(insertsql, "Rroom_layout, Rhouse_type, Rbalcony, Rloggia, Rwater_supply, Rgas_supply, Rcondition2, Rheat_supply,",
                                      "Rinterior_door_type, Rfront_door_type, Rwindow_material, Rtelephone, Rtubing_material, Rkitchen_floor_space,");
            insertsql = String.Concat(insertsql, "Rhall_floor_space, Rtotal_floor_space, Rceiling_height, Rreference_point, Rfloor_space, Rnote, Rbackrooms,",
                                      "Rprice, Rprice_square, Ris_special_proposal, Rchange_only, Rnewbuilding, Rhypothec, Ragent_code,");
            insertsql = String.Concat(insertsql, "Rdate_add, Rdate_change, Rstatus, Rtrade_date, Rrent_price_day, Rrent_price_month, Raccount_in_rent,",
                                      "Rbuilding_year, Rroof, Rterms_exchange, Rdistance_to_city, Rground_area, Rpurpose_use, Rbasement,");
            insertsql = String.Concat(insertsql, "Rwindow_front_quantity, Rmain_entrance_location, Rcommercial_outhouse, Rsite_space, Rsewerage, Rphoto,",
                                      "Roperation, Rlavatory_basin, Rhouse_no, Rblock_no, Rflat_no, RFridge, Rtrade_price) VALUES (@Rcity, @Rdistrict_region, @Rstreet,");
            insertsql = String.Concat(insertsql, "@Restate_type, @Rfloor, @Rnumber_of_storeys, @Rroom_quantity, @Rhaggle, @Rproperty_type, @Rtitle,",
                                      "@Routhouse_legality, @Ruse_for_office, @Rdescription_short, @Rbathroom_note, @Rbathroom, @Rwalling_type, @Rkitchen_note,");
            insertsql = String.Concat(insertsql, "@Rlevel_quantity, @Rparking, @Rdescription_detail, @Rroom_layout, @Rhouse_type, @Rbalcony, @Rloggia,",
                                      "@Rwater_supply, @Rgas_supply, @Rcondition2, @Rheat_supply, @Rinterior_door_type, @Rfront_door_type, @Rwindow_material, ");

            insertsql = String.Concat(insertsql, "@Rtelephone, @Rtubing_material, @Rkitchen_floor_space, @Rhall_floor_space, @Rtotal_floor_space,",
                                      "@Rceiling_height, @Rreference_point, @Rfloor_space, @Rnote, @Rbackrooms, @Rprice, @Rprice_square, @Ris_special_proposal,");
            insertsql = String.Concat(insertsql, "@Rchange_only, @Rnewbuilding, @Rhypothec, @Ragent_code, @Rdate_add, @Rdate_change, @Rstatus, @Rtrade_date,",
                                      "@Rrent_price_day, @Rrent_price_month, @Raccount_in_rent, @Rbuilding_year, @Rroof, @Rterms_exchange, @Rdistance_to_city,");
            insertsql = String.Concat(insertsql, "@Rground_area, @Rpurpose_use, @Rbasement, @Rwindow_front_quantity, @Rmain_entrance_location, @Rcommercial_outhouse,",
                                      "@Rsite_space, @Rsewerage, @Rphoto, @Roperation, @Rlavatory_basin, @Rhouse_no, @Rblock_no, @Rflat_no, @RFridge, @Rtrade_price)");

            MySqlConnection con = new MySqlConnection(ConnectionString);

            con.Open();
            MySqlCommand command = new MySqlCommand(insertsql, con);

            command.Parameters.AddWithValue("@Rcity", item.Rcity);
            command.Parameters.AddWithValue("@Rdistrict_region", item.Rdistrict_region);
            command.Parameters.AddWithValue("@Rstreet", item.Rstreet);
            command.Parameters.AddWithValue("@Restate_type", item.Restate_type);
            command.Parameters.AddWithValue("@Rfloor", item.Rfloor);
            command.Parameters.AddWithValue("@Rnumber_of_storeys", item.Rnumber_of_storeys);
            command.Parameters.AddWithValue("@Rroom_quantity", item.Rroom_quantity);
            command.Parameters.AddWithValue("@Rhaggle", item.Rhaggle);
            command.Parameters.AddWithValue("@Rproperty_type", item.Rproperty_type);
            command.Parameters.AddWithValue("@Rtitle", item.Rtitle);
            command.Parameters.AddWithValue("@Routhouse_legality", item.Routhouse_legality);
            command.Parameters.AddWithValue("@Ruse_for_office", item.Ruse_for_office);
            command.Parameters.AddWithValue("@Rdescription_short", item.Rdescription_short);
            command.Parameters.AddWithValue("@Rbathroom_note", item.Rbathroom_note);
            command.Parameters.AddWithValue("@Rbathroom", item.Rbathroom);
            command.Parameters.AddWithValue("@Rwalling_type", item.Rwalling_type);
            command.Parameters.AddWithValue("@Rkitchen_note", item.Rkitchen_note);
            command.Parameters.AddWithValue("@Rlevel_quantity", item.Rlevel_quantity);
            command.Parameters.AddWithValue("@Rparking", item.Rparking);
            command.Parameters.AddWithValue("@Rdescription_detail", item.Rdescription_detail);
            command.Parameters.AddWithValue("@Rroom_layout", item.Rroom_layout);
            command.Parameters.AddWithValue("@Rhouse_type", item.Rhouse_type);
            command.Parameters.AddWithValue("@Rbalcony", item.Rbalcony);
            command.Parameters.AddWithValue("@Rloggia", item.Rloggia);
            command.Parameters.AddWithValue("@Rwater_supply", item.Rwater_supply);
            command.Parameters.AddWithValue("@Rgas_supply", item.Rgas_supply);
            command.Parameters.AddWithValue("@Rcondition2", item.Rcondition2);
            command.Parameters.AddWithValue("@Rheat_supply", item.Rheat_supply);
            command.Parameters.AddWithValue("@Rinterior_door_type", item.Rinterior_door_type);
            command.Parameters.AddWithValue("@Rfront_door_type", item.Rfront_door_type);
            command.Parameters.AddWithValue("@Rwindow_material", item.Rwindow_material);
            command.Parameters.AddWithValue("@Rtelephone", item.Rtelephone);
            command.Parameters.AddWithValue("@Rtubing_material", item.Rtubing_material);
            command.Parameters.AddWithValue("@Rkitchen_floor_space", item.Rkitchen_floor_space);
            command.Parameters.AddWithValue("@Rhall_floor_space", item.Rhall_floor_space);
            command.Parameters.AddWithValue("@Rtotal_floor_space", item.Rtotal_floor_space);
            command.Parameters.AddWithValue("@Rceiling_height", item.Rceiling_height);
            command.Parameters.AddWithValue("@Rreference_point", item.Rreference_point);
            command.Parameters.AddWithValue("@Rfloor_space", item.Rfloor_space);
            command.Parameters.AddWithValue("@Rnote", item.Rnote);
            command.Parameters.AddWithValue("@Rbackrooms", item.Rbackrooms);
            command.Parameters.AddWithValue("@Rprice", item.Rprice);
            command.Parameters.AddWithValue("@Rprice_square", item.Rprice_square);
            command.Parameters.AddWithValue("@Ris_special_proposal", item.Ris_special_proposal);
            command.Parameters.AddWithValue("@Rchange_only", item.Rchange_only);
            command.Parameters.AddWithValue("@Rnewbuilding", item.Rnewbuilding);
            command.Parameters.AddWithValue("@Rhypothec", item.Rhypothec);
            command.Parameters.AddWithValue("@Ragent_code", item.Ragent_code);
            command.Parameters.AddWithValue("@Rdate_add", item.Rdate_add);
            command.Parameters.AddWithValue("@Rdate_change", item.Rdate_change);
            command.Parameters.AddWithValue("@Rstatus", item.Rstatus);
            command.Parameters.AddWithValue("@Rtrade_date", item.Rtrade_date);
            command.Parameters.AddWithValue("@Rrent_price_day", item.Rrent_price_day);
            command.Parameters.AddWithValue("@Rrent_price_month", item.Rrent_price_month);
            command.Parameters.AddWithValue("@Raccount_in_rent", item.Raccount_in_rent);
            command.Parameters.AddWithValue("@Rbuilding_year", item.Rbuilding_year);
            command.Parameters.AddWithValue("@Rroof", item.Rroof);
            command.Parameters.AddWithValue("@Rterms_exchange", item.Rterms_exchange);
            command.Parameters.AddWithValue("@Rdistance_to_city", item.Rdistance_to_city);
            command.Parameters.AddWithValue("@Rground_area", item.Rground_area);
            command.Parameters.AddWithValue("@Rpurpose_use", item.Rpurpose_use);
            command.Parameters.AddWithValue("@Rbasement", item.Rbasement);
            command.Parameters.AddWithValue("@Rwindow_front_quantity", item.Rwindow_front_quantity);
            command.Parameters.AddWithValue("@Rmain_entrance_location", item.Rmain_entrance_location);
            command.Parameters.AddWithValue("@Rcommercial_outhouse", item.Rcommercial_outhouse);
            command.Parameters.AddWithValue("@Rsite_space", item.Rsite_space);
            command.Parameters.AddWithValue("@Rsewerage", item.Rsewerage);
            command.Parameters.AddWithValue("@Rphoto", item.Rphoto);
            command.Parameters.AddWithValue("@Roperation", item.Roperation);
            command.Parameters.AddWithValue("@Rlavatory_basin", item.Rlavatory_basin);
            command.Parameters.AddWithValue("@Rhouse_no", item.Rhouse_no);
            command.Parameters.AddWithValue("@Rblock_no", item.Rblock_no);
            command.Parameters.AddWithValue("@Rflat_no", item.Rflat_no);
            command.Parameters.AddWithValue("@RFridge", item.RFridge);
            command.Parameters.AddWithValue("@Rtrade_price", item.Rtrade_price);

            command.ExecuteNonQuery();
            int id = Convert.ToInt32(command.LastInsertedId);

            //add photo upload and comments insertion

            con.Close();
        }
Exemple #2
0
        public void UpdateEstate(estaterecord item)
        {
            string updatesql = @"UPDATE realestate SET Rcity = @Rcity, Rdistrict_region = @Rdistrict_region, Rstreet = @Rstreet, Restate_type = @Restate_type, Rfloor = @Rfloor,
                                 Rnumber_of_storeys = @Rnumber_of_storeys, Rroom_quantity = @Rroom_quantity, Rhaggle = @Rhaggle, Rproperty_type = @Rproperty_type, Rtitle = @Rtitle, 
                                 Routhouse_legality = @Routhouse_legality, Ruse_for_office = @Ruse_for_office, Rdescription_short = @Rdescription_short, Rbathroom_note = @Rbathroom_note, 
                                 Rbathroom = @Rbathroom, Rbathroom_note = @Rbathroom_note, Rwalling_type = @Rwalling_type, Rkitchen_note = @Rkitchen_note, Rlevel_quantity = @Rlevel_quantity, 
                                 Rparking = @Rparking, Rdescription_detail = @Rdescription_detail, Rroom_layout = @Rroom_layout, Rhouse_type = @Rhouse_type, Rbalcony = @Rbalcony, Rloggia = @Rloggia, 
                                 Rwater_supply = @Rwater_supply, Rgas_supply = @Rgas_supply, Rcondition2 = @Rcondition2, Rheat_supply = @Rheat_supply, Rinterior_door_type = @Rinterion_door_type, 
                                 Rfront_door_type = @Rfront_door_type, Rwindow_material = @Rwindow_material, Rtelephone = @Rtelephone, Rtubing_material = @Rtubing_material, 
                                 Rkitchen_floor_space = @Rkitchen_floor_space, Rhall_floor_space = @Rhall_floor_space, Rtotal_floor_space = @Rtotal_floor_space, Rceiling_height = @Rceiling_height,
                                 Rreference_point = @Rreference_point, Rfloor_space = Rfloor_space, Rnote = @Rnote, Rbackrooms = @Rbackrooms, Rprice = @Rprice, Rprice_square = @Rprice_square, 
                                 Ris_special_proposal = @Ris_special_proposal, Rchange_only = @Rchange_only, Rnewbuilding = @Rnewbuilding, Rhypothec = @Rhypothec, Ragent_code = @Ragent_code,
                                 Rdate_add = @Rdate_add, Rdate_change = @Rdate_change, Rstatus = @Rstatus, Rtrade_date = @Rtrade_date, Rrent_price_day = @Rrent_price_day, 
                                 Rrent_price_month = @Rrent_price_month, Raccount_in_rent = @Raccount_in_rent, Rbuilding_year = @Rbuilding_year, Rroof = @Rroof, Rterms_exchange = @Rterms_exchange,
                                 Rdistance_to_city = @Rdistance_to_city, Rground_area = @Rground_area, Rpurpose_use = @Rpurpose_use, Rbasement = @Rbasement, Rwindow_front_quantity = @Rwindow_front_quantity, 
                                 Rmain_entrance_location = @Rmain_entrance_location, Rcommercial_outhouse = @Rcommercial_outhouse, Rsite_space = @Rsite_space, Rsewerage = @Rsewerage, Rphoto = @Rphoto,
                                 Roperation = @Roperation, Rlavatory_basin = @Rlavatory_basin, Rhouse_no= @Rhouse_no, Rblock_no = @Rblock_no, Rflat_no = @Rflat_no, RFridge = @Rfridge, Rtrade_price = @Rtrade_price WHERE Rid = @Rid ";

            MySqlConnection con = new MySqlConnection(ConnectionString);

            con.Open();
            MySqlCommand command = new MySqlCommand(updatesql, con);

            command.Parameters.AddWithValue("@Rcity", item.Rcity);
            command.Parameters.AddWithValue("@Rdistrict_region", item.Rdistrict_region);
            command.Parameters.AddWithValue("@Rstreet", item.Rstreet);
            command.Parameters.AddWithValue("@Restate_type", item.Restate_type);
            command.Parameters.AddWithValue("@Rfloor", item.Rfloor);
            command.Parameters.AddWithValue("@Rnumber_of_storeys", item.Rnumber_of_storeys);
            command.Parameters.AddWithValue("@Rroom_quantity", item.Rroom_quantity);
            command.Parameters.AddWithValue("@Rhaggle", item.Rhaggle);
            command.Parameters.AddWithValue("@Rproperty_type", item.Rproperty_type);
            command.Parameters.AddWithValue("@Rtitle", item.Rtitle);
            command.Parameters.AddWithValue("@Routhouse_legality", item.Routhouse_legality);
            command.Parameters.AddWithValue("@Ruse_for_office", item.Ruse_for_office);
            command.Parameters.AddWithValue("@Rdescription_short", item.Rdescription_short);
            command.Parameters.AddWithValue("@Rbathroom_note", item.Rbathroom_note);
            command.Parameters.AddWithValue("@Rbathroom", item.Rbathroom);
            command.Parameters.AddWithValue("@Rwalling_type", item.Rwalling_type);
            command.Parameters.AddWithValue("@Rkitchen_note", item.Rkitchen_note);
            command.Parameters.AddWithValue("@Rlevel_quantity", item.Rlevel_quantity);
            command.Parameters.AddWithValue("@Rparking", item.Rparking);
            command.Parameters.AddWithValue("@Rdescription_detail", item.Rdescription_detail);
            command.Parameters.AddWithValue("@Rroom_layout", item.Rroom_layout);
            command.Parameters.AddWithValue("@Rhouse_type", item.Rhouse_type);
            command.Parameters.AddWithValue("@Rbalcony", item.Rbalcony);
            command.Parameters.AddWithValue("@Rloggia", item.Rloggia);
            command.Parameters.AddWithValue("@Rwater_supply", item.Rwater_supply);
            command.Parameters.AddWithValue("@Rgas_supply", item.Rgas_supply);
            command.Parameters.AddWithValue("@Rcondition2", item.Rcondition2);
            command.Parameters.AddWithValue("@Rheat_supply", item.Rheat_supply);
            command.Parameters.AddWithValue("@Rinterior_door_type", item.Rinterior_door_type);
            command.Parameters.AddWithValue("@Rfront_door_type", item.Rfront_door_type);
            command.Parameters.AddWithValue("@Rwindow_material", item.Rwindow_material);
            command.Parameters.AddWithValue("@Rtelephone", item.Rtelephone);
            command.Parameters.AddWithValue("@Rtubing_material", item.Rtubing_material);
            command.Parameters.AddWithValue("@Rkitchen_floor_space", item.Rkitchen_floor_space);
            command.Parameters.AddWithValue("@Rhall_floor_space", item.Rhall_floor_space);
            command.Parameters.AddWithValue("@Rtotal_floor_space", item.Rtotal_floor_space);
            command.Parameters.AddWithValue("@Rceiling_height", item.Rceiling_height);
            command.Parameters.AddWithValue("@Rreference_point", item.Rreference_point);
            command.Parameters.AddWithValue("@Rfloor_space", item.Rfloor_space);
            command.Parameters.AddWithValue("@Rnote", item.Rnote);
            command.Parameters.AddWithValue("@Rbackrooms", item.Rbackrooms);
            command.Parameters.AddWithValue("@Rprice", item.Rprice);
            command.Parameters.AddWithValue("@Rprice_square", item.Rprice_square);
            command.Parameters.AddWithValue("@Ris_special_proposal", item.Ris_special_proposal);
            command.Parameters.AddWithValue("@Rchange_only", item.Rchange_only);
            command.Parameters.AddWithValue("@Rnewbuilding", item.Rnewbuilding);
            command.Parameters.AddWithValue("@Rhypothec", item.Rhypothec);
            command.Parameters.AddWithValue("@Ragent_code", item.Ragent_code);
            command.Parameters.AddWithValue("@Rdate_add", item.Rdate_add);
            command.Parameters.AddWithValue("@Rdate_change", item.Rdate_change);
            command.Parameters.AddWithValue("@Rstatus", item.Rstatus);
            command.Parameters.AddWithValue("@Rtrade_date", item.Rtrade_date);
            command.Parameters.AddWithValue("@Rrent_price_day", item.Rrent_price_day);
            command.Parameters.AddWithValue("@Rrent_price_month", item.Rrent_price_month);
            command.Parameters.AddWithValue("@Raccount_in_rent", item.Raccount_in_rent);
            command.Parameters.AddWithValue("@Rbuilding_year", item.Rbuilding_year);
            command.Parameters.AddWithValue("@Rroof", item.Rroof);
            command.Parameters.AddWithValue("@Rterms_exchange", item.Rterms_exchange);
            command.Parameters.AddWithValue("@Rdistance_to_city", item.Rdistance_to_city);
            command.Parameters.AddWithValue("@Rground_area", item.Rground_area);
            command.Parameters.AddWithValue("@Rpurpose_use", item.Rpurpose_use);
            command.Parameters.AddWithValue("@Rbasement", item.Rbasement);
            command.Parameters.AddWithValue("@Rwindow_front_quantity", item.Rwindow_front_quantity);
            command.Parameters.AddWithValue("@Rmain_entrance_location", item.Rmain_entrance_location);
            command.Parameters.AddWithValue("@Rcommercial_outhouse", item.Rcommercial_outhouse);
            command.Parameters.AddWithValue("@Rsite_space", item.Rsite_space);
            command.Parameters.AddWithValue("@Rsewerage", item.Rsewerage);
            command.Parameters.AddWithValue("@Rphoto", item.Rphoto);
            command.Parameters.AddWithValue("@Roperation", item.Roperation);
            command.Parameters.AddWithValue("@Rlavatory_basin", item.Rlavatory_basin);
            command.Parameters.AddWithValue("@Rhouse_no", item.Rhouse_no);
            command.Parameters.AddWithValue("@Rblock_no", item.Rblock_no);
            command.Parameters.AddWithValue("@Rflat_no", item.Rflat_no);
            command.Parameters.AddWithValue("@RFridge", item.RFridge);
            command.Parameters.AddWithValue("@Rid", item.Rid);
            command.Parameters.AddWithValue("@Rtrade_price", item.Rid);

            command.ExecuteNonQuery();
            //add photo upload and comments insertion
            con.Close();
        }
Exemple #3
0
        public estaterecord ReadEstate(string itemid)
        {
            estaterecord    item      = new estaterecord();
            string          selectsql = String.Concat("SELECT * FROM realestate WHERE Rid ='", itemid, "'");
            MySqlConnection con       = new MySqlConnection(ConnectionString);

            con.Open();
            MySqlCommand    command = new MySqlCommand(selectsql, con);
            MySqlDataReader reader  = command.ExecuteReader();
            DataTable       result  = new DataTable();

            result.Load(reader);
            item.Rid              = Convert.ToInt32(itemid);
            item.Rcity            = result.Rows[0][1].ToString();
            item.Rdistrict_region = result.Rows[0][2].ToString();
            item.Rstreet          = result.Rows[0][3].ToString();
            item.Restate_type     = result.Rows[0][4].ToString();
            try { item.Rfloor = Convert.ToInt32(result.Rows[0][5]); }
            catch { item.Rfloor = 0; }
            try { item.Rnumber_of_storeys = Convert.ToInt32(result.Rows[0][6]); }
            catch { item.Rnumber_of_storeys = 0; }
            try { item.Rroom_quantity = Convert.ToInt32(result.Rows[0][7]); }
            catch { item.Rroom_quantity = 1; }
            try { item.Rhaggle = Convert.ToInt32(result.Rows[0][8]); }
            catch { item.Rhaggle = 0; }
            item.Rproperty_type = result.Rows[0][9].ToString();
            item.Rtitle         = result.Rows[0][10].ToString();
            try { item.Routhouse_legality = Convert.ToInt32(result.Rows[0][11]); }
            catch { item.Routhouse_legality = 0; }
            try { item.Ruse_for_office = Convert.ToInt32(result.Rows[0][12]); }
            catch { item.Ruse_for_office = 0; }
            item.Rdescription_short = result.Rows[0][13].ToString();
            item.Rbathroom_note     = result.Rows[0][14].ToString();
            item.Rbathroom          = result.Rows[0][15].ToString();
            item.Rwalling_type      = result.Rows[0][16].ToString();
            item.Rkitchen_note      = result.Rows[0][17].ToString();
            try { item.Rlevel_quantity = Convert.ToInt32(result.Rows[0][18]); }
            catch { item.Rlevel_quantity = 0; }
            try { item.Rparking = Convert.ToInt32(result.Rows[0][19]); }
            catch { item.Rparking = 0; }
            item.Rdescription_detail  = result.Rows[0][20].ToString();
            item.Rroom_layout         = result.Rows[0][21].ToString();
            item.Rhouse_type          = result.Rows[0][22].ToString();
            item.Rbalcony             = result.Rows[0][23].ToString();
            item.Rloggia              = result.Rows[0][24].ToString();
            item.Rwater_supply        = result.Rows[0][25].ToString();
            item.Rgas_supply          = result.Rows[0][26].ToString();
            item.Rcondition2          = result.Rows[0][27].ToString();
            item.Rheat_supply         = result.Rows[0][28].ToString();
            item.Rinterior_door_type  = result.Rows[0][29].ToString();
            item.Rfront_door_type     = result.Rows[0][30].ToString();
            item.Rwindow_material     = result.Rows[0][31].ToString();
            item.Rtelephone           = result.Rows[0][32].ToString();
            item.Rtubing_material     = result.Rows[0][33].ToString();
            item.Rkitchen_floor_space = result.Rows[0][34].ToString();
            item.Rhall_floor_space    = result.Rows[0][35].ToString();
            try { item.Rtotal_floor_space = Convert.ToDouble(result.Rows[0][36]); }
            catch { item.Rtotal_floor_space = 0; }
            item.Rceiling_height  = result.Rows[0][37].ToString();
            item.Rreference_point = result.Rows[0][38].ToString();
            try { item.Rfloor_space = Convert.ToDouble(result.Rows[0][39]); }
            catch { item.Rfloor_space = 0; }
            item.Rnote      = result.Rows[0][40].ToString();
            item.Rbackrooms = result.Rows[0][41].ToString();
            try { item.Rprice = Convert.ToDouble(result.Rows[0][42]); }
            catch { item.Rprice = 0; }
            try { item.Rprice_square = Convert.ToDouble(result.Rows[0][43]); }
            catch { item.Rprice_square = 0; }
            try { item.Ris_special_proposal = Convert.ToInt32(result.Rows[0][44]); }
            catch { item.Ris_special_proposal = 0; }
            try { item.Rchange_only = Convert.ToInt32(result.Rows[0][45]); }
            catch { item.Rchange_only = 0; }
            try { item.Rnewbuilding = Convert.ToInt32(result.Rows[0][46]); }
            catch { item.Rnewbuilding = 0; }
            try { item.Rhypothec = Convert.ToInt32(result.Rows[0][47]); }
            catch { item.Rhypothec = 0; }
            item.Ragent_code = result.Rows[0][48].ToString();
            try { item.Rdate_add = Convert.ToDateTime(result.Rows[0][49]); }
            catch { item.Rdate_add = DateTime.Now; }
            try { item.Rdate_change = Convert.ToDateTime(result.Rows[0][50]); }
            catch { item.Rdate_change = DateTime.Now; }
            item.Rstatus = result.Rows[0][51].ToString();
            try { item.Rtrade_date = Convert.ToDateTime(result.Rows[0][52]); }
            catch { item.Rtrade_date = DateTime.Now; }
            try { item.Rrent_price_day = Convert.ToDouble(result.Rows[0][53]); }
            catch { item.Rrent_price_day = 0; }
            try { item.Rrent_price_month = Convert.ToDouble(result.Rows[0][54]); }
            catch { item.Rrent_price_month = 0; }
            try { item.Raccount_in_rent = Convert.ToInt32(result.Rows[0][55]); }
            catch { item.Raccount_in_rent = 0; }
            item.Rbuilding_year  = result.Rows[0][56].ToString();
            item.Rroof           = result.Rows[0][57].ToString();
            item.Rterms_exchange = result.Rows[0][58].ToString();
            try { item.Rdistance_to_city = Convert.ToDouble(result.Rows[0][59]); }
            catch { item.Rdistance_to_city = 0; }
            try { item.Rground_area = Convert.ToDouble(result.Rows[0][60]); }
            catch { item.Rground_area = 0; }
            item.Rpurpose_use = result.Rows[0][61].ToString();
            item.Rbasement    = result.Rows[0][62].ToString();
            try { item.Rwindow_front_quantity = Convert.ToInt32(result.Rows[0][63]); }
            catch { item.Rwindow_front_quantity = 0; }
            item.Rmain_entrance_location = result.Rows[0][64].ToString();
            item.Rcommercial_outhouse    = result.Rows[0][65].ToString();
            item.Rsite_space             = result.Rows[0][66].ToString();
            item.Rsewerage       = result.Rows[0][67].ToString();
            item.Rphoto          = result.Rows[0][68].ToString();
            item.Roperation      = result.Rows[0][69].ToString();
            item.Rlavatory_basin = result.Rows[0][70].ToString();
            item.Rhouse_no       = result.Rows[0][71].ToString();
            item.Rblock_no       = result.Rows[0][72].ToString();
            item.Rflat_no        = result.Rows[0][73].ToString();
            try { item.RFridge = Convert.ToInt32(result.Rows[0][74]); }
            catch { item.RFridge = 0; }
            try { item.Rtrade_price = Convert.ToDouble(result.Rows[0][75]); }
            catch { item.Rtrade_price = 0; }
            con.Close();
            return(item);
        }
Exemple #4
0
        public void InsertNewEstate(estaterecord item)
        {
            string insertsql = String.Concat( "INSERT INTO realestate(Rcity, Rdistrict_region, Rstreet, Restate_type, Rfloor, Rnumber_of_storeys,",
                                  "Rroom_quantity, Rhaggle, Rproperty_type, Rtitle, Routhouse_legality, Ruse_for_office, Rdescription_short,",
                                  "Rbathroom_note, Rbathroom, Rwalling_type, Rkitchen_note, Rlevel_quantity, Rparking, Rdescription_detail,");
            insertsql = String.Concat(insertsql, "Rroom_layout, Rhouse_type, Rbalcony, Rloggia, Rwater_supply, Rgas_supply, Rcondition2, Rheat_supply,",
                                  "Rinterior_door_type, Rfront_door_type, Rwindow_material, Rtelephone, Rtubing_material, Rkitchen_floor_space,");
            insertsql = String.Concat(insertsql, "Rhall_floor_space, Rtotal_floor_space, Rceiling_height, Rreference_point, Rfloor_space, Rnote, Rbackrooms,",
                                  "Rprice, Rprice_square, Ris_special_proposal, Rchange_only, Rnewbuilding, Rhypothec, Ragent_code,");
            insertsql = String.Concat(insertsql, "Rdate_add, Rdate_change, Rstatus, Rtrade_date, Rrent_price_day, Rrent_price_month, Raccount_in_rent,",
                                  "Rbuilding_year, Rroof, Rterms_exchange, Rdistance_to_city, Rground_area, Rpurpose_use, Rbasement,");
            insertsql = String.Concat(insertsql, "Rwindow_front_quantity, Rmain_entrance_location, Rcommercial_outhouse, Rsite_space, Rsewerage, Rphoto,",
                                  "Roperation, Rlavatory_basin, Rhouse_no, Rblock_no, Rflat_no, RFridge, Rtrade_price) VALUES (@Rcity, @Rdistrict_region, @Rstreet,");
            insertsql = String.Concat(insertsql, "@Restate_type, @Rfloor, @Rnumber_of_storeys, @Rroom_quantity, @Rhaggle, @Rproperty_type, @Rtitle,",
                                  "@Routhouse_legality, @Ruse_for_office, @Rdescription_short, @Rbathroom_note, @Rbathroom, @Rwalling_type, @Rkitchen_note,");
            insertsql = String.Concat(insertsql, "@Rlevel_quantity, @Rparking, @Rdescription_detail, @Rroom_layout, @Rhouse_type, @Rbalcony, @Rloggia,",
                                  "@Rwater_supply, @Rgas_supply, @Rcondition2, @Rheat_supply, @Rinterior_door_type, @Rfront_door_type, @Rwindow_material, ");

            insertsql = String.Concat(insertsql, "@Rtelephone, @Rtubing_material, @Rkitchen_floor_space, @Rhall_floor_space, @Rtotal_floor_space,",
                                  "@Rceiling_height, @Rreference_point, @Rfloor_space, @Rnote, @Rbackrooms, @Rprice, @Rprice_square, @Ris_special_proposal,");
            insertsql = String.Concat(insertsql, "@Rchange_only, @Rnewbuilding, @Rhypothec, @Ragent_code, @Rdate_add, @Rdate_change, @Rstatus, @Rtrade_date,",
                                  "@Rrent_price_day, @Rrent_price_month, @Raccount_in_rent, @Rbuilding_year, @Rroof, @Rterms_exchange, @Rdistance_to_city,");
            insertsql = String.Concat(insertsql, "@Rground_area, @Rpurpose_use, @Rbasement, @Rwindow_front_quantity, @Rmain_entrance_location, @Rcommercial_outhouse,",
                                  "@Rsite_space, @Rsewerage, @Rphoto, @Roperation, @Rlavatory_basin, @Rhouse_no, @Rblock_no, @Rflat_no, @RFridge, @Rtrade_price)");

            MySqlConnection con = new MySqlConnection(ConnectionString);
            con.Open();
            MySqlCommand command = new MySqlCommand(insertsql, con);

            command.Parameters.AddWithValue("@Rcity", item.Rcity);
            command.Parameters.AddWithValue("@Rdistrict_region", item.Rdistrict_region);
            command.Parameters.AddWithValue("@Rstreet", item.Rstreet);
            command.Parameters.AddWithValue("@Restate_type", item.Restate_type);
            command.Parameters.AddWithValue("@Rfloor", item.Rfloor);
            command.Parameters.AddWithValue("@Rnumber_of_storeys", item.Rnumber_of_storeys);
            command.Parameters.AddWithValue("@Rroom_quantity", item.Rroom_quantity);
            command.Parameters.AddWithValue("@Rhaggle", item.Rhaggle);
            command.Parameters.AddWithValue("@Rproperty_type", item.Rproperty_type);
            command.Parameters.AddWithValue("@Rtitle", item.Rtitle);
            command.Parameters.AddWithValue("@Routhouse_legality", item.Routhouse_legality);
            command.Parameters.AddWithValue("@Ruse_for_office", item.Ruse_for_office);
            command.Parameters.AddWithValue("@Rdescription_short", item.Rdescription_short);
            command.Parameters.AddWithValue("@Rbathroom_note", item.Rbathroom_note);
            command.Parameters.AddWithValue("@Rbathroom", item.Rbathroom);
            command.Parameters.AddWithValue("@Rwalling_type", item.Rwalling_type);
            command.Parameters.AddWithValue("@Rkitchen_note", item.Rkitchen_note);
            command.Parameters.AddWithValue("@Rlevel_quantity", item.Rlevel_quantity);
            command.Parameters.AddWithValue("@Rparking", item.Rparking);
            command.Parameters.AddWithValue("@Rdescription_detail", item.Rdescription_detail);
            command.Parameters.AddWithValue("@Rroom_layout", item.Rroom_layout);
            command.Parameters.AddWithValue("@Rhouse_type", item.Rhouse_type);
            command.Parameters.AddWithValue("@Rbalcony", item.Rbalcony);
            command.Parameters.AddWithValue("@Rloggia", item.Rloggia);
            command.Parameters.AddWithValue("@Rwater_supply", item.Rwater_supply);
            command.Parameters.AddWithValue("@Rgas_supply", item.Rgas_supply);
            command.Parameters.AddWithValue("@Rcondition2", item.Rcondition2);
            command.Parameters.AddWithValue("@Rheat_supply", item.Rheat_supply);
            command.Parameters.AddWithValue("@Rinterior_door_type", item.Rinterior_door_type);
            command.Parameters.AddWithValue("@Rfront_door_type", item.Rfront_door_type);
            command.Parameters.AddWithValue("@Rwindow_material", item.Rwindow_material);
            command.Parameters.AddWithValue("@Rtelephone", item.Rtelephone);
            command.Parameters.AddWithValue("@Rtubing_material", item.Rtubing_material);
            command.Parameters.AddWithValue("@Rkitchen_floor_space", item.Rkitchen_floor_space);
            command.Parameters.AddWithValue("@Rhall_floor_space", item.Rhall_floor_space);
            command.Parameters.AddWithValue("@Rtotal_floor_space", item.Rtotal_floor_space);
            command.Parameters.AddWithValue("@Rceiling_height", item.Rceiling_height);
            command.Parameters.AddWithValue("@Rreference_point", item.Rreference_point);
            command.Parameters.AddWithValue("@Rfloor_space", item.Rfloor_space);
            command.Parameters.AddWithValue("@Rnote", item.Rnote);
            command.Parameters.AddWithValue("@Rbackrooms", item.Rbackrooms);
            command.Parameters.AddWithValue("@Rprice", item.Rprice);
            command.Parameters.AddWithValue("@Rprice_square", item.Rprice_square);
            command.Parameters.AddWithValue("@Ris_special_proposal", item.Ris_special_proposal);
            command.Parameters.AddWithValue("@Rchange_only", item.Rchange_only);
            command.Parameters.AddWithValue("@Rnewbuilding", item.Rnewbuilding);
            command.Parameters.AddWithValue("@Rhypothec", item.Rhypothec);
            command.Parameters.AddWithValue("@Ragent_code", item.Ragent_code);
            command.Parameters.AddWithValue("@Rdate_add", item.Rdate_add);
            command.Parameters.AddWithValue("@Rdate_change", item.Rdate_change);
            command.Parameters.AddWithValue("@Rstatus", item.Rstatus);
            command.Parameters.AddWithValue("@Rtrade_date", item.Rtrade_date);
            command.Parameters.AddWithValue("@Rrent_price_day", item.Rrent_price_day);
            command.Parameters.AddWithValue("@Rrent_price_month", item.Rrent_price_month);
            command.Parameters.AddWithValue("@Raccount_in_rent", item.Raccount_in_rent);
            command.Parameters.AddWithValue("@Rbuilding_year", item.Rbuilding_year);
            command.Parameters.AddWithValue("@Rroof", item.Rroof);
            command.Parameters.AddWithValue("@Rterms_exchange", item.Rterms_exchange);
            command.Parameters.AddWithValue("@Rdistance_to_city", item.Rdistance_to_city);
            command.Parameters.AddWithValue("@Rground_area", item.Rground_area);
            command.Parameters.AddWithValue("@Rpurpose_use", item.Rpurpose_use);
            command.Parameters.AddWithValue("@Rbasement", item.Rbasement);
            command.Parameters.AddWithValue("@Rwindow_front_quantity", item.Rwindow_front_quantity);
            command.Parameters.AddWithValue("@Rmain_entrance_location", item.Rmain_entrance_location);
            command.Parameters.AddWithValue("@Rcommercial_outhouse", item.Rcommercial_outhouse);
            command.Parameters.AddWithValue("@Rsite_space", item.Rsite_space);
            command.Parameters.AddWithValue("@Rsewerage", item.Rsewerage);
            command.Parameters.AddWithValue("@Rphoto", item.Rphoto);
            command.Parameters.AddWithValue("@Roperation", item.Roperation);
            command.Parameters.AddWithValue("@Rlavatory_basin", item.Rlavatory_basin);
            command.Parameters.AddWithValue("@Rhouse_no", item.Rhouse_no);
            command.Parameters.AddWithValue("@Rblock_no", item.Rblock_no);
            command.Parameters.AddWithValue("@Rflat_no", item.Rflat_no);
            command.Parameters.AddWithValue("@RFridge", item.RFridge);
            command.Parameters.AddWithValue("@Rtrade_price", item.Rtrade_price);

            command.ExecuteNonQuery();
            int id = Convert.ToInt32(command.LastInsertedId);

            //add photo upload and comments insertion

            con.Close();
        }
Exemple #5
0
        public editform()
        {
            InitializeComponent();
            dbvals = new Photos("");
            dbw = new DBWrap();
            record = new estaterecord();
            dbw.LoadAddressBase();
            dbcomm = new Comments();
            newrecord = true;
            dbvals.LoadImagesFromURLs();

            foreach (string value in dbw.balconyValues)
                balcony.Properties.Items.Add(value, CheckState.Unchecked, true);
            foreach (string value in dbw.loggiaValues)
                loggia.Properties.Items.Add(value, CheckState.Unchecked, true);

            comboBox5.Items.AddRange(dbw.housetypeValues);
            comboBox5.SelectedIndex = 12;
            comboBox6.Items.AddRange(dbw.wallValues);
            comboBox6.SelectedIndex = 1;
            comboBox7.Items.AddRange(dbw.roomlayoutValues);
            comboBox7.SelectedIndex = 4;
            comboBox14.Items.AddRange(dbw.phoneValues);
            comboBox14.SelectedIndex = 0;
               // comboBox15.Items.AddRange(roomlayoutValues);
               //  comboBox15.SelectedIndex = 4;
            comboBox12.Items.AddRange(dbw.conditionValues);
            comboBox12.SelectedIndex = 1;
            comboBox8.Items.AddRange(dbw.maindoorValues);
            comboBox8.SelectedIndex = 1;
            comboBox13.Items.AddRange(dbw.propertyValues);
            comboBox13.SelectedIndex = 7;
            comboBox9.Items.AddRange(dbw.windowValues);
            comboBox9.SelectedIndex = 4;
            comboBox10.Items.AddRange(dbw.doorValues);
            comboBox10.SelectedIndex = 0;
            comboBox11.Items.AddRange(dbw.sewerageValues);
            comboBox11.SelectedIndex = 0;
            comboBox16.Items.AddRange(dbw.tubeValues);
            comboBox16.SelectedIndex = 2;
            comboBox19.Items.AddRange(dbw.estateValues);
            comboBox19.SelectedIndex = 0;
            comboBox17.Items.AddRange(dbw.operationValues);
            comboBox17.SelectedIndex = 0;
            comboBox18.Items.AddRange(dbw.stateValues);
            comboBox18.SelectedIndex = 0;

            textBox9.Text = "1";
            textBox8.Text = "1";
            textBox10.Text = "1";
            textBox11.Text = "1";

            textBox12.Text = "0";
            textBox13.Text = "0";
            textBox14.Text = "0";
            textBox15.Text = "0";
            textBox16.Text = "2.5";

            // Specify the separator character.
            balcony.Properties.SeparatorChar = ',';
            loggia.Properties.SeparatorChar = ',';
            listBox2.Items.Clear();
            for (int i = 0; i < dbvals.photolist.Count;i++)
            { listBox2.Items.Add(dbvals.photolist[i]); }
            listBox2.DisplayMember = "Name";
            if (listBox2.Items.Count > 0) { listBox2.SelectedIndex = 1; }
            if (dbvals.photolist.Count>0) pictureEdit1.Image = (dbvals.photolist[0] as Img).Picture;
            comboBox2.DataSource = dbw.district;
            comboBox2.DisplayMember = dbw.district.Columns[1].ColumnName;
            comboBox3.DataSource = dbw.town;
            comboBox3.DisplayMember = dbw.town.Columns[1].ColumnName;
            comboBox4.DataSource = dbw.street;
            comboBox4.DisplayMember = dbw.street.Columns[0].ColumnName;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 2;
            comboBox4.SelectedIndex = 0;
            comboBox2.BindingContext = this.BindingContext;
            comboBox3.BindingContext = this.BindingContext;
            comboBox4.BindingContext = this.BindingContext;
        }
Exemple #6
0
        public void UpdateEstate(estaterecord item)
        {
            string updatesql = @"UPDATE realestate SET Rcity = @Rcity, Rdistrict_region = @Rdistrict_region, Rstreet = @Rstreet, Restate_type = @Restate_type, Rfloor = @Rfloor,
                                 Rnumber_of_storeys = @Rnumber_of_storeys, Rroom_quantity = @Rroom_quantity, Rhaggle = @Rhaggle, Rproperty_type = @Rproperty_type, Rtitle = @Rtitle,
                                 Routhouse_legality = @Routhouse_legality, Ruse_for_office = @Ruse_for_office, Rdescription_short = @Rdescription_short, Rbathroom_note = @Rbathroom_note,
                                 Rbathroom = @Rbathroom, Rbathroom_note = @Rbathroom_note, Rwalling_type = @Rwalling_type, Rkitchen_note = @Rkitchen_note, Rlevel_quantity = @Rlevel_quantity,
                                 Rparking = @Rparking, Rdescription_detail = @Rdescription_detail, Rroom_layout = @Rroom_layout, Rhouse_type = @Rhouse_type, Rbalcony = @Rbalcony, Rloggia = @Rloggia,
                                 Rwater_supply = @Rwater_supply, Rgas_supply = @Rgas_supply, Rcondition2 = @Rcondition2, Rheat_supply = @Rheat_supply, Rinterior_door_type = @Rinterion_door_type,
                                 Rfront_door_type = @Rfront_door_type, Rwindow_material = @Rwindow_material, Rtelephone = @Rtelephone, Rtubing_material = @Rtubing_material,
                                 Rkitchen_floor_space = @Rkitchen_floor_space, Rhall_floor_space = @Rhall_floor_space, Rtotal_floor_space = @Rtotal_floor_space, Rceiling_height = @Rceiling_height,
                                 Rreference_point = @Rreference_point, Rfloor_space = Rfloor_space, Rnote = @Rnote, Rbackrooms = @Rbackrooms, Rprice = @Rprice, Rprice_square = @Rprice_square,
                                 Ris_special_proposal = @Ris_special_proposal, Rchange_only = @Rchange_only, Rnewbuilding = @Rnewbuilding, Rhypothec = @Rhypothec, Ragent_code = @Ragent_code,
                                 Rdate_add = @Rdate_add, Rdate_change = @Rdate_change, Rstatus = @Rstatus, Rtrade_date = @Rtrade_date, Rrent_price_day = @Rrent_price_day,
                                 Rrent_price_month = @Rrent_price_month, Raccount_in_rent = @Raccount_in_rent, Rbuilding_year = @Rbuilding_year, Rroof = @Rroof, Rterms_exchange = @Rterms_exchange,
                                 Rdistance_to_city = @Rdistance_to_city, Rground_area = @Rground_area, Rpurpose_use = @Rpurpose_use, Rbasement = @Rbasement, Rwindow_front_quantity = @Rwindow_front_quantity,
                                 Rmain_entrance_location = @Rmain_entrance_location, Rcommercial_outhouse = @Rcommercial_outhouse, Rsite_space = @Rsite_space, Rsewerage = @Rsewerage, Rphoto = @Rphoto,
                                 Roperation = @Roperation, Rlavatory_basin = @Rlavatory_basin, Rhouse_no= @Rhouse_no, Rblock_no = @Rblock_no, Rflat_no = @Rflat_no, RFridge = @Rfridge, Rtrade_price = @Rtrade_price WHERE Rid = @Rid ";

            MySqlConnection con = new MySqlConnection(ConnectionString);
            con.Open();
            MySqlCommand command = new MySqlCommand(updatesql, con);

            command.Parameters.AddWithValue("@Rcity", item.Rcity);
            command.Parameters.AddWithValue("@Rdistrict_region", item.Rdistrict_region);
            command.Parameters.AddWithValue("@Rstreet", item.Rstreet);
            command.Parameters.AddWithValue("@Restate_type", item.Restate_type);
            command.Parameters.AddWithValue("@Rfloor", item.Rfloor);
            command.Parameters.AddWithValue("@Rnumber_of_storeys", item.Rnumber_of_storeys);
            command.Parameters.AddWithValue("@Rroom_quantity", item.Rroom_quantity);
            command.Parameters.AddWithValue("@Rhaggle", item.Rhaggle);
            command.Parameters.AddWithValue("@Rproperty_type", item.Rproperty_type);
            command.Parameters.AddWithValue("@Rtitle", item.Rtitle);
            command.Parameters.AddWithValue("@Routhouse_legality", item.Routhouse_legality);
            command.Parameters.AddWithValue("@Ruse_for_office", item.Ruse_for_office);
            command.Parameters.AddWithValue("@Rdescription_short", item.Rdescription_short);
            command.Parameters.AddWithValue("@Rbathroom_note", item.Rbathroom_note);
            command.Parameters.AddWithValue("@Rbathroom", item.Rbathroom);
            command.Parameters.AddWithValue("@Rwalling_type", item.Rwalling_type);
            command.Parameters.AddWithValue("@Rkitchen_note", item.Rkitchen_note);
            command.Parameters.AddWithValue("@Rlevel_quantity", item.Rlevel_quantity);
            command.Parameters.AddWithValue("@Rparking", item.Rparking);
            command.Parameters.AddWithValue("@Rdescription_detail", item.Rdescription_detail);
            command.Parameters.AddWithValue("@Rroom_layout", item.Rroom_layout);
            command.Parameters.AddWithValue("@Rhouse_type", item.Rhouse_type);
            command.Parameters.AddWithValue("@Rbalcony", item.Rbalcony);
            command.Parameters.AddWithValue("@Rloggia", item.Rloggia);
            command.Parameters.AddWithValue("@Rwater_supply", item.Rwater_supply);
            command.Parameters.AddWithValue("@Rgas_supply", item.Rgas_supply);
            command.Parameters.AddWithValue("@Rcondition2", item.Rcondition2);
            command.Parameters.AddWithValue("@Rheat_supply", item.Rheat_supply);
            command.Parameters.AddWithValue("@Rinterior_door_type", item.Rinterior_door_type);
            command.Parameters.AddWithValue("@Rfront_door_type", item.Rfront_door_type);
            command.Parameters.AddWithValue("@Rwindow_material", item.Rwindow_material);
            command.Parameters.AddWithValue("@Rtelephone", item.Rtelephone);
            command.Parameters.AddWithValue("@Rtubing_material", item.Rtubing_material);
            command.Parameters.AddWithValue("@Rkitchen_floor_space", item.Rkitchen_floor_space);
            command.Parameters.AddWithValue("@Rhall_floor_space", item.Rhall_floor_space);
            command.Parameters.AddWithValue("@Rtotal_floor_space", item.Rtotal_floor_space);
            command.Parameters.AddWithValue("@Rceiling_height", item.Rceiling_height);
            command.Parameters.AddWithValue("@Rreference_point", item.Rreference_point);
            command.Parameters.AddWithValue("@Rfloor_space", item.Rfloor_space);
            command.Parameters.AddWithValue("@Rnote", item.Rnote);
            command.Parameters.AddWithValue("@Rbackrooms", item.Rbackrooms);
            command.Parameters.AddWithValue("@Rprice", item.Rprice);
            command.Parameters.AddWithValue("@Rprice_square", item.Rprice_square);
            command.Parameters.AddWithValue("@Ris_special_proposal", item.Ris_special_proposal);
            command.Parameters.AddWithValue("@Rchange_only", item.Rchange_only);
            command.Parameters.AddWithValue("@Rnewbuilding", item.Rnewbuilding);
            command.Parameters.AddWithValue("@Rhypothec", item.Rhypothec);
            command.Parameters.AddWithValue("@Ragent_code", item.Ragent_code);
            command.Parameters.AddWithValue("@Rdate_add", item.Rdate_add);
            command.Parameters.AddWithValue("@Rdate_change", item.Rdate_change);
            command.Parameters.AddWithValue("@Rstatus", item.Rstatus);
            command.Parameters.AddWithValue("@Rtrade_date", item.Rtrade_date);
            command.Parameters.AddWithValue("@Rrent_price_day", item.Rrent_price_day);
            command.Parameters.AddWithValue("@Rrent_price_month", item.Rrent_price_month);
            command.Parameters.AddWithValue("@Raccount_in_rent", item.Raccount_in_rent);
            command.Parameters.AddWithValue("@Rbuilding_year", item.Rbuilding_year);
            command.Parameters.AddWithValue("@Rroof", item.Rroof);
            command.Parameters.AddWithValue("@Rterms_exchange", item.Rterms_exchange);
            command.Parameters.AddWithValue("@Rdistance_to_city", item.Rdistance_to_city);
            command.Parameters.AddWithValue("@Rground_area", item.Rground_area);
            command.Parameters.AddWithValue("@Rpurpose_use", item.Rpurpose_use);
            command.Parameters.AddWithValue("@Rbasement", item.Rbasement);
            command.Parameters.AddWithValue("@Rwindow_front_quantity", item.Rwindow_front_quantity);
            command.Parameters.AddWithValue("@Rmain_entrance_location", item.Rmain_entrance_location);
            command.Parameters.AddWithValue("@Rcommercial_outhouse", item.Rcommercial_outhouse);
            command.Parameters.AddWithValue("@Rsite_space", item.Rsite_space);
            command.Parameters.AddWithValue("@Rsewerage", item.Rsewerage);
            command.Parameters.AddWithValue("@Rphoto", item.Rphoto);
            command.Parameters.AddWithValue("@Roperation", item.Roperation);
            command.Parameters.AddWithValue("@Rlavatory_basin", item.Rlavatory_basin);
            command.Parameters.AddWithValue("@Rhouse_no", item.Rhouse_no);
            command.Parameters.AddWithValue("@Rblock_no", item.Rblock_no);
            command.Parameters.AddWithValue("@Rflat_no", item.Rflat_no);
            command.Parameters.AddWithValue("@RFridge", item.RFridge);
            command.Parameters.AddWithValue("@Rid", item.Rid);
            command.Parameters.AddWithValue("@Rtrade_price", item.Rid);

            command.ExecuteNonQuery();
            //add photo upload and comments insertion
            con.Close();
        }
Exemple #7
0
 public estaterecord ReadEstate(string itemid)
 {
     estaterecord item = new estaterecord();
     string selectsql = String.Concat("SELECT * FROM realestate WHERE Rid ='", itemid, "'");
     MySqlConnection con = new MySqlConnection(ConnectionString);
     con.Open();
     MySqlCommand command = new MySqlCommand(selectsql, con);
     MySqlDataReader reader = command.ExecuteReader();
     DataTable result = new DataTable();
     result.Load(reader);
     item.Rid = Convert.ToInt32(itemid);
     item.Rcity = result.Rows[0][1].ToString();
     item.Rdistrict_region = result.Rows[0][2].ToString();
     item.Rstreet= result.Rows[0][3].ToString();
     item.Restate_type = result.Rows[0][4].ToString();
     try { item.Rfloor = Convert.ToInt32(result.Rows[0][5]);}
     catch { item.Rfloor = 0; }
     try { item.Rnumber_of_storeys = Convert.ToInt32(result.Rows[0][6]); }
     catch { item.Rnumber_of_storeys = 0; }
     try { item.Rroom_quantity = Convert.ToInt32(result.Rows[0][7]); }
     catch { item.Rroom_quantity = 1; }
     try { item.Rhaggle = Convert.ToInt32(result.Rows[0][8]); }
     catch { item.Rhaggle = 0; }
     item.Rproperty_type = result.Rows[0][9].ToString();
     item.Rtitle = result.Rows[0][10].ToString();
     try { item.Routhouse_legality = Convert.ToInt32(result.Rows[0][11]); }
     catch { item.Routhouse_legality = 0; }
     try { item.Ruse_for_office = Convert.ToInt32(result.Rows[0][12]); }
     catch { item.Ruse_for_office = 0; }
     item.Rdescription_short = result.Rows[0][13].ToString();
     item.Rbathroom_note = result.Rows[0][14].ToString();
     item.Rbathroom = result.Rows[0][15].ToString();
     item.Rwalling_type = result.Rows[0][16].ToString();
     item.Rkitchen_note = result.Rows[0][17].ToString();
     try { item.Rlevel_quantity = Convert.ToInt32(result.Rows[0][18]); }
     catch { item.Rlevel_quantity = 0; }
     try { item.Rparking = Convert.ToInt32(result.Rows[0][19]); }
     catch { item.Rparking = 0; }
     item.Rdescription_detail = result.Rows[0][20].ToString();
     item.Rroom_layout = result.Rows[0][21].ToString();
     item.Rhouse_type = result.Rows[0][22].ToString();
     item.Rbalcony = result.Rows[0][23].ToString();
     item.Rloggia = result.Rows[0][24].ToString();
     item.Rwater_supply = result.Rows[0][25].ToString();
     item.Rgas_supply = result.Rows[0][26].ToString();
     item.Rcondition2 = result.Rows[0][27].ToString();
     item.Rheat_supply = result.Rows[0][28].ToString();
     item.Rinterior_door_type = result.Rows[0][29].ToString();
     item.Rfront_door_type = result.Rows[0][30].ToString();
     item.Rwindow_material = result.Rows[0][31].ToString();
     item.Rtelephone = result.Rows[0][32].ToString();
     item.Rtubing_material = result.Rows[0][33].ToString();
     item.Rkitchen_floor_space = result.Rows[0][34].ToString();
     item.Rhall_floor_space = result.Rows[0][35].ToString();
     try { item.Rtotal_floor_space = Convert.ToDouble(result.Rows[0][36]); }
     catch { item.Rtotal_floor_space = 0; }
     item.Rceiling_height = result.Rows[0][37].ToString();
     item.Rreference_point = result.Rows[0][38].ToString();
     try { item.Rfloor_space = Convert.ToDouble(result.Rows[0][39]); }
     catch { item.Rfloor_space = 0; }
     item.Rnote = result.Rows[0][40].ToString();
     item.Rbackrooms = result.Rows[0][41].ToString();
     try { item.Rprice = Convert.ToDouble(result.Rows[0][42]); }
     catch { item.Rprice = 0; }
     try { item.Rprice_square = Convert.ToDouble(result.Rows[0][43]); }
     catch { item.Rprice_square = 0; }
     try { item.Ris_special_proposal = Convert.ToInt32(result.Rows[0][44]); }
     catch { item.Ris_special_proposal = 0; }
     try { item.Rchange_only = Convert.ToInt32(result.Rows[0][45]); }
     catch { item.Rchange_only = 0; }
     try { item.Rnewbuilding = Convert.ToInt32(result.Rows[0][46]); }
     catch { item.Rnewbuilding = 0; }
     try { item.Rhypothec = Convert.ToInt32(result.Rows[0][47]); }
     catch { item.Rhypothec = 0; }
     item.Ragent_code = result.Rows[0][48].ToString();
     try { item.Rdate_add = Convert.ToDateTime(result.Rows[0][49]); }
     catch { item.Rdate_add = DateTime.Now; }
     try { item.Rdate_change = Convert.ToDateTime(result.Rows[0][50]); }
     catch { item.Rdate_change = DateTime.Now; }
     item.Rstatus = result.Rows[0][51].ToString();
     try { item.Rtrade_date = Convert.ToDateTime(result.Rows[0][52]); }
     catch { item.Rtrade_date = DateTime.Now; }
     try { item.Rrent_price_day = Convert.ToDouble(result.Rows[0][53]); }
     catch { item.Rrent_price_day = 0; }
     try { item.Rrent_price_month = Convert.ToDouble(result.Rows[0][54]); }
     catch { item.Rrent_price_month = 0; }
     try { item.Raccount_in_rent = Convert.ToInt32(result.Rows[0][55]); }
     catch { item.Raccount_in_rent = 0; }
     item.Rbuilding_year = result.Rows[0][56].ToString();
     item.Rroof = result.Rows[0][57].ToString();
     item.Rterms_exchange = result.Rows[0][58].ToString();
     try { item.Rdistance_to_city = Convert.ToDouble(result.Rows[0][59]); }
     catch { item.Rdistance_to_city = 0; }
     try { item.Rground_area = Convert.ToDouble(result.Rows[0][60]); }
     catch { item.Rground_area = 0; }
     item.Rpurpose_use = result.Rows[0][61].ToString();
     item.Rbasement = result.Rows[0][62].ToString();
     try { item.Rwindow_front_quantity = Convert.ToInt32(result.Rows[0][63]); }
     catch { item.Rwindow_front_quantity = 0; }
     item.Rmain_entrance_location = result.Rows[0][64].ToString();
     item.Rcommercial_outhouse = result.Rows[0][65].ToString();
     item.Rsite_space = result.Rows[0][66].ToString();
     item.Rsewerage = result.Rows[0][67].ToString();
     item.Rphoto = result.Rows[0][68].ToString();
     item.Roperation = result.Rows[0][69].ToString();
     item.Rlavatory_basin = result.Rows[0][70].ToString();
     item.Rhouse_no = result.Rows[0][71].ToString();
     item.Rblock_no = result.Rows[0][72].ToString();
     item.Rflat_no = result.Rows[0][73].ToString();
     try { item.RFridge = Convert.ToInt32(result.Rows[0][74]); }
     catch { item.RFridge = 0; }
     try { item.Rtrade_price = Convert.ToDouble(result.Rows[0][75]); }
     catch { item.Rtrade_price = 0; }
     con.Close();
     return item;
 }
Exemple #8
0
        public editform()
        {
            InitializeComponent();
            dbvals = new Photos("");
            dbw    = new DBWrap();
            record = new estaterecord();
            dbw.LoadAddressBase();
            dbcomm    = new Comments();
            newrecord = true;
            dbvals.LoadImagesFromURLs();

            foreach (string value in dbw.balconyValues)
            {
                balcony.Properties.Items.Add(value, CheckState.Unchecked, true);
            }
            foreach (string value in dbw.loggiaValues)
            {
                loggia.Properties.Items.Add(value, CheckState.Unchecked, true);
            }

            comboBox5.Items.AddRange(dbw.housetypeValues);
            comboBox5.SelectedIndex = 12;
            comboBox6.Items.AddRange(dbw.wallValues);
            comboBox6.SelectedIndex = 1;
            comboBox7.Items.AddRange(dbw.roomlayoutValues);
            comboBox7.SelectedIndex = 4;
            comboBox14.Items.AddRange(dbw.phoneValues);
            comboBox14.SelectedIndex = 0;
            // comboBox15.Items.AddRange(roomlayoutValues);
            //  comboBox15.SelectedIndex = 4;
            comboBox12.Items.AddRange(dbw.conditionValues);
            comboBox12.SelectedIndex = 1;
            comboBox8.Items.AddRange(dbw.maindoorValues);
            comboBox8.SelectedIndex = 1;
            comboBox13.Items.AddRange(dbw.propertyValues);
            comboBox13.SelectedIndex = 7;
            comboBox9.Items.AddRange(dbw.windowValues);
            comboBox9.SelectedIndex = 4;
            comboBox10.Items.AddRange(dbw.doorValues);
            comboBox10.SelectedIndex = 0;
            comboBox11.Items.AddRange(dbw.sewerageValues);
            comboBox11.SelectedIndex = 0;
            comboBox16.Items.AddRange(dbw.tubeValues);
            comboBox16.SelectedIndex = 2;
            comboBox19.Items.AddRange(dbw.estateValues);
            comboBox19.SelectedIndex = 0;
            comboBox17.Items.AddRange(dbw.operationValues);
            comboBox17.SelectedIndex = 0;
            comboBox18.Items.AddRange(dbw.stateValues);
            comboBox18.SelectedIndex = 0;

            textBox9.Text  = "1";
            textBox8.Text  = "1";
            textBox10.Text = "1";
            textBox11.Text = "1";

            textBox12.Text = "0";
            textBox13.Text = "0";
            textBox14.Text = "0";
            textBox15.Text = "0";
            textBox16.Text = "2.5";


            // Specify the separator character.
            balcony.Properties.SeparatorChar = ',';
            loggia.Properties.SeparatorChar  = ',';
            listBox2.Items.Clear();
            for (int i = 0; i < dbvals.photolist.Count; i++)
            {
                listBox2.Items.Add(dbvals.photolist[i]);
            }
            listBox2.DisplayMember = "Name";
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 1;
            }
            if (dbvals.photolist.Count > 0)
            {
                pictureEdit1.Image = (dbvals.photolist[0] as Img).Picture;
            }
            comboBox2.DataSource     = dbw.district;
            comboBox2.DisplayMember  = dbw.district.Columns[1].ColumnName;
            comboBox3.DataSource     = dbw.town;
            comboBox3.DisplayMember  = dbw.town.Columns[1].ColumnName;
            comboBox4.DataSource     = dbw.street;
            comboBox4.DisplayMember  = dbw.street.Columns[0].ColumnName;
            comboBox2.SelectedIndex  = 0;
            comboBox3.SelectedIndex  = 2;
            comboBox4.SelectedIndex  = 0;
            comboBox2.BindingContext = this.BindingContext;
            comboBox3.BindingContext = this.BindingContext;
            comboBox4.BindingContext = this.BindingContext;
        }
Exemple #9
0
        //int operation;

        public editform(string id, bool rent, bool isadmin)
        {
            InitializeComponent();
            dbvals = new Photos("http://tamarrra.net/img1/esterne201755292010175841_big.jpg;http://tamarrra.net/img1/esterne201755302010175843_big.jpg;http://tamarrra.net/img1/esterne201755312010175845_big.jpg");
            dbw    = new DBWrap();
            estaterecord record = dbw.ReadEstate(id);

            dbw.LoadAddressBase();
            dbcomm    = new Comments();
            newrecord = true;
            dbvals.LoadImagesFromURLs();

            rieltorname.Text  = record.Ragent_code;
            buildingtype.Text = record.Rhouse_type;
            material.Text     = record.Rwalling_type;
            planning.Text     = record.Rroom_layout;
            phone.Text        = record.Rtelephone;
            condition.Text    = record.Rcondition2;
            maindoor.Text     = record.Rfront_door_type;
            ownertype.Text    = record.Rproperty_type;
            windows.Text      = record.Rwindow_material;
            doors.Text        = record.Rinterior_door_type;
            canalization.Text = record.Rsewerage;
            tubes.Text        = record.Rtubing_material;
            code.Text         = record.Restate_type;
            label89.Text      = record.Roperation;
            label91.Text      = record.Rstatus;

            dateTimePicker3.Value = record.Rdate_add;
            dateTimePicker4.Value = record.Rdate_change;
            dateTimePicker6.Value = record.Rtrade_date;

            dateTimePicker3.Enabled = false;
            dateTimePicker4.Enabled = false;
            dateTimePicker6.Enabled = false;

            floor.Text      += record.Rfloor.ToString();
            rooms.Text       = record.Rroom_quantity.ToString();
            totalfloor.Text += record.Rnumber_of_storeys.ToString();
            label70.Text     = record.Rlevel_quantity.ToString();

            totalarea.Text   = record.Rtotal_floor_space.ToString() + " м2";
            livingarea.Text  = record.Rfloor_space.ToString() + " м2";
            hallarea.Text    = record.Rhall_floor_space + " м2";
            kitchenarea.Text = record.Rkitchen_floor_space + " м2";
            high.Text        = record.Rceiling_height + " м";

            district.Text = record.Rdistrict_region + " ," + record.Rcity;
            if (record.Rblock_no == "")
            {
                street.Text = record.Rstreet + " ," + func.Decrypt(record.Rhouse_no, func.fkey);
            }
            else
            {
                street.Text = record.Rstreet + " ," + func.Decrypt(record.Rhouse_no, func.fkey) + "/" + func.Decrypt(record.Rblock_no, func.fkey);
            }
            orient.Text = func.Decrypt(record.Rflat_no, func.fkey);

            if (record.Rhaggle == 1)
            {
                checkBox47.Checked = true;
            }
            if (record.Ruse_for_office == 1)
            {
                checkBox48.Checked = true;
            }
            if (record.Rparking == 1)
            {
                checkBox45.Checked = true;
            }
            if (record.Routhouse_legality == 1)
            {
                checkBox46.Checked = true;
            }
            if (record.RFridge == 1)
            {
                checkBox26.Checked = true;
            }

            if (rent)
            {
                checkBox46.Visible = false;
                checkBox26.Visible = true;
                checkBox46.Enabled = false;
                checkBox26.Enabled = true;
                checkBox26.Left    = 530;
                checkBox26.Top     = 51;
            }
            else
            {
                checkBox46.Visible = true;
                checkBox26.Visible = false;
                checkBox46.Enabled = true;
                checkBox26.Enabled = false;
                checkBox46.Left    = 530;
                checkBox46.Top     = 51;
            }

            bath.Text     = record.Rbathroom_note;
            kitchen.Text  = record.Rkitchen_note;
            backroom.Text = record.Rbackrooms;
            stuff.Text    = record.Rnote;

            description.Text = record.Rdescription_detail;

            gas.Text     = record.Rgas_supply;
            warm.Text    = record.Rheat_supply;
            water.Text   = record.Rwater_supply;
            balcon.Text  = record.Rbalcony;
            logja.Text   = record.Rloggia;
            lootype.Text = record.Rbathroom;

            price.Text = record.Rprice.ToString();
            if (rent)
            {
                dayprice.Text   = record.Rrent_price_day.ToString();
                monthprice.Text = record.Rrent_price_month.ToString();
            }
            else
            {
                dayprice.Visible   = false;
                monthprice.Visible = false;
                label76.Visible    = false;
                label77.Visible    = false;
            }
            label81.Text = record.Rtrade_price.ToString();
            //item.Ragent_code = result.Rows[0][48].ToString();

            listBox2.Items.Clear();
            listView1.Items.Clear();

            for (int i = 0; i < dbvals.photolist.Count; i++)
            {
                listBox2.Items.Add(dbvals.photolist[i]);
            }
            listBox2.DisplayMember = "Name";
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 1;
            }
            pictureEdit1.Image = (dbvals.photolist[1] as Img).Picture;

            simpleButton3.Visible = false;
            simpleButton4.Visible = false;
            simpleButton8.Visible = false;
            checkBox25.Visible    = false;
            textBox21.Enabled     = false;

            addphotos.Visible     = false;
            simpleButton7.Visible = false;
        }
Exemple #10
0
        public editform(string id, bool rent)
        {
            InitializeComponent();
            dbvals = new Photos("http://tamarrra.net/img1/esterne201755292010175841_big.jpg;http://tamarrra.net/img1/esterne201755302010175843_big.jpg;http://tamarrra.net/img1/esterne201755312010175845_big.jpg");
            dbw    = new DBWrap();
            estaterecord record = dbw.ReadEstate(id);

            dbw.LoadAddressBase();
            dbcomm    = new Comments();
            newrecord = true;
            dbvals.LoadImagesFromURLs();

            foreach (string value in dbw.balconyValues)
            {
                balcony.Properties.Items.Add(value, CheckState.Unchecked, true);
            }
            foreach (string value in dbw.loggiaValues)
            {
                loggia.Properties.Items.Add(value, CheckState.Unchecked, true);
            }

            // Specify the separator character.
            balcony.Properties.SeparatorChar = ',';
            loggia.Properties.SeparatorChar  = ',';

            comboBox5.Items.AddRange(dbw.housetypeValues);
            for (int i = 0; i < dbw.housetypeValues.Length; i++)
            {
                if (record.Rhouse_type == dbw.housetypeValues[i])
                {
                    comboBox5.SelectedIndex = i; i = dbw.housetypeValues.Length;
                }
            }

            comboBox6.Items.AddRange(dbw.wallValues);
            for (int i = 0; i < dbw.wallValues.Length; i++)
            {
                if (record.Rwalling_type == dbw.wallValues[i])
                {
                    comboBox6.SelectedIndex = i; i = dbw.wallValues.Length;
                }
            }

            comboBox7.Items.AddRange(dbw.roomlayoutValues);
            for (int i = 0; i < dbw.roomlayoutValues.Length; i++)
            {
                if (record.Rroom_layout == dbw.roomlayoutValues[i])
                {
                    comboBox7.SelectedIndex = i; i = dbw.roomlayoutValues.Length;
                }
            }

            comboBox14.Items.AddRange(dbw.phoneValues);
            for (int i = 0; i < dbw.phoneValues.Length; i++)
            {
                if (record.Rtelephone == dbw.phoneValues[i])
                {
                    comboBox14.SelectedIndex = i; i = dbw.phoneValues.Length;
                }
            }

            comboBox12.Items.AddRange(dbw.conditionValues);
            for (int i = 0; i < dbw.conditionValues.Length; i++)
            {
                if (record.Rcondition2 == dbw.conditionValues[i])
                {
                    comboBox12.SelectedIndex = i; i = dbw.conditionValues.Length;
                }
            }

            comboBox8.Items.AddRange(dbw.maindoorValues);
            for (int i = 0; i < dbw.maindoorValues.Length; i++)
            {
                if (record.Rfront_door_type == dbw.maindoorValues[i])
                {
                    comboBox8.SelectedIndex = i; i = dbw.maindoorValues.Length;
                }
            }

            comboBox13.Items.AddRange(dbw.propertyValues);
            for (int i = 0; i < dbw.propertyValues.Length; i++)
            {
                if (record.Rproperty_type == dbw.propertyValues[i])
                {
                    comboBox13.SelectedIndex = i; i = dbw.propertyValues.Length;
                }
            }

            comboBox9.Items.AddRange(dbw.windowValues);
            for (int i = 0; i < dbw.windowValues.Length; i++)
            {
                if (record.Rwindow_material == dbw.windowValues[i])
                {
                    comboBox9.SelectedIndex = i; i = dbw.windowValues.Length;
                }
            }

            comboBox10.Items.AddRange(dbw.doorValues);
            for (int i = 0; i < dbw.doorValues.Length; i++)
            {
                if (record.Rinterior_door_type == dbw.doorValues[i])
                {
                    comboBox10.SelectedIndex = i; i = dbw.doorValues.Length;
                }
            }

            comboBox11.Items.AddRange(dbw.sewerageValues);
            for (int i = 0; i < dbw.sewerageValues.Length; i++)
            {
                if (record.Rsewerage == dbw.sewerageValues[i])
                {
                    comboBox11.SelectedIndex = i; i = dbw.sewerageValues.Length;
                }
            }

            comboBox16.Items.AddRange(dbw.tubeValues);
            for (int i = 0; i < dbw.tubeValues.Length; i++)
            {
                if (record.Rtubing_material == dbw.tubeValues[i])
                {
                    comboBox16.SelectedIndex = i; i = dbw.tubeValues.Length;
                }
            }

            comboBox19.Items.AddRange(dbw.estateValues);
            for (int i = 0; i < dbw.estateValues.Length; i++)
            {
                if (record.Restate_type == dbw.estateValues[i])
                {
                    comboBox19.SelectedIndex = i; i = dbw.estateValues.Length;
                }
            }

            comboBox17.Items.AddRange(dbw.operationValues);
            for (int i = 0; i < dbw.operationValues.Length; i++)
            {
                if (record.Roperation == dbw.operationValues[i])
                {
                    comboBox17.SelectedIndex = i; i = dbw.operationValues.Length;
                }
            }

            comboBox18.Items.AddRange(dbw.stateValues);
            for (int i = 0; i < dbw.stateValues.Length; i++)
            {
                if (record.Rstatus == dbw.stateValues[i])
                {
                    comboBox18.SelectedIndex = i; i = dbw.stateValues.Length;
                }
            }

            dateTimePicker2.Value = record.Rdate_add;
            dateTimePicker1.Value = record.Rdate_change;
            dateTimePicker5.Value = record.Rtrade_date;

            textBox9.Text  = record.Rfloor.ToString();
            textBox8.Text  = record.Rroom_quantity.ToString();
            textBox10.Text = record.Rnumber_of_storeys.ToString();
            textBox11.Text = record.Rlevel_quantity.ToString();

            textBox12.Text = record.Rtotal_floor_space.ToString();
            textBox13.Text = record.Rfloor_space.ToString();
            textBox14.Text = record.Rhall_floor_space;
            textBox15.Text = record.Rkitchen_floor_space;
            textBox16.Text = record.Rceiling_height;

            comboBox2.DataSource     = dbw.district;
            comboBox2.DisplayMember  = dbw.district.Columns[1].ColumnName;
            comboBox3.DataSource     = dbw.town;
            comboBox3.DisplayMember  = dbw.town.Columns[1].ColumnName;
            comboBox4.DataSource     = dbw.street;
            comboBox4.DisplayMember  = dbw.street.Columns[0].ColumnName;
            comboBox2.SelectedIndex  = 0;
            comboBox3.SelectedIndex  = 2;
            comboBox4.SelectedIndex  = 0;
            comboBox2.BindingContext = this.BindingContext;
            comboBox3.BindingContext = this.BindingContext;
            comboBox4.BindingContext = this.BindingContext;

            for (int i = 0; i < dbw.district.Rows.Count; i++)
            {
                if (dbw.district.Rows[i][0].ToString() == record.Rdistrict_region)
                {
                    comboBox2.SelectedIndex = i; i = dbw.district.Rows.Count;
                }
            }

            for (int i = 0; i < dbw.town.Rows.Count; i++)
            {
                if (dbw.town.Rows[i][0].ToString() == record.Rcity)
                {
                    comboBox3.SelectedIndex = i; i = dbw.town.Rows.Count;
                }
            }

            int street_count = dbw.street.Rows.Count;

            for (int i = 0; i < street_count; i++)
            {
                if (dbw.street.Rows[i][1].ToString() == record.Rstreet)
                {
                    comboBox4.SelectedIndex = i; i = dbw.street.Rows.Count;
                }
            }

            if (record.Rblock_no != "")
            {
                textBox3.Text = String.Concat(func.Decrypt(record.Rhouse_no, func.fkey), "/", func.Decrypt(record.Rblock_no, func.fkey));
            }
            else
            {
                textBox3.Text = func.Decrypt(record.Rhouse_no, func.fkey);
            }
            textBox4.Text = func.Decrypt(record.Rflat_no, func.fkey);

            if (record.Rhaggle == 1)
            {
                checkBox2.Checked = true;
            }
            if (record.Ruse_for_office == 1)
            {
                checkBox1.Checked = true;
            }
            if (record.Rparking == 1)
            {
                checkBox4.Checked = true;
            }
            if (record.Routhouse_legality == 1)
            {
                checkBox3.Checked = true;
            }
            if (record.RFridge == 1)
            {
                freezer.Checked = true;
            }

            textBox20.Text = record.Rbathroom_note;
            textBox19.Text = record.Rkitchen_note;
            textBox18.Text = record.Rbackrooms;
            textBox22.Text = record.Rnote;
            textBox17.Text = record.Rdescription_detail;

            if (record.Rbalcony.IndexOf("Застеклен") > -1)
            {
                balcony.Properties.Items[0].CheckState = CheckState.Checked;
            }
            if (record.Rbalcony.IndexOf("Не застеклен") > -1)
            {
                balcony.Properties.Items[1].CheckState = CheckState.Checked;
            }
            if (record.Rbalcony.IndexOf("Зарешечен") > -1)
            {
                balcony.Properties.Items[2].CheckState = CheckState.Checked;
            }

            if (record.Rloggia.IndexOf("Застеклена") > -1)
            {
                loggia.Properties.Items[0].CheckState = CheckState.Checked;
            }
            if (record.Rloggia.IndexOf("Не застеклена") > -1)
            {
                loggia.Properties.Items[1].CheckState = CheckState.Checked;
            }
            if (record.Rloggia.IndexOf("Зарешечена") > -1)
            {
                loggia.Properties.Items[2].CheckState = CheckState.Checked;
            }

            if (record.Rgas_supply.IndexOf("природный") > -1)
            {
                checkBox5.Checked = true;
            }
            if (record.Rgas_supply.IndexOf("баллонный") > -1)
            {
                checkBox6.Checked = true;
            }
            if (record.Rgas_supply.IndexOf("электроплита") > -1)
            {
                checkBox7.Checked = true;
            }
            if (record.Rgas_supply.IndexOf("нет") > -1)
            {
                checkBox8.Checked = true;
            }

            if (record.Rheat_supply.IndexOf("электрическое") > -1)
            {
                checkBox17.Checked = true;
            }
            if (record.Rheat_supply.IndexOf("автономное") > -1)
            {
                checkBox18.Checked = true;
            }
            if (record.Rheat_supply.IndexOf("нет") > -1)
            {
                checkBox19.Checked = true;
            }
            if (record.Rheat_supply.IndexOf("ТЭЦ") > -1)
            {
                checkBox20.Checked = true;
            }

            if (record.Rbathroom.IndexOf("электрическое") > -1)
            {
                checkBox17.Checked = true;
            }
            if (record.Rbathroom.IndexOf("автономное") > -1)
            {
                checkBox18.Checked = true;
            }
            if (record.Rbathroom.IndexOf("Отсутствует") > -1)
            {
                checkBox21.Checked = true;
            }
            if (record.Rbathroom.IndexOf("Только") > -1)
            {
                checkBox22.Checked = true;
            }
            if (record.Rbathroom.IndexOf("Совмещенный") > -1)
            {
                checkBox16.Checked = true;
            }
            if (record.Rbathroom.IndexOf("Раздельный") > -1)
            {
                checkBox15.Checked = true;
            }

            if (record.Rwater_supply.IndexOf("(водопровод)") > -1)
            {
                checkBox12.Checked = true;
            }
            if (record.Rwater_supply.IndexOf("(колодец)") > -1)
            {
                checkBox11.Checked = true;
            }
            if (record.Rwater_supply.IndexOf("(АГВ)") > -1)
            {
                checkBox10.Checked = true;
            }
            if (record.Rwater_supply.IndexOf("(ТЭЦ)") > -1)
            {
                checkBox14.Checked = true;
            }
            if (record.Rwater_supply.IndexOf("нет") > -1)
            {
                checkBox9.Checked = true;
            }
            if (record.Rwater_supply.IndexOf("(бойлер)") > -1)
            {
                checkBox13.Checked = true;
            }

            textBox5.Text  = record.Rprice.ToString();
            textBox6.Text  = record.Rrent_price_day.ToString();
            textBox7.Text  = record.Rrent_price_month.ToString();
            textBox23.Text = record.Rtrade_price.ToString();
            //item.Ragent_code = result.Rows[0][48].ToString();

            listBox2.Items.Clear();
            listView1.Items.Clear();

            if (rent)
            {
                textBox6.Enabled = true;
                textBox7.Enabled = true;

                checkBox3.Visible = false;
                checkBox3.Enabled = false;
                freezer.Left      = 497;
                freezer.Top       = 551;
                freezer.Visible   = true;
                freezer.Enabled   = true;
            }
            else
            {
                textBox6.Enabled = false;
                textBox7.Enabled = false;

                checkBox3.Visible = true;
                checkBox3.Left    = 497;
                checkBox3.Top     = 551;
                checkBox3.Enabled = true;
                freezer.Visible   = false;
                freezer.Enabled   = false;
            }

            for (int i = 0; i < dbvals.photolist.Count; i++)
            {
                listBox2.Items.Add(dbvals.photolist[i]);
            }
            listBox2.DisplayMember = "Name";
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 1;
            }
            pictureEdit1.Image = (dbvals.photolist[1] as Img).Picture;
        }