예제 #1
0
파일: Form7.cs 프로젝트: merioli/Arvand
            public override void Synchronize()
            {
                base.Synchronize();
                this.Text = "";
                DataRowView rowView = this.Row.DataBoundItem as DataRowView;

                try
                {
                    string tabaghe    = GlobalVariable.searchTabghe;
                    string fullprice  = "tabaghe_1_total_price";
                    string metriprice = "tabaghe_1_metri";
                    string rahnprice  = "tabaghe_1_rahn";
                    string ejareprice = "tabaghe_1_ejare";
                    string tabagh     = "tabaghe1";
                    string kha        = "bed1";
                    string zirban     = "zirbana1";

                    if (tabaghe != "")
                    {
                        fullprice  = "tabaghe_" + tabaghe + "_price";
                        metriprice = "tabaghe_" + tabaghe + "_metri";
                        rahnprice  = "tabaghe_" + tabaghe + "_rahn";
                        ejareprice = "tabaghe_" + tabaghe + "_ejare";
                        tabagh     = "tabaghe" + tabaghe;
                        kha        = "bed" + tabaghe;
                        zirban     = "zirban" + tabaghe;
                    }


                    string serverid = rowView.Row["ID"].ToString();
                    string date     = rowView.Row["date_updated"].ToString();
                    string owner    = rowView.Row["ID"].ToString();
                    string melkkind = "";

                    try
                    {
                        if (Convert.ToInt32(rowView.Row["apartment"].ToString()) > 0)
                        {
                            melkkind = melkkind + "آپارتمان،";
                        }
                        if (Convert.ToInt32(rowView.Row["villa"].ToString()) > 0)
                        {
                            melkkind = melkkind + "ویلا،";
                        }
                        if (Convert.ToInt32(rowView.Row["mostaghellat"].ToString()) > 0)
                        {
                            melkkind = melkkind + "مستغلات،";
                        }
                        if (Convert.ToInt32(rowView.Row["kolangi"].ToString()) > 0)
                        {
                            melkkind = melkkind + "کلنگی،";
                        }
                        if (Convert.ToInt32(rowView.Row["office"].ToString()) > 0)
                        {
                            melkkind = melkkind + "دفتر،";
                        }
                        if (melkkind.Length > 0)
                        {
                            melkkind = melkkind.Remove(melkkind.Length - 1, 1);
                        }
                    }
                    catch (Exception)
                    {
                    }


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



                    string totalrahn  = rowView.Row["isForoosh"].ToString() == "1" ? rowView.Row[fullprice].ToString() : rowView.Row[rahnprice].ToString();
                    string metriejare = rowView.Row["isForoosh"].ToString() == "1" ? rowView.Row[metriprice].ToString() : rowView.Row[ejareprice].ToString();


                    string Rtabaghe = rowView.Row[tabagh].ToString();
                    string khab     = rowView.Row[kha].ToString();
                    string zirbana  = rowView.Row[zirban].ToString();



                    bool mycheckbox = false;
                    totalrahn = totalrahn.Replace(".", "");
                    if (totalrahn == "0")
                    {
                        totalrahn = "-";
                    }
                    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 = "-";
                    }
                    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;
                    }

                    obj.setTitle(serverid, date, owner, melkkind, Dealkind, totalrahn, metriejare, Rtabaghe, khab, zirbana, mycheckbox);
                }
                catch (Exception)
                {
                    obj.setTitle("", "", "", "", "", "", "", "", "", "", false);
                }
                // DataRowView rowView = this.Row.DataBoundItem as DataRowView;

                //this.button.Text = "ddd";
            }
예제 #2
0
파일: Form7.cs 프로젝트: puremere/Arvand
            public override void Synchronize()
            {
                base.Synchronize();
                this.Text = "";
                DataRowView rowView = this.Row.DataBoundItem as DataRowView;

                string tabaghe = GlobalVariable.searchTabghe;

                string fullprice  = "tabaghe_1_total_price";
                string metriprice = "tabaghe_1_metri";
                string rahnprice  = "tabaghe_1_rahn";
                string ejareprice = "tabaghe_1_ejare";
                string tabagh     = "tabaghe1";
                string kha        = "bed1";
                string zirban     = "zirbana1";
                string tb1        = rowView.Row["tabaghe1"].ToString();
                string tb2        = rowView.Row["tabaghe2"].ToString();
                string tb3        = rowView.Row["tabaghe3"].ToString();

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

                CatsAndAreasObject CATS = new CatsAndAreasObject();

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

                string serverid = rowView.Row["ID"].ToString();
                string date     = rowView.Row["date_updated"].ToString();
                string address  = rowView.Row["address"].ToString();
                string owner    = rowView.Row["malek"].ToString();
                string senn     = rowView.Row["senn"].ToString() == "0" ? "-" : (from q in CATS.result.senn
                                                                                 where q.ID == rowView.Row["senn"].ToString()
                                                                                 select q.title).First();
                //if (rowView.Row["senn"].ToString() == "1")
                //{
                //    senn = "قدیمی";
                //}
                //else if (rowView.Row["senn"].ToString() == "2")
                //{
                //    senn = "نوساز";
                //}
                //else
                //{
                //    senn =(int.Parse(rowView.Row["senn"].ToString()) - 2).ToString();
                //}
                string melkkind = "";

                if (Convert.ToInt32(rowView.Row["maghaze"].ToString()) > 0)
                {
                    melkkind = melkkind + "مغازه،";
                }
                if (Convert.ToInt32(rowView.Row["apartment"].ToString()) > 0)
                {
                    melkkind = melkkind + "آپارتمان،";
                }
                if (Convert.ToInt32(rowView.Row["villa"].ToString()) > 0)
                {
                    melkkind = melkkind + "ویلا،";
                }
                if (Convert.ToInt32(rowView.Row["mostaghellat"].ToString()) > 0)
                {
                    melkkind = melkkind + "مستغلات،";
                }
                if (Convert.ToInt32(rowView.Row["kolangi"].ToString()) > 0)
                {
                    melkkind = melkkind + "کلنگی،";
                }
                if (Convert.ToInt32(rowView.Row["office"].ToString()) > 0)
                {
                    melkkind = melkkind + "دفتر،";
                }
                if (melkkind.Length > 0)
                {
                    melkkind = melkkind.Remove(melkkind.Length - 1, 1);
                }

                string Dealkind = "";

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


                string totalrahn  = rowView.Row["isForoosh"].ToString() == "1" ? rowView.Row[fullprice].ToString() : rowView.Row[rahnprice].ToString();
                string metriejare = rowView.Row["isForoosh"].ToString() == "1" ? rowView.Row[metriprice].ToString() : rowView.Row[ejareprice].ToString();


                string Rtabaghe = rowView.Row[tabagh].ToString();
                string khab     = rowView.Row[kha].ToString();
                string zirbana  = rowView.Row[zirban].ToString();



                bool mycheckbox = false;

                totalrahn = totalrahn.Replace(".", "");
                if (totalrahn == "0")
                {
                    totalrahn = "-";
                }
                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 = "-";
                }
                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;
                }

                obj.setTitle(serverid, date, owner, melkkind, Dealkind, totalrahn, metriejare, Rtabaghe, khab, zirbana, mycheckbox, address, senn);



                // DataRowView rowView = this.Row.DataBoundItem as DataRowView;

                //this.button.Text = "ddd";
            }