Ejemplo n.º 1
0
        private void getDataFromServer()
        {
            refresh.Visible = true;



            BackgroundWorker getDataBackGroundWorker = new BackgroundWorker();

            getDataBackGroundWorker.WorkerSupportsCancellation = true;
            getDataBackGroundWorker.DoWork             += new DoWorkEventHandler(getDataBackGroundWorker_do);
            getDataBackGroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getDataBackGroundWorker_done);

            try
            {
                queryModel model = new queryModel()
                {
                };

                string dd = "";
                switch (kind.SelectedItem)
                {
                case "آپارتمان":
                    dd = "1";
                    break;

                case "دفتر کار":
                    dd = "2";
                    break;

                case "کلنگی":
                    dd = "3";
                    break;

                case "مستغلات":
                    dd = "4";
                    break;

                case "ویلا":
                    dd = "5";
                    break;

                case "مغازه":
                    dd = "6";
                    break;

                default:
                    dd = "";
                    break;
                }

                model.kind         = dd;
                model.apartment    = (apartment.SelectedValue == null) ? "" : apartment.SelectedValue.ToString();
                model.mantaghe_id  = (mantaghe_id.SelectedValue == null) ? "" : mantaghe_id.SelectedValue.ToString();
                model.villa        = (villa.SelectedValue == null) ? "" : villa.SelectedValue.ToString();
                model.kolangi      = (kolangi.SelectedValue == null) ? "" : kolangi.SelectedValue.ToString();
                model.mostaghellat = (mostaghellat.SelectedValue == null) ? "" : mostaghellat.SelectedValue.ToString();
                model.office       = (office.SelectedValue == null) ? "" : office.SelectedValue.ToString();
                //model.nama = (nama.SelectedValue == null) ? "" : nama.SelectedValue.ToString();
                model.ashpazkhane = (wc.SelectedValue == null) ? "" : ashpazkhane.SelectedValue.ToString();

                model.wc                    = setIndexForWC();
                model.mantaghe_name         = setIndexForMantaghe();
                model.anbari                = anbari.Checked ? "1" : "";
                model.asansor               = asansor.Checked ? "1" : "";
                model.hasEstakhr            = hasEstakhr.Checked ? "1" : "";
                model.hasJakoozi            = hasJakoozi.Checked ? "1" : "";
                model.hasSauna              = hasSauna.Checked ? "1" : "";
                model.isEjare               = isEjare.Checked ? "1" : "";
                model.isForoosh             = isForoosh.Checked ? "1" : "";
                model.isMoaveze             = isMoaveze.Checked ? "1" : "";
                model.isMosharekat          = isMosharekat.Checked ? "1" : "";
                model.isRahn                = isRahn.Checked ? "1" : "";
                model.sell2khareji          = sell2khareji.Checked ? "1" : "";
                model.seraydar              = hasSeraydar.Checked ? "1" : "";
                model.hasGym                = hasGym.Checked ? "1" : "";
                model.hasShooting           = hasShooting.Checked ? "1" : "";
                model.hasHall               = hasHall.Checked ? "1" : "";
                model.hasRoofGarden         = hasRoofGarden.Checked ? "1" : "";
                model.isMoble               = isMoble.Checked ? "1" : "";
                model.parking               = parking.Checked ? "1" : "";
                model.labi                  = labi.Checked ? "1" : "";
                model.parking               = parking.Checked ? "1" : "";
                model.address               = address.Text;
                model.desc                  = desc.Text;
                model.tabaghe               = tabaghe.Text;
                GlobalVariable.searchTabghe = tabaghe.Text;
                model.phones                = phones.Text;
                model.malek                 = malek.Text;
                model.zirbana_from          = zirbana_from.Text;
                model.zirbana_to            = zirbana_to.Text;
                model.senn_from             = senn_from.Text;
                model.senn_to               = senn_to.Text;
                if (senn_from.Text == "" && senn_to.Text != "")
                {
                    model.senn_from = "2000";
                }
                else if (senn_from.Text != "" && senn_to.Text == "")
                {
                    model.senn_to = "1000";
                }
                model.masahat_from     = masahat_from.Text;
                model.masahat_to       = masahat_to.Text;
                model.id_from          = id_from.Text;
                model.id_to            = id_to.Text;
                model.ID               = ID.Text;
                model.tabaghe_from     = tabaghe_from.Text;
                model.tabaghe_to       = tabaghe_to.Text;
                model.rahn_from        = rahn_from.Text;
                model.ejare_from       = ejare_from.Text;
                model.rahn_to          = rahn_to.Text;
                model.ejare_to         = ejare_to.Text;
                model.metri_from       = metri_from.Text;
                model.metri_to         = metri_to.Text;
                model.total_price_from = total_price_from.Text;
                model.total_price_to   = total_price_to.Text;
                model.date_from        = date_from.Text;
                model.date_to          = date_to.Text;
                model.bed_from         = bed_from.Text;
                model.bed_to           = bed_to.Text;



                string str = JsonConvert.SerializeObject(model);
                GlobalVariable.lastSearchModel = str;

                getDataBackGroundWorker.RunWorkerAsync(argument: str);
            }
            catch (Exception)
            {
                MessageBox.Show("فرم جستجو را کامل کنید ");
                return;
            }
        }
Ejemplo n.º 2
0
        void getDataBackGroundWorkerFileList_do(object sender, DoWorkEventArgs e)
        {
            queryModel    model       = new queryModel();
            List <string> addressList = e.Argument.ToString().Split(',').ToList();

            model.address1 = addressList[0];
            model.address2 = addressList[1];
            model.address3 = addressList[2];

            string query = JsonConvert.SerializeObject(model);


            try
            {
                CatsAndAreasObject CATS = JsonConvert.DeserializeObject <CatsAndAreasObject>(GlobalVariable.newCatsAndAreas);

                List <gridVM> list = new List <gridVM>();
                foreach (var item in manager.getList(query))
                {
                    if (GlobalVariable.searchTabghe == "")
                    {
                        GlobalVariable.searchTabghe = "1";
                    }
                    string phones     = item.phones;
                    string tabaghe    = GlobalVariable.searchTabghe;
                    string fullprice  = item.tabaghe_1_total_price.ToString();
                    string metriprice = item.tabaghe_1_metri.ToString();
                    string rahnprice  = item.tabaghe_1_rahn.ToString();
                    string ejareprice = item.tabaghe_1_ejare.ToString();
                    string tabagh     = item.tabaghe1.ToString();
                    string kha        = item.bed1.ToString();
                    string zirban     = item.zirbana1.ToString();
                    string tb1        = item.tabaghe1.ToString();
                    string tb2        = item.tabaghe2.ToString();
                    string tb3        = item.tabaghe3.ToString();

                    if (tb1 == tabaghe)
                    {
                        fullprice  = item.tabaghe_1_total_price.ToString();
                        metriprice = item.tabaghe_1_metri.ToString();
                        rahnprice  = item.tabaghe_1_rahn.ToString();
                        ejareprice = item.tabaghe_1_ejare.ToString();
                        tabagh     = item.tabaghe1.ToString();
                        kha        = item.bed1.ToString();
                        zirban     = item.zirbana1.ToString();
                    }
                    if (tb2 == tabaghe)
                    {
                        fullprice  = item.tabaghe_2_total_price.ToString();
                        metriprice = item.tabaghe_2_metri.ToString();
                        rahnprice  = item.tabaghe_2_rahn.ToString();
                        ejareprice = item.tabaghe_2_ejare.ToString();
                        tabagh     = item.tabaghe2.ToString();
                        kha        = item.bed2.ToString();
                        zirban     = item.zirbana2.ToString();
                    }
                    if (tb3 == tabaghe)
                    {
                        fullprice  = item.tabaghe_3_total_price.ToString();
                        metriprice = item.tabaghe_3_metri.ToString();
                        rahnprice  = item.tabaghe_3_rahn.ToString();
                        ejareprice = item.tabaghe_3_ejare.ToString();
                        tabagh     = item.tabaghe3.ToString();
                        kha        = item.bed3.ToString();
                        zirban     = item.zirbana3.ToString();
                    }


                    string serverid = item.ID.ToString();
                    string date     = item.date_updated.ToString();
                    string address  = item.address.ToString();
                    string owner    = item.malek.ToString();
                    string senn     = item.senn == 0 ? "-" : (from q in CATS.data.list.senn
                                                              where q.ID == item.senn.ToString()
                                                              select q.title).First();

                    string melkkind = "";

                    if (item.maghaze != null && item.maghaze != "0")
                    {
                        melkkind = melkkind + "مغازه،";
                    }
                    if (item.apartment != null && item.apartment != "0")
                    {
                        melkkind = melkkind + "آپارتمان،";
                    }
                    if (item.villa != null && item.villa != "0")
                    {
                        melkkind = melkkind + "ویلا،";
                    }
                    if (item.mostaghellat != null && item.mostaghellat != "0")
                    {
                        melkkind = melkkind + "مستغلات،";
                    }
                    if (item.kolangi != null && item.kolangi != "0")
                    {
                        melkkind = melkkind + "کلنگی،";
                    }
                    if (item.office != null && item.office != "0")
                    {
                        melkkind = melkkind + "دفتر،";
                    }
                    if (melkkind.Length > 0)
                    {
                        melkkind = melkkind.Remove(melkkind.Length - 1, 1);
                    }

                    string Dealkind = "";
                    if (Convert.ToInt32(item.isForoosh.ToString()) > 0)
                    {
                        Dealkind = Dealkind + "فروش،";
                    }
                    if (Convert.ToInt32(item.isRahn.ToString()) > 0)
                    {
                        Dealkind = Dealkind + "رهن،";
                    }
                    if (Convert.ToInt32(item.isEjare.ToString()) > 0)
                    {
                        Dealkind = Dealkind + "اجاره،";
                    }
                    if (Dealkind.Length > 0)
                    {
                        Dealkind = Dealkind.Remove(Dealkind.Length - 1, 1);
                    }


                    string totalrahn  = item.isForoosh.ToString() == "1" ? fullprice : rahnprice;
                    string metriejare = item.isForoosh.ToString() == "1" ? metriprice : ejareprice;


                    string Rtabaghe = tabagh;
                    string khab     = kha;
                    string zirbana  = zirban;



                    bool mycheckbox = false;
                    totalrahn = totalrahn.Replace(".", "");
                    if (totalrahn == "0")
                    {
                        totalrahn = "0";
                    }
                    else if (Convert.ToInt64(totalrahn) > 0)
                    {
                        string mytotal = string.Format(CultureInfo.InvariantCulture, "{0:0,0}", Convert.ToInt64(totalrahn));
                        totalrahn = mytotal;
                    }
                    //else if (totalrahn == "-1")
                    //{
                    //    totalrahn = "توافقی";
                    //}
                    //else if (totalrahn == "-2")
                    //{
                    //    totalrahn = "رایگان";
                    //}

                    metriejare = metriejare.Replace(".", "");
                    if (Convert.ToInt64(metriejare) == 0)
                    {
                        metriejare = "0";
                    }
                    else if (Convert.ToInt64(metriejare) > 0)
                    {
                        string mymetriejare = string.Format(CultureInfo.InvariantCulture, "{0:0,0}", Convert.ToInt64(metriejare));
                        metriejare = mymetriejare;
                    }
                    //else if (metriejare == "-1")
                    //{
                    //    metriejare = "توافقی";
                    //}
                    //else if (metriejare == "-2")
                    //{
                    //    metriejare = "رایگان";
                    //}
                    if (GlobalVariable.temporaryOwnList.Contains(serverid + ","))
                    {
                        mycheckbox = true;
                    }
                    gridVM newitem = new gridVM()
                    {
                        Address     = item.address1 + item.address2 + item.address3,
                        Address1    = item.address1,
                        Address2    = item.address2,
                        Address3    = item.address3,
                        bed         = kha,
                        codegrid    = item.number.ToString(),
                        dategrid    = dateTimeConvert.ToPersianDateString(item.date_updated),
                        datetime    = item.date_updated,
                        ejare_metri = int.Parse(metriejare.Replace(",", "")),
                        floorgrid   = tabagh,
                        kindgrid    = Dealkind,
                        typegrid    = melkkind,
                        ownergrid   = item.malek,
                        rahn_total  = int.Parse(totalrahn.Replace(",", "")),
                        zirbana     = zirban,
                        checkbox    = mycheckbox,
                        Senn        = senn,
                        phones      = phones
                    };
                    list.Add(newitem);
                }

                string FILELIST = JsonConvert.SerializeObject(list);
                e.Result = FILELIST;
            }
            catch (Exception error)
            {
                e.Result = "error";
            }
        }
Ejemplo n.º 3
0
        public List <item> getList(string query, string sortname)
        {
            queryModel        log = JsonConvert.DeserializeObject <queryModel>(query);
            IQueryable <item> q   = context.items;

            if (log.address != "")
            {
                q = q.Where(x => x.address.Contains(log.address));
            }
            if (log.anbari == "1")
            {
                q = q.Where(x => x.anbari1 == "1" || x.anbari2 == "1" || x.anbari3 == "1");
            }
            if (log.apartment != "")
            {
                q = q.Where(x => x.apartment == log.apartment);
            }
            if (log.asansor == "1")
            {
                q = q.Where(x => x.asansor1 == "1" || x.asansor2 == "1" || x.asansor3 == "1");
            }
            if (log.ashpazkhane != "")
            {
                q = q.Where(x => x.ashpazkhane == log.ashpazkhane);
            }
            if (log.bed_from != "")
            {
                long needed = Convert.ToInt64(log.bed_from);
                q = q.Where(x => x.bed1 >= needed || x.bed2 >= needed || x.bed3 >= needed);
            }
            if (log.bed_to != "")
            {
                long needed = Convert.ToInt64(log.bed_to);
                q = q.Where(x => x.bed1 <= needed || x.bed2 <= needed || x.bed3 <= needed);
            }
            if (log.date_from != "")
            {
                DateTime needed = dateTimeConvert.ToGeorgianDateTime(log.date_from);
                q = q.Where(x => x.date_updated >= needed);
            }
            if (log.date_to != "")
            {
                DateTime needed = dateTimeConvert.ToGeorgianDateTime(log.date_to);
                q = q.Where(x => x.date_updated <= needed);
            }
            if (log.desc != "")
            {
                q = q.Where(x => x.desc.Contains(log.desc));
            }
            if (log.ejare_from != "")
            {
                long needed = Convert.ToInt64(log.ejare_from);
                q = q.Where(x => x.tabaghe_1_ejare >= needed || x.tabaghe_2_ejare >= needed || x.tabaghe_3_ejare >= needed);
            }
            if (log.ejare_to != "")
            {
                long needed = Convert.ToInt64(log.ejare_to);
                q = q.Where(x => x.tabaghe_1_ejare <= needed || x.tabaghe_2_ejare <= needed || x.tabaghe_3_ejare <= needed);
            }
            if (log.ertefa != "")
            {
                q = q.Where(x => x.ertefa == log.ertefa);
            }
            if (log.eslahi != "")
            {
                q = q.Where(x => x.eslahi == log.eslahi);
            }
            if (log.garmayesh_sarmayesh != "")
            {
                q = q.Where(x => x.garmayesh_sarmayesh == log.garmayesh_sarmayesh);
            }
            if (log.hasEstakhr != "")
            {
                q = q.Where(x => x.hasEstakhr == log.hasEstakhr);
            }
            if (log.hasGym != "")
            {
                q = q.Where(x => x.hasGym == log.hasGym);
            }
            if (log.hasHall != "")
            {
                q = q.Where(x => x.hasHall == log.hasHall);
            }
            if (log.hasJakoozi != "")
            {
                q = q.Where(x => x.hasJakoozi == log.hasJakoozi);
            }
            if (log.hasRoofGarden != "")
            {
                q = q.Where(x => x.hasRoofGarden == log.hasRoofGarden);
            }
            if (log.hasSauna != "")
            {
                q = q.Where(x => x.hasSauna == log.hasSauna);
            }
            if (log.hasSeraydar != "")
            {
                q = q.Where(x => x.hasSauna == log.hasSauna);
            }
            if (log.hasShooting != "")
            {
                q = q.Where(x => x.hasShooting == log.hasShooting);
            }
            if (log.hasShooting != "")
            {
                q = q.Where(x => x.hasShooting == log.hasShooting);
            }
            if (log.ID != "")
            {
                if (FUNS.IsDigitsOnly(log.ID))
                {
                    long needed = Convert.ToInt64(log.ID);
                    q = q.Where(x => x.number == needed);
                }
            }
            if (log.id_from != "")
            {
                if (FUNS.IsDigitsOnly(log.id_from))
                {
                    long needed = Convert.ToInt64(log.id_from);
                    q = q.Where(x => x.number >= needed);
                }
            }
            if (log.id_to != "")
            {
                if (FUNS.IsDigitsOnly(log.id_to))
                {
                    long needed = Convert.ToInt64(log.id_to);
                    q = q.Where(x => x.number >= needed);
                }
            }
            if (log.isEjare != "")
            {
                q = q.Where(x => x.isEjare == log.isEjare);
            }
            if (log.isForoosh != "")
            {
                q = q.Where(x => x.isForoosh == log.isForoosh);
            }
            if (log.isMoaveze != "")
            {
                q = q.Where(x => x.isMoaveze == log.isMoaveze);
            }
            if (log.isMoble != "")
            {
                q = q.Where(x => x.isMoble == log.isMoble);
            }
            if (log.isMosharekat != "")
            {
                q = q.Where(x => x.isMosharekat == log.isMosharekat);
            }
            if (log.isRahn != "")
            {
                q = q.Where(x => x.isRahn == log.isRahn);
            }
            if (log.kaf_type != "")
            {
                q = q.Where(x => x.kaf_type == log.kaf_type);
            }
            if (log.kind != "")
            {
                //{ "-", "آپارتمان", "دفتر کار", "کلنگی", "مستغلات", "ویلا","مغازه" };
                switch (log.kind)
                {
                case "آپارتمان":
                    q = q.Where(x => x.apartment != "");
                    break;

                case "ویلا":
                    q = q.Where(x => x.villa != "");
                    break;

                case "مستغلات":
                    q = q.Where(x => x.mostaghellat != "");
                    break;

                case "کلنگی":
                    q = q.Where(x => x.kolangi != "");
                    break;

                case "دفتر کار":
                    q = q.Where(x => x.office != "");
                    break;

                case "مغازه":
                    q = q.Where(x => x.maghaze != "");
                    break;
                }
            }
            if (log.malek != "")
            {
                q = q.Where(x => x.malek == log.malek);
            }
            if (log.mantaghe_id != "")
            {
                q = q.Where(x => x.mantaghe_id == log.mantaghe_id);
            }
            if (log.mantaghe_name != "")
            {
                string        mnt         = log.mantaghe_name.Substring(1, log.mantaghe_name.Length - 2);
                List <string> mantaghelst = mnt.Split(',').ToList();
                foreach (var mantaghe in mantaghelst)
                {
                    q = q.Where(x => x.mantaghe_name == mantaghe);
                }
            }
            if (log.masahat_from != "")
            {
                long needed = Convert.ToInt64(log.masahat_from);
                q = q.Where(x => x.zirbana1 >= needed || x.zirbana2 >= needed || x.zirbana3 >= needed);
            }
            if (log.masahat_to != "")
            {
                long needed = Convert.ToInt64(log.masahat_to);
                q = q.Where(x => x.zirbana1 <= needed || x.zirbana2 <= needed || x.zirbana3 <= needed);
            }
            if (log.masahat_zamin != "")
            {
                long needed = Convert.ToInt64(log.masahat_zamin);
                q = q.Where(x => x.masahat_zamin == needed);
            }
            if (log.metri_from != "")
            {
                long needed = Convert.ToInt64(log.metri_from);
                q = q.Where(x => x.tabaghe_1_metri >= needed || x.tabaghe_2_metri >= needed || x.tabaghe_3_metri >= needed);
            }
            if (log.metri_to != "")
            {
                long needed = Convert.ToInt64(log.metri_to);
                q = q.Where(x => x.tabaghe_1_metri <= needed || x.tabaghe_1_metri <= needed || x.tabaghe_1_metri <= needed);
            }
            if (log.mostaghellat != "")
            {
                q = q.Where(x => x.mostaghellat == log.mostaghellat);
            }
            if (log.office != "")
            {
                q = q.Where(x => x.office == log.office);
            }
            if (log.parking != "")
            {
                q = q.Where(x => x.parking3 == log.parking || x.parking3 == log.parking || x.parking3 == log.parking);
            }
            if (log.phones != "")
            {
                q = q.Where(x => x.phones.Contains(log.phones));
            }
            if (log.rahn_from != "")
            {
                long needed = Convert.ToInt64(log.rahn_from);
                q = q.Where(x => x.tabaghe_1_rahn >= needed || x.tabaghe_2_rahn >= needed || x.tabaghe_3_rahn >= needed);
            }
            if (log.rahn_to != "")
            {
                long needed = Convert.ToInt64(log.rahn_to);
                q = q.Where(x => x.tabaghe_1_rahn <= needed || x.tabaghe_2_rahn <= needed || x.tabaghe_3_rahn <= needed);
            }
            if (log.samt != "")
            {
                q = q.Where(x => x.samt == log.samt);
            }
            if (log.sell2khareji != "")
            {
                q = q.Where(x => x.sell2khareji == log.sell2khareji);
            }
            if (log.senn_from != "" && log.senn_to == "")
            {
                if (FUNS.IsDigitsOnly(log.senn_from))
                {
                    long needed = Convert.ToInt64(log.senn_from) - 2;
                    q = q.Where(x => x.senn >= needed || x.senn == 0);
                }
            }
            else if (log.senn_from == "" && log.senn_to != "")
            {
                if (FUNS.IsDigitsOnly(log.senn_to))
                {
                    long needed = Convert.ToInt64(log.senn_to) - 2;
                    q = q.Where(x => x.senn <= needed && x.senn != 1);
                }
            }
            else if (log.senn_from != "" && log.senn_to != "")
            {
                if (FUNS.IsDigitsOnly(log.senn_to) && FUNS.IsDigitsOnly(log.senn_from))
                {
                    long neededfrom = Convert.ToInt64(log.senn_from) - 2;
                    long neededto   = Convert.ToInt64(log.senn_to) - 2;
                    q = q.Where(x => x.senn <= neededto && x.senn >= neededfrom);
                }
            }
            if (log.seraydar != "")
            {
                q = q.Where(x => x.seraydar == log.seraydar);
            }
            if (log.suit != "")
            {
                q = q.Where(x => x.suit == log.suit);
            }
            if (log.tabaghe != "")
            {
                if (FUNS.IsDigitsOnly(log.tabaghe))
                {
                    long needed = Convert.ToInt64(log.tabaghe_from);
                    q = q.Where(x => x.tabaghe1 == needed || x.tabaghe2 == needed || x.tabaghe3 == needed);
                }
            }
            if (log.tabaghe_from != "")
            {
                if (FUNS.IsDigitsOnly(log.tabaghe_from))
                {
                    long needed = Convert.ToInt64(log.tabaghe_from);
                    q = q.Where(x => x.total_floor >= needed);
                }
            }
            if (log.tabaghe_to != "")
            {
                if (FUNS.IsDigitsOnly(log.tabaghe_to))
                {
                    long needed = Convert.ToInt64(log.tabaghe_to);
                    q = q.Where(x => x.total_floor >= needed);
                }
            }
            if (log.takhlie != "")
            {
                q = q.Where(x => x.takhlie == log.takhlie);
            }
            if (log.tarakom != "")
            {
                q = q.Where(x => x.tarakom == log.tarakom);
            }
            if (log.title != "")
            {
                q = q.Where(x => x.title.Contains(log.title));
            }
            if (log.toole_bar != "")
            {
                q = q.Where(x => x.toole_bar == log.toole_bar);
            }
            if (log.total_price_from != "")
            {
                if (FUNS.IsDigitsOnly(log.total_price_from))
                {
                    long needed = Convert.ToInt64(log.total_price_from);
                    q = q.Where(x => x.tabaghe_1_total_price >= needed || x.tabaghe_2_total_price >= needed || x.tabaghe_3_total_price >= needed);
                }
            }
            if (log.total_price_to != "")
            {
                if (FUNS.IsDigitsOnly(log.total_price_to))
                {
                    long needed = Convert.ToInt64(log.total_price_to);
                    q = q.Where(x => x.tabaghe_1_total_price <= needed || x.tabaghe_2_total_price <= needed || x.tabaghe_3_total_price <= needed);
                }
            }
            if (log.total_vahed != "")
            {
                long needed = Convert.ToInt64(log.total_vahed);
                q = q.Where(x => x.total_vahed == needed);
            }
            if (log.villa != "")
            {
                q = q.Where(x => x.villa == log.villa);
            }
            if (log.wc != "")
            {
                q = q.Where(x => x.wc1 == log.wc || x.wc2 == log.wc || x.wc3 == log.wc);
            }
            if (log.zirbana_from != "")
            {
                if (FUNS.IsDigitsOnly(log.zirbana_from))
                {
                    long needed = Convert.ToInt64(log.zirbana_from);
                    q = q.Where(x => x.zirbana1 <= needed || x.zirbana2 <= needed || x.zirbana3 <= needed);
                }
            }
            if (log.zirbana_to != "")
            {
                if (FUNS.IsDigitsOnly(log.zirbana_to))
                {
                    long needed = Convert.ToInt64(log.zirbana_from);
                    q = q.Where(x => x.zirbana1 >= needed || x.zirbana2 >= needed || x.zirbana3 >= needed);
                }
            }
            if (log.zirzamin != "")
            {
                q = q.Where(x => x.zirzamin == log.zirzamin);
            }

            list = q.ToList();
            return(list);
        }
Ejemplo n.º 4
0
        private void getDataFromServer()
        {
            BackgroundWorker getDataBackGroundWorker = new BackgroundWorker();

            getDataBackGroundWorker.WorkerSupportsCancellation = true;
            getDataBackGroundWorker.DoWork             += new DoWorkEventHandler(getDataBackGroundWorker_do);
            getDataBackGroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(getDataBackGroundWorker_done);

            try
            {
                queryModel model = new queryModel()
                {
                };

                model.apartment     = (apartment.SelectedValue == null) ? "" : apartment.SelectedValue.ToString();
                model.mantaghe_id   = (mantaghe_id.SelectedValue == null) ? "" : mantaghe_id.SelectedValue.ToString();
                model.villa         = (villa.SelectedValue == null) ? "" : villa.SelectedValue.ToString();
                model.kolangi       = (kolangi.SelectedValue == null) ? "" : kolangi.SelectedValue.ToString();
                model.mostaghellat  = (mostaghellat.SelectedValue == null) ? "" : mostaghellat.SelectedValue.ToString();
                model.office        = (office.SelectedValue == null) ? "" : office.SelectedValue.ToString();
                model.nama          = (nama.SelectedValue == null) ? "" : nama.SelectedValue.ToString();
                model.ashpazkhane   = (ashpazkhane.SelectedValue == null) ? "" : ashpazkhane.SelectedValue.ToString();
                model.mantaghe_name = GlobalVariable.mantagheIDes;

                model.anbari        = anbari.Checked ? "1" : "";
                model.asansor       = asansor.Checked ? "1" : "";
                model.hasEstakhr    = hasEstakhr.Checked ? "1" : "";
                model.hasJakoozi    = hasJakoozi.Checked ? "1" : "";
                model.hasSauna      = hasSauna.Checked ? "1" : "";
                model.isEjare       = isEjare.Checked ? "1" : "";
                model.isForoosh     = isForoosh.Checked ? "1" : "";
                model.isMoaveze     = isMoaveze.Checked ? "1" : "";
                model.isMosharekat  = isMosharekat.Checked ? "1" : "";
                model.isRahn        = isRahn.Checked ? "1" : "";
                model.sell2khareji  = sell2khareji.Checked ? "1" : "";
                model.seraydar      = hasSeraydar.Checked ? "1" : "";
                model.hasGym        = hasGym.Checked ? "1" : "";
                model.hasShooting   = hasShooting.Checked ? "1" : "";
                model.hasHall       = hasHall.Checked ? "1" : "";
                model.hasRoofGarden = hasRoofGarden.Checked ? "1" : "";
                model.isMoble       = isMoble.Checked ? "1" : "";
                model.parking       = parking.Checked ? "1" : "";
                model.labi          = labi.Checked ? "1" : "";
                model.parking       = parking.Checked ? "1" : "";

                model.address = address.Text;
                model.desc    = desc.Text;
                model.tabaghe = tabaghe.Text;
                GlobalVariable.searchTabghe = tabaghe.Text;
                model.phones = phones.Text;
                model.malek  = malek.Text;
                model.wc     = wc.Text;


                model.zirbana_from     = zirbana_from.Text;
                model.zirbana_to       = zirbana_to.Text;
                model.senn_from        = senn_from.Text;
                model.senn_to          = senn_to.Text;
                model.masahat_from     = masahat_from.Text;
                model.masahat_to       = masahat_to.Text;
                model.id_from          = id_from.Text;
                model.id_to            = id_to.Text;
                model.ID               = ID.Text;
                model.tabaghe_from     = tabaghe_from.Text;
                model.tabaghe_to       = tabaghe_to.Text;
                model.rahn_from        = rahn_from.Text;
                model.ejare_from       = ejare_from.Text;
                model.rahn_to          = rahn_to.Text;
                model.ejare_to         = ejare_to.Text;
                model.metri_from       = metri_from.Text;
                model.metri_to         = metri_to.Text;
                model.total_price_from = total_price_from.Text;
                model.total_price_to   = total_price_to.Text;
                model.date_from        = date_from.Text;
                model.date_to          = date_to.Text;
                model.bed_from         = bed_from.Text;
                model.bed_to           = bed_to.Text;



                string str = JsonConvert.SerializeObject(model);

                getDataBackGroundWorker.RunWorkerAsync(argument: str);
                refresh.Visible = true;
            }
            catch (Exception)
            {
                MessageBox.Show("فرم جستجو را کامل کنید ");
                return;
            }
        }