Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            try
            {
                String sql = "EXEC SearchBaghVillaFSimple N'" + address_Txt.Text + "',N'" + area_Low.Text + "',N'"
                             + area_High.Text + "',N'" + owner.Text + "',N'"
                             + MyPriceTextBox.getStringFromMasked(price_Low.Text) + "',N'"
                             + MyPriceTextBox.getStringFromMasked(price_High.Text) + "'";

                DataTable dt = DB.execSqlReturnDataTable(sql);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Codes.BaghVillaForooshi;

                    res.dt = dt.Copy();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 24)
                        {
                            continue;
                        }
                        if ((area_Low.Text.Trim().Length != 0 || area_High.Text.Trim().Length != 0) && i == 3)
                        {
                            continue;
                        }
                        if (owner.Text.Trim().Length != 0 && i == 20)
                        {
                            continue;
                        }
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            errorOccurred = false;
            try
            {
                String str = ID_txt.Text;
                String mode = "";
                int index = 0;
                while (str[index] != '-')
                {
                    mode += str[index++];
                }
                String sql = "EXEC SearchByID " + str.Substring(2) + "," + mode;

                DataTable dt = DB.execSqlReturnDataTable(sql,DBComboBox.SelectedIndex);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Int32.Parse(mode);
                    res.gridView.DataSource = res.dt = dt;
                    res.session = session;
                    res.dbIndex = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #3
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            try
            {
                String str   = ID_txt.Text;
                String mode  = "";
                int    index = 0;
                while (str[index] != '-')
                {
                    mode += str[index++];
                }
                String sql = "EXEC SearchByID " + str.Substring(2) + "," + mode;

                DataTable dt = DB.execSqlReturnDataTable(sql, DBComboBox.SelectedIndex);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Int32.Parse(mode);
                    res.gridView.DataSource = res.dt = dt;
                    res.session             = session;
                    res.dbIndex             = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            errorOccurred = false;
            TextRange _RText = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd);
            try
            {
                String tr = _RText.Text.TrimEnd();
                tr = tr.TrimStart();
                if (tr == "\r\n") tr = "";

                String date = (MaskedDate.Text[0] == '_') ? "" : MaskedDate.Text;

                String[] s = { "'" + ID_Txt.Text + "'","N'" + date + "'","N'" + textBox1.Text + "'","N'" + textBox2.Text + "'","N'" + textBox3.Text + "'","N'" + textBox4.Text
                    + "'","N'" + textBox5.Text + "'","N'" + textBox6.Text + "'","N'" + textBox7.Text + "'","N'" + textBox8.Text
                    + "'","N'" + textBox9.Text + "'","N'" + textBox10.Text + "'","N'" + textBox11.Text + "'","N'" + textBox12.Text
                    + "'","N'" + textBox13.Text + "'","N'" + textBox14.Text + "'","N'" + textBox15.Text + "'","N'" + textBox16.Text
                    + "'","N'" + textBox17.Text + "'","N'" + textBox18.Text + "'","N'" + MyPriceTextBox.getStringFromMasked(textBox19.Text)
                    + "'","N'" + MyPriceTextBox.getStringFromMasked(textBox20.Text)
                    + "'","N'" + textBox21.Text + "'", checkBox1.IsChecked.ToString() , checkBox2.IsChecked.ToString() , checkBox3.IsChecked.ToString()
                    , checkBox4.IsChecked.ToString() , checkBox5.IsChecked.ToString() , checkBox6.IsChecked.ToString()
                    , checkBox7.IsChecked.ToString() , checkBox8.IsChecked.ToString() , checkBox9.IsChecked.ToString()
                    , checkBox10.IsChecked.ToString() , checkBox11.IsChecked.ToString() , checkBox12.IsChecked.ToString()
                    , checkBox13.IsChecked.ToString() , checkBox14.IsChecked.ToString() , checkBox15.IsChecked.ToString()
                    , checkBox16.IsChecked.ToString() , checkBox17.IsChecked.ToString() , checkBox18.IsChecked.ToString()
                    , checkBox19.IsChecked.ToString() , checkBox20.IsChecked.ToString() , checkBox21.IsChecked.ToString()
                    , checkBox22.IsChecked.ToString() , checkBox23.IsChecked.ToString() , checkBox24.IsChecked.ToString()
                    , checkBox25.IsChecked.ToString() , checkBox26.IsChecked.ToString() , checkBox27.IsChecked.ToString()
                    ,"N'" + _RText.Text + "'","N'" + textBox22.Text + "'"};

                SearchSQL sq = new SearchSQL(s, "SearchApartmanMaskooniS");
                DataTable dt = sq.getResult();

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Codes.ApartmanMaskooniEstijari;

                    if (dt != null)
                    {
                        res.dt = dt.Copy();
                        if (cols == null)
                        {
                            cols = new string[dt.Columns.Count];
                            for (int i = 0; i < cols.Length; i++)
                            {
                                cols[i] = dt.Columns[i].ColumnName;
                            }
                        }
                        if (MaskedDate.Text == "____/__/__") dt.Columns.Remove(cols[1]);
                        if (textBox2.Text.Trim().Length == 0) dt.Columns.Remove(cols[3]);
                        if (textBox3.Text.Trim().Length == 0) dt.Columns.Remove(cols[4]);
                        if (textBox4.Text.Trim().Length == 0) dt.Columns.Remove(cols[5]);
                        if (textBox5.Text.Trim().Length == 0) dt.Columns.Remove(cols[6]);
                        if (textBox6.Text.Trim().Length == 0) dt.Columns.Remove(cols[7]);
                        if (textBox7.Text.Trim().Length == 0) dt.Columns.Remove(cols[8]);
                        if (textBox8.Text.Trim().Length == 0) dt.Columns.Remove(cols[9]);
                        if (textBox9.Text.Trim().Length == 0) dt.Columns.Remove(cols[10]);
                        if (textBox10.Text.Trim().Length == 0) dt.Columns.Remove(cols[11]);
                        if (textBox11.Text.Trim().Length == 0) dt.Columns.Remove(cols[12]);
                        if (textBox12.Text.Trim().Length == 0) dt.Columns.Remove(cols[13]);
                        if (textBox13.Text.Trim().Length == 0) dt.Columns.Remove(cols[14]);
                        if (textBox14.Text.Trim().Length == 0) dt.Columns.Remove(cols[15]);
                        if (textBox15.Text.Trim().Length == 0) dt.Columns.Remove(cols[16]);
                        if (textBox16.Text.Trim().Length == 0) dt.Columns.Remove(cols[17]);
                        if (textBox17.Text.Trim().Length == 0) dt.Columns.Remove(cols[18]);
                        if (textBox18.Text.Trim().Length == 0) dt.Columns.Remove(cols[19]);
                        if (textBox21.Text.Trim().Length == 0) dt.Columns.Remove(cols[22]);
                        if (checkBox1.IsChecked == false) dt.Columns.Remove(cols[23]);
                        if (checkBox2.IsChecked == false) dt.Columns.Remove(cols[24]);
                        if (checkBox3.IsChecked == false) dt.Columns.Remove(cols[25]);
                        if (checkBox4.IsChecked == false) dt.Columns.Remove(cols[26]);
                        if (checkBox5.IsChecked == false) dt.Columns.Remove(cols[27]);
                        if (checkBox6.IsChecked == false) dt.Columns.Remove(cols[28]);
                        if (checkBox7.IsChecked == false) dt.Columns.Remove(cols[29]);
                        if (checkBox8.IsChecked == false) dt.Columns.Remove(cols[30]);
                        if (checkBox9.IsChecked == false) dt.Columns.Remove(cols[31]);
                        if (checkBox10.IsChecked == false) dt.Columns.Remove(cols[32]);
                        if (checkBox11.IsChecked == false) dt.Columns.Remove(cols[33]);
                        if (checkBox12.IsChecked == false) dt.Columns.Remove(cols[34]);
                        if (checkBox13.IsChecked == false) dt.Columns.Remove(cols[35]);
                        if (checkBox14.IsChecked == false) dt.Columns.Remove(cols[36]);
                        if (checkBox15.IsChecked == false) dt.Columns.Remove(cols[37]);
                        if (checkBox16.IsChecked == false) dt.Columns.Remove(cols[38]);
                        if (checkBox17.IsChecked == false) dt.Columns.Remove(cols[39]);
                        if (checkBox18.IsChecked == false) dt.Columns.Remove(cols[40]);
                        if (checkBox19.IsChecked == false) dt.Columns.Remove(cols[41]);
                        if (checkBox20.IsChecked == false) dt.Columns.Remove(cols[42]);
                        if (checkBox21.IsChecked == false) dt.Columns.Remove(cols[43]);
                        if (checkBox22.IsChecked == false) dt.Columns.Remove(cols[44]);
                        if (checkBox23.IsChecked == false) dt.Columns.Remove(cols[45]);
                        if (checkBox24.IsChecked == false) dt.Columns.Remove(cols[46]);
                        if (checkBox25.IsChecked == false) dt.Columns.Remove(cols[47]);
                        if (checkBox26.IsChecked == false) dt.Columns.Remove(cols[48]);
                        if (checkBox27.IsChecked == false) dt.Columns.Remove(cols[49]);
                        if (_RText.Text == "\r\n") dt.Columns.Remove(cols[50]);
                        if (textBox22.Text.Length == 0) dt.Columns.Remove(cols[51]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            errorOccurred = false;
            TextRange _text = new TextRange(comments.Document.ContentStart, comments.Document.ContentEnd);
            String cmt = _text.Text;
            cmt = cmt.Remove(cmt.Length - 2);
            try
            {
                String sql = "EXEC SearchBaghVillaFSimple N'" + address_Txt.Text + "',N'" + area_Low.Text + "',N'"
                    + area_High.Text + "',N'" + owner.Text + "',N'"
                    + MyPriceTextBox.getStringFromMasked(price_Low.Text) + "',N'"
                    + MyPriceTextBox.getStringFromMasked(price_High.Text) + "',N'" + cmt + "'";

                DataTable dt = DB.execSqlReturnDataTable(sql,DBComboBox.SelectedIndex);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.session = session;
                    res.which = Codes.BaghVillaForooshi;

                    res.dt = dt.Copy();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 24) continue;
                        if ((area_Low.Text.Trim().Length != 0 || area_High.Text.Trim().Length != 0) && i == 3) continue;
                        if (owner.Text.Trim().Length != 0 && i == 20) continue;
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.dbIndex = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #6
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            TextRange _RText = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd);

            try
            {
                String tr = _RText.Text.TrimEnd();
                tr = tr.TrimStart();
                if (tr == "\r\n")
                {
                    tr = "";
                }

                String date = (MaskedDate.Text[0] == '_') ? "" : MaskedDate.Text;

                String[] s = { "'" + ID_Txt.Text + "'", "N'" + date + "'",               "N'" + textBox1.Text + "'",      "N'" + textBox2.Text + "'",     "N'" + textBox3.Text + "'", "N'" + textBox4.Text
                               + "'",                   "N'" + textBox5.Text + "'",      "N'" + textBox6.Text + "'",      "N'" + textBox7.Text + "'",     "N'" + textBox8.Text
                               + "'",                   "N'" + textBox9.Text + "'",      "N'" + textBox10.Text + "'",     "N'" + textBox11.Text + "'",    "N'" + textBox12.Text
                               + "'",                   "N'" + textBox13.Text + "'",     "N'" + textBox14.Text + "'",     "N'" + textBox15.Text + "'",    "N'" + textBox16.Text
                               + "'",                   "N'" + textBox17.Text + "'",     "N'" + textBox18.Text + "'",     "N'" + MyPriceTextBox.getStringFromMasked(textBox19.Text)
                               + "'",                   "N'" + MyPriceTextBox.getStringFromMasked(textBox20.Text)
                               + "'",                   "N'" + textBox21.Text + "'",     checkBox1.IsChecked.ToString(),  checkBox2.IsChecked.ToString(), checkBox3.IsChecked.ToString()
                               ,                        checkBox4.IsChecked.ToString(),  checkBox5.IsChecked.ToString(),  checkBox6.IsChecked.ToString()
                               ,                        checkBox7.IsChecked.ToString(),  checkBox8.IsChecked.ToString(),  checkBox9.IsChecked.ToString()
                               ,                        checkBox10.IsChecked.ToString(), checkBox11.IsChecked.ToString(), checkBox12.IsChecked.ToString()
                               ,                        checkBox13.IsChecked.ToString(), checkBox14.IsChecked.ToString(), checkBox15.IsChecked.ToString()
                               ,                        checkBox16.IsChecked.ToString(), checkBox17.IsChecked.ToString(), checkBox18.IsChecked.ToString()
                               ,                        checkBox19.IsChecked.ToString(), checkBox20.IsChecked.ToString(), checkBox21.IsChecked.ToString()
                               ,                        checkBox22.IsChecked.ToString(), checkBox23.IsChecked.ToString(), checkBox24.IsChecked.ToString()
                               ,                        checkBox25.IsChecked.ToString(), checkBox26.IsChecked.ToString(), checkBox27.IsChecked.ToString()
                               ,                        "N'" + _RText.Text + "'",        "N'" + textBox22.Text + "'" };

                SearchSQL sq = new SearchSQL(s, "SearchApartmanMaskooniS");
                DataTable dt = sq.getResult(DBComboBox.SelectedIndex);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.session = session;
                    res.which   = Codes.ApartmanMaskooniEstijari;

                    if (dt != null)
                    {
                        res.dt = dt.Copy();
                        if (cols == null)
                        {
                            cols = new string[dt.Columns.Count];
                            for (int i = 0; i < cols.Length; i++)
                            {
                                cols[i] = dt.Columns[i].ColumnName;
                            }
                        }
                        if (MaskedDate.Text == "____/__/__")
                        {
                            dt.Columns.Remove(cols[1]);
                        }
                        if (textBox2.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[3]);
                        }
                        if (textBox3.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[4]);
                        }
                        if (textBox4.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[5]);
                        }
                        if (textBox5.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[6]);
                        }
                        if (textBox6.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[7]);
                        }
                        if (textBox7.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[8]);
                        }
                        if (textBox8.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[9]);
                        }
                        if (textBox9.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[10]);
                        }
                        if (textBox10.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[11]);
                        }
                        if (textBox11.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[12]);
                        }
                        if (textBox12.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[13]);
                        }
                        if (textBox13.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[14]);
                        }
                        if (textBox14.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[15]);
                        }
                        if (textBox15.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[16]);
                        }
                        if (textBox16.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[17]);
                        }
                        if (textBox17.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[18]);
                        }
                        if (textBox18.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[19]);
                        }
                        if (textBox21.Text.Trim().Length == 0)
                        {
                            dt.Columns.Remove(cols[22]);
                        }
                        if (checkBox1.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[23]);
                        }
                        if (checkBox2.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[24]);
                        }
                        if (checkBox3.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[25]);
                        }
                        if (checkBox4.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[26]);
                        }
                        if (checkBox5.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[27]);
                        }
                        if (checkBox6.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[28]);
                        }
                        if (checkBox7.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[29]);
                        }
                        if (checkBox8.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[30]);
                        }
                        if (checkBox9.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[31]);
                        }
                        if (checkBox10.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[32]);
                        }
                        if (checkBox11.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[33]);
                        }
                        if (checkBox12.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[34]);
                        }
                        if (checkBox13.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[35]);
                        }
                        if (checkBox14.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[36]);
                        }
                        if (checkBox15.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[37]);
                        }
                        if (checkBox16.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[38]);
                        }
                        if (checkBox17.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[39]);
                        }
                        if (checkBox18.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[40]);
                        }
                        if (checkBox19.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[41]);
                        }
                        if (checkBox20.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[42]);
                        }
                        if (checkBox21.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[43]);
                        }
                        if (checkBox22.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[44]);
                        }
                        if (checkBox23.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[45]);
                        }
                        if (checkBox24.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[46]);
                        }
                        if (checkBox25.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[47]);
                        }
                        if (checkBox26.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[48]);
                        }
                        if (checkBox27.IsChecked == false)
                        {
                            dt.Columns.Remove(cols[49]);
                        }
                        if (_RText.Text == "\r\n")
                        {
                            dt.Columns.Remove(cols[50]);
                        }
                        if (textBox22.Text.Length == 0)
                        {
                            dt.Columns.Remove(cols[51]);
                        }
                    }
                    res.gridView.DataSource = dt;
                    res.dbIndex             = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            errorOccurred = false;
            try
            {
                String sql;
                if (rahn_High.Text.Trim().Length == 0 && rahn_Low.Text.Trim().Length == 0 && ejare_High.Text.Trim().Length == 0 && ejare_Low.Text.Trim().Length == 0)
                {
                    if (rahnoejare_Low.Text.Trim().Length == 0 && rahnoejare_High.Text.Trim().Length == 0)
                    {
                        sql = model1();
                    }
                    else
                    {
                        String low = MyPriceTextBox.getStringFromMasked(rahnoejare_Low.Text);
                        String high = MyPriceTextBox.getStringFromMasked(rahnoejare_High.Text);
                        if (low.Trim().Length == 0 || high.Trim().Length == 0)
                        {
                            errorOccurred = true;
                            MessageBox.Show("لطفا در این حالت که می خواهید از فیلد رهن و اجاره استفاده بنمایید هر دو طرف آن را پر بفرمایید", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                        sql = model2(low, high);
                    }
                }
                else
                {
                    sql = model1();
                }

                DataTable dt = DB.execSqlReturnDataTable(sql);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.dt = dt.Copy();
                    res.which = Codes.ApartmanEdariEstijari;
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 21 || i == 22) continue;
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 3) continue;
                        if ((bedrooms_Low.Text.Trim().Length != 0 || bedrooms_High.Text.Trim().Length != 0) && i == 5) continue;
                        if (owner.Text.Trim().Length != 0 && i == 19) continue;
                        if (sanad.Text.Trim().Length != 0 && i == 16) continue;
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            try
            {
                String sql = "EXEC SearchApartmanMaskooniFSimple N'" + address_Txt.Text + "',N'" + metraj_Low.Text + "',N'"
                             + metraj_High.Text + "',N'" + bedrooms_Low.Text + "',N'" + bedrooms_High.Text + "',N'" + vahedha_Low.Text
                             + "',N'" + vahedha_High.Text + "',N'" + sakht_Low.Text + "',N'" + sakht_High.Text + "',N'" + owner.Text
                             + "',N'" + MyPriceTextBox.getStringFromMasked(price_Low.Text) + "',N'" + MyPriceTextBox.getStringFromMasked(price_High.Text) + "'";

                DataTable dt = DB.execSqlReturnDataTable(sql);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();

                    res.dt    = dt.Copy();
                    res.which = Codes.ApartmanMaskooniForooshi;
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 21)
                        {
                            continue;
                        }
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 3)
                        {
                            continue;
                        }
                        if ((bedrooms_Low.Text.Trim().Length != 0 || bedrooms_High.Text.Trim().Length != 0) && i == 5)
                        {
                            continue;
                        }
                        if ((vahedha_Low.Text.Trim().Length != 0 || vahedha_High.Text.Trim().Length != 0) && i == 10)
                        {
                            continue;
                        }
                        if ((sakht_Low.Text.Trim().Length != 0 || sakht_High.Text.Trim().Length != 0) && i == 8)
                        {
                            continue;
                        }
                        if (owner.Text.Trim().Length != 0 && i == 19)
                        {
                            continue;
                        }
                        if ((price_Low.Text.Trim().Length != 0 || price_High.Text.Trim().Length != 0) && i == 22)
                        {
                            continue;
                        }
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #9
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost = false;
            errorOccurred = false;
            try
            {
                String sql = "EXEC SearchManzelFSimple N'" + address_Txt.Text + "',N'" + metraj_Low.Text + "',N'"
                    + metraj_High.Text + "',N'" + zirbanaa_Low.Text + "',N'"
                    + zirbanaa_High.Text + "',N'" + tabaghaat_Low.Text + "',N'"
                    + tabaghaat_High.Text + "',N'" + vahed_Low.Text + "',N'"
                    + vahed_High.Text + "',N'" + owner.Text + "',N'"
                    + MyPriceTextBox.getStringFromMasked(price_Low.Text) + "',N'"
                    + MyPriceTextBox.getStringFromMasked(price_High.Text) + "'";

                DataTable dt = DB.execSqlReturnDataTable(sql);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Codes.HouseForooshi;

                    res.dt = dt.Copy();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 22) continue;
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 7) continue;
                        if ((zirbanaa_Low.Text.Trim().Length != 0 || zirbanaa_High.Text.Trim().Length != 0) && i == 6) continue;
                        if ((tabaghaat_Low.Text.Trim().Length != 0 || tabaghaat_High.Text.Trim().Length != 0) && i == 9) continue;
                        if ((vahed_Low.Text.Trim().Length != 0 || vahed_High.Text.Trim().Length != 0) && i == 10) continue;
                        if (owner.Text.Trim().Length != 0 && i == 15) continue;
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #10
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            TextRange _text = new TextRange(comments.Document.ContentStart, comments.Document.ContentEnd);
            String    cmt   = _text.Text;

            cmt = cmt.Remove(cmt.Length - 2);
            try
            {
                String sql;
                if (rahn_High.Text.Trim().Length == 0 && rahn_Low.Text.Trim().Length == 0 && ejare_High.Text.Trim().Length == 0 && ejare_Low.Text.Trim().Length == 0)
                {
                    if (rahnoejare_Low.Text.Trim().Length == 0 && rahnoejare_High.Text.Trim().Length == 0)
                    {
                        sql = model1();
                    }
                    else
                    {
                        String low  = MyPriceTextBox.getStringFromMasked(rahnoejare_Low.Text);
                        String high = MyPriceTextBox.getStringFromMasked(rahnoejare_High.Text);
                        if (low.Trim().Length == 0 || high.Trim().Length == 0)
                        {
                            MessageBox.Show("لطفا در این حالت که می خواهید از فیلد رهن و اجاره استفاده بنمایید هر دو طرف آن را پر بفرمایید", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                        sql = model2(low, high);
                    }
                }
                else
                {
                    sql = model1();
                }

                DataTable dt = DB.execSqlReturnDataTable(sql, DBComboBox.SelectedIndex);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.session = session;
                    res.which   = Codes.MaghazeEstijari;
                    res.dt      = dt.Copy();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 22 || i == 23)
                        {
                            continue;
                        }
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 3)
                        {
                            continue;
                        }
                        if (owner.Text.Trim().Length != 0 && i == 20)
                        {
                            continue;
                        }
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.dbIndex             = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #11
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            TextRange _text = new TextRange(comments.Document.ContentStart, comments.Document.ContentEnd);
            String    cmt   = _text.Text;

            cmt = cmt.Remove(cmt.Length - 2);
            try
            {
                String sql = "EXEC SearchApartmanEdariFSimple N'" + address_Txt.Text + "',N'" + metraj_Low.Text + "',N'"
                             + metraj_High.Text + "',N'" + bedrooms_Low.Text + "',N'" + bedrooms_High.Text + "',N'" + owner.Text
                             + "',N'" + sanad.Text + "',N'" + MyPriceTextBox.getStringFromMasked(price_Low.Text) + "',N'"
                             + MyPriceTextBox.getStringFromMasked(price_High.Text) + "',N'" + cmt + "'";


                if (Show3D_checkBox.IsChecked == true)    // 3d result
                {
                    Result3D  res = new Result3D();
                    DataTable dt  = DB.execSqlReturnDataTable(sql, DBComboBox.SelectedIndex);
                    res.dt = dt;
                    res.Show();
                }
                else    // usual result
                {
                    ResultWindow res = new ResultWindow();
                    res.session = session;
                    DataTable dt = DB.execSqlReturnDataTable(sql, DBComboBox.SelectedIndex);
                    res.dt    = dt.Copy();
                    res.which = Codes.ApartmanEdariForooshi;
                    res.Show();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 24)
                        {
                            continue;
                        }
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 3)
                        {
                            continue;
                        }
                        if ((bedrooms_Low.Text.Trim().Length != 0 || bedrooms_High.Text.Trim().Length != 0) && i == 5)
                        {
                            continue;
                        }
                        if (owner.Text.Trim().Length != 0 && i == 21)
                        {
                            continue;
                        }
                        if (sanad.Text.Trim().Length != 0 && i == 17)
                        {
                            continue;
                        }
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.dbIndex             = DBComboBox.SelectedIndex;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #12
0
        private void search_button_Click(object sender, RoutedEventArgs e)
        {
            this.Topmost  = false;
            errorOccurred = false;
            try
            {
                String sql;
                if (rahn_High.Text.Trim().Length == 0 && rahn_Low.Text.Trim().Length == 0 && ejare_High.Text.Trim().Length == 0 && ejare_Low.Text.Trim().Length == 0)
                {
                    if (rahnoejare_Low.Text.Trim().Length == 0 && rahnoejare_High.Text.Trim().Length == 0)
                    {
                        sql = model1();
                    }
                    else
                    {
                        String low  = MyPriceTextBox.getStringFromMasked(rahnoejare_Low.Text);
                        String high = MyPriceTextBox.getStringFromMasked(rahnoejare_High.Text);
                        if (low.Trim().Length == 0 || high.Trim().Length == 0)
                        {
                            MessageBox.Show("لطفا در این حالت که می خواهید از فیلد رهن و اجاره استفاده بنمایید هر دو طرف آن را پر بفرمایید", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                        sql = model2(low, high);
                    }
                }
                else
                {
                    sql = model1();
                }

                DataTable dt = DB.execSqlReturnDataTable(sql);

                if (Show3D_checkBox.IsChecked == true)
                {
                    Result3D res3d = new Result3D();
                    res3d.dt = dt;
                    res3d.Show();
                }
                else
                {
                    ResultWindow res = new ResultWindow();
                    res.which = Codes.HouseEstijari;

                    res.dt = dt.Copy();
                    if (cols == null)
                    {
                        cols = new string[dt.Columns.Count];
                        for (int i = 0; i < cols.Length; i++)
                        {
                            cols[i] = dt.Columns[i].ColumnName;
                        }
                    }
                    for (int i = 1; i < cols.Length; i++)
                    {
                        if (i == 2 || i == 17 || i == 18)
                        {
                            continue;
                        }
                        if ((metraj_Low.Text.Trim().Length != 0 || metraj_High.Text.Trim().Length != 0) && i == 7)
                        {
                            continue;
                        }
                        if ((zirbanaa_Low.Text.Trim().Length != 0 || zirbanaa_High.Text.Trim().Length != 0) && i == 6)
                        {
                            continue;
                        }
                        if ((tabaghaat_Low.Text.Trim().Length != 0 || tabaghaat_High.Text.Trim().Length != 0) && i == 9)
                        {
                            continue;
                        }
                        if ((vahed_Low.Text.Trim().Length != 0 || vahed_High.Text.Trim().Length != 0) && i == 10)
                        {
                            continue;
                        }
                        if (owner.Text.Trim().Length != 0 && i == 15)
                        {
                            continue;
                        }
                        dt.Columns.Remove(cols[i]);
                    }
                    res.gridView.DataSource = dt;
                    res.Show();
                }
            }
            catch (Exception)
            {
                errorOccurred = true;
                MessageBox.Show("خطا در اتصال و یا اجرای درخواست از پایگاه داده ها", "خطا", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }