Exemplo n.º 1
0
        private void ItemDetail_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;



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


            List <Control> allControls = fontclass.GetAllControls(this);

            allControls.ForEach(k => k.Font = GlobalVariable.headerlistFONT);



            la7.Font  = GlobalVariable.headerlistFONTsmall;
            la8.Font  = GlobalVariable.headerlistFONTsmall;
            la9.Font  = GlobalVariable.headerlistFONTsmall;
            la10.Font = GlobalVariable.headerlistFONTsmall;
            la11.Font = GlobalVariable.headerlistFONTsmall;
            la12.Font = GlobalVariable.headerlistFONTsmall;
            la13.Font = GlobalVariable.headerlistFONTsmall;
            la14.Font = GlobalVariable.headerlistFONTsmall;
            la15.Font = GlobalVariable.headerlistFONTsmall;
            la09.Font = GlobalVariable.headerlistFONTsmall;
            la17.Font = GlobalVariable.headerlistFONTsmall;
            la18.Font = GlobalVariable.headerlistFONTsmall;
            la19.Font = GlobalVariable.headerlistFONTsmall;
            //la20.Font = GlobalVariable.headerlistFONTsmall;
            //la21.Font = GlobalVariable.headerlistFONTsmall;
            //la22.Font = GlobalVariable.headerlistFONTsmall;
            //label13.Font = GlobalVariable.headerlistFONTsmall;
            label12.Font = GlobalVariable.headerlistFONTsmall;
            la57.Font    = GlobalVariable.headerlistFONTsmall;

            this.MinimizeBox = true;
            this.MaximizeBox = true;
            whishon.Visible  = false;
            ListOfAdds.RootObject log = JsonConvert.DeserializeObject <ListOfAdds.RootObject>(GlobalVariable.result);

            InitControl();

            wishoff.Name       = "0-" + obj.ID;
            whishon.Name       = "1-" + obj.ID;
            saveToPrivate.Name = "2-" + obj.ID;
            next.Name          = "3-" + obj.ID;
            back.Name          = "4-" + obj.ID;

            string ideas = Settings1.Default.ides;

            if (ideas.Contains("," + obj.ID))
            {
                wishoff.Visible = false;
                whishon.Visible = true;
            }
            else
            {
                whishon.Visible = false;
                wishoff.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            item   newitem          = new item();
            string result           = "";
            var    backgroundWorker = sender as BackgroundWorker;
            int    progress         = 0;
            string lastDate         = "";
            int    allStepes        = 0;
            int    stepesGone       = 1;

            bool goOn = true;

            while (goOn)
            {
                using (WebClient client = new WebClient())
                {
                    var collection = new System.Collections.Specialized.NameValueCollection();
                    collection.Add("serial-number", Settings1.Default.SerialNumber);
                    collection.Add("after-date", lastDate);
                    collection.Add("before-date", DDFROM.Text);


                    //  string json = JsonConvert.SerializeObject(collection, Formatting.Indented);
                    byte[] response =
                        client.UploadValues("http://Arvandfile.com/api/v2/files", collection);


                    result = System.Text.Encoding.UTF8.GetString(response);


                    ListOfAdds.RootObject log = JsonConvert.DeserializeObject <ListOfAdds.RootObject>(result);
                    if (log.status == 200)
                    {
                        if (lastDate == "")
                        {
                            if (log.data.total_count % 100 == 0)
                            {
                                allStepes = log.data.total_count / 100;
                            }
                            else
                            {
                                allStepes = log.data.total_count / 100 + 1;
                            }
                        }

                        foreach (var file in log.data.files)
                        {
                            string phone = "";

                            //foreach (var item in JsonConvert.DeserializeObject<List<string>>(file.phones))
                            //{
                            //    if (item != "")
                            //    {
                            //        phone = phone + item + ",";
                            //    }
                            //}
                            newitem.phones              = file.phones;
                            newitem.apartment           = file.apartment;
                            newitem.ashpazkhane         = file.ashpazkhane;
                            newitem.ashpazkhane1        = file.ashpazkhane1;
                            newitem.ashpazkhane2        = file.ashpazkhane2;
                            newitem.ashpazkhane3        = file.ashpazkhane3;
                            newitem.garmayesh_sarmayesh = file.garmayesh_sarmayesh;
                            newitem.gozar                 = file.gozar;
                            newitem.kaf_type              = file.kaf_type;
                            newitem.kolangi               = file.kolangi;
                            newitem.mantaghe_id           = file.mantaghe_id;
                            newitem.mantaghe_name         = file.mantaghe_name;
                            newitem.masahat_zamin         = Convert.ToInt64(file.masahat_zamin);
                            newitem.mostaghellat          = file.mostaghellat;
                            newitem.office                = file.office;
                            newitem.samt                  = file.samt;
                            newitem.sanad                 = file.sanad;
                            newitem.seraydar              = file.seraydar;
                            newitem.villa                 = file.villa;
                            newitem.wc1                   = file.wc1;
                            newitem.wc2                   = file.wc2;
                            newitem.wc3                   = file.wc3;
                            newitem.wc3                   = file.wc3;
                            newitem.address               = file.address + file.address2 + file.address3;
                            newitem.address1              = file.address;
                            newitem.address2              = file.address2;
                            newitem.address3              = file.address3;
                            newitem.anbari1               = file.anbari1;
                            newitem.anbari2               = file.anbari2;
                            newitem.anbari3               = file.anbari3;
                            newitem.asansor1              = file.asansor1;
                            newitem.asansor2              = file.asansor2;
                            newitem.asansor3              = file.asansor3;
                            newitem.desc                  = file.desc;
                            newitem.ertefa                = file.ertefa;
                            newitem.eslahi                = file.eslahi;
                            newitem.hasEstakhr            = file.hasEstakhr;
                            newitem.hasJakoozi            = file.hasJakoozi;
                            newitem.hasSauna              = file.hasSauna;
                            newitem.number                = Convert.ToInt64(file.ID);
                            newitem.isEjare               = file.isEjare;
                            newitem.isForoosh             = file.isForoosh;
                            newitem.isMoaveze             = file.isMoaveze;
                            newitem.isMosharekat          = file.isMosharekat;
                            newitem.isRahn                = file.isRahn;
                            newitem.maghaze               = file.maghaze;
                            newitem.malek                 = file.malek;
                            newitem.sell2khareji          = file.sell2khareji;
                            newitem.suit                  = file.suit;
                            newitem.tabaghe_1_ejare       = Convert.ToInt64(file.tabaghe_1_ejare);
                            newitem.tabaghe_1_metri       = Convert.ToInt64(file.tabaghe_1_metri);
                            newitem.tabaghe_1_rahn        = Convert.ToInt64(file.tabaghe_1_rahn);
                            newitem.tabaghe_1_total_price = Convert.ToInt64(file.tabaghe_1_total_price);
                            newitem.tabaghe_2_ejare       = Convert.ToInt64(file.tabaghe_2_ejare);
                            newitem.tabaghe_2_metri       = Convert.ToInt64(file.tabaghe_2_metri);
                            newitem.tabaghe_2_rahn        = Convert.ToInt64(file.tabaghe_2_rahn);
                            newitem.tabaghe_2_total_price = Convert.ToInt64(file.tabaghe_2_total_price);
                            newitem.tabaghe_3_ejare       = Convert.ToInt64(file.tabaghe_3_ejare);
                            newitem.tabaghe_3_metri       = Convert.ToInt64(file.tabaghe_3_metri);
                            newitem.tabaghe_3_rahn        = Convert.ToInt64(file.tabaghe_3_rahn);
                            newitem.tabaghe_3_total_price = Convert.ToInt64(file.tabaghe_3_total_price);

                            newitem.tabaghe1 = Convert.ToInt64(file.tabaghe1);
                            newitem.tabaghe2 = Convert.ToInt64(file.tabaghe2);
                            newitem.tabaghe3 = Convert.ToInt64(file.tabaghe3);
                            newitem.bed1     = Convert.ToInt64(file.bed1);
                            newitem.bed2     = Convert.ToInt64(file.bed2);
                            newitem.bed3     = Convert.ToInt64(file.bed3);

                            newitem.zirbana1 = Convert.ToInt64(file.zirbana1);
                            newitem.zirbana2 = Convert.ToInt64(file.zirbana2);
                            newitem.zirbana3 = Convert.ToInt64(file.zirbana3);

                            newitem.takhlie         = file.takhlie;
                            newitem.tarakom         = file.tarakom;
                            newitem.title           = file.title;
                            newitem.toole_bar       = file.toole_bar;
                            newitem.total_floor     = Convert.ToInt64(file.total_floor);
                            newitem.total_vahed     = Convert.ToInt64(file.total_vahed);
                            newitem.vahed_per_floor = Convert.ToInt64(file.vahed_per_floor);

                            newitem.zirzamin = file.zirzamin;

                            newitem.balkon1 = file.balkon1;
                            newitem.balkon2 = file.balkon2;
                            newitem.balkon3 = file.balkon3;


                            newitem.hasGym        = file.hasGym;
                            newitem.hasHall       = file.hasHall;
                            newitem.hasLobbyMan   = file.hasLobbyMan;
                            newitem.hasRoofGarden = file.hasRoofGarden;
                            newitem.hasShooting   = file.hasShooting;
                            newitem.isMoble       = file.isMoble;
                            newitem.parking1      = file.parking1;
                            newitem.parking2      = file.parking2;
                            newitem.parking3      = file.parking3;
                            newitem.senn          = Convert.ToInt32(file.senn);
                            newitem.tabdil        = file.tabdil;
                            newitem.no_tabdit     = file.no_tabdil;
                            newitem.date_updated  = Convert.ToDateTime(file.date_updated);
                            manager.additem(newitem);
                            if (log.data.files.IndexOf(file) == 99)
                            {
                                lastDate = file.date_updated;
                            }
                        }
                        progress = (stepesGone * 100) / allStepes;
                        if (progress >= 1)
                        {
                            backgroundWorker.ReportProgress(progress);
                        }
                        //  MessageBox.Show("با موفقیت دانلود شد");
                    }
                    else
                    {
                        if (log.status == 403)
                        {
                            backgroundWorker.CancelAsync();

                            return;
                        }
                    }
                }

                if (stepesGone == allStepes)
                {
                    goOn = false;
                }
                stepesGone += 1;
            }
        }
Exemplo n.º 3
0
        private void getDataBackGroundWorker_done(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                if (e.Result == "error")
                {
                    refresh.Visible = false;
                }
                else
                {
                    ListOfAdds.RootObject log = JsonConvert.DeserializeObject <ListOfAdds.RootObject>(GlobalVariable.result);

                    if (log == null)
                    {
                        List <Form> openForms = new List <Form>();

                        foreach (Form f in Application.OpenForms)
                        {
                            openForms.Add(f);
                        }

                        foreach (Form f in openForms)
                        {
                            if (f.Name != "Form3")
                            {
                                f.Close();
                            }
                        }

                        return;
                    }
                    if (GlobalVariable.RowIDList.Count() > 0)
                    {
                        GlobalVariable.RowIDList.Clear();
                    }

                    foreach (var item in log.result.data)
                    {
                        GlobalVariable.RowIDList.Add(item.ID);
                    }
                    GlobalVariable.fromwhere = "main";

                    Form1   form1 = new Form1();
                    Control clt0  = form1.Controls.Find("flowLayoutPanel1", true).First();
                    clt0.BackgroundImage = null;

                    Control clt = form1.Controls.Find("radListView1", true).First();
                    clt.Visible = true;

                    Control clt2 = form1.Controls.Find("searchpanel", true).First();
                    clt2.Visible = true;

                    Control clt3 = form1.Controls.Find("dissconnect", true).First();
                    clt3.Visible = false;

                    Control clt4 = form1.Controls.Find("connect", true).First();
                    clt4.Visible = true;


                    form1.Show();
                    //this.Close();
                    refresh.Visible = false;
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("موردی وجود ندارد");
                refresh.Visible = false;
            }
        }
Exemplo n.º 4
0
        private void getDataVerify_Click(object sender, EventArgs e)
        {
            item   newitem = new item();
            string result  = "";

            using (WebClient client = new WebClient())
            {
                var collection = new System.Collections.Specialized.NameValueCollection();
                collection.Add("token", "9aef7e0f3117d25dc3cdae90b83111d5");

                collection.Add("limit", "1000");

                //  string json = JsonConvert.SerializeObject(collection, Formatting.Indented);
                byte[] response =
                    client.UploadValues("http://arvandfile.com/api/v1/listOfFiles.php", collection);

                result = System.Text.Encoding.UTF8.GetString(response);
                ListOfAdds.RootObject log = JsonConvert.DeserializeObject <ListOfAdds.RootObject>(result);
                foreach (var file in log.result.data)
                {
                    newitem.phones  = file.phones;
                    newitem.address = file.address;

                    newitem.anbari1  = file.anbari1;
                    newitem.anbari2  = file.anbari2;
                    newitem.anbari3  = file.anbari3;
                    newitem.asansor1 = file.asansor1;
                    newitem.asansor2 = file.asansor2;
                    newitem.asansor3 = file.asansor3;


                    newitem.desc         = file.desc;
                    newitem.ertefa       = file.ertefa;
                    newitem.eslahi       = file.eslahi;
                    newitem.hasEstakhr   = file.hasEstakhr;
                    newitem.hasJakoozi   = file.hasJakoozi;
                    newitem.hasSauna     = file.hasSauna;
                    newitem.number       = Convert.ToInt64(file.ID);
                    newitem.isEjare      = file.isEjare;
                    newitem.isForoosh    = file.isForoosh;
                    newitem.isMoaveze    = file.isMoaveze;
                    newitem.isMosharekat = file.isMosharekat;
                    newitem.isRahn       = file.isRahn;

                    newitem.maghaze = file.maghaze;
                    newitem.malek   = file.malek;

                    newitem.sell2khareji = file.sell2khareji;

                    newitem.suit = file.suit;

                    newitem.tabaghe_1_ejare       = Convert.ToInt64(file.tabaghe_1_ejare);
                    newitem.tabaghe_1_metri       = Convert.ToInt64(file.tabaghe_1_metri);
                    newitem.tabaghe_1_rahn        = Convert.ToInt64(file.tabaghe_1_rahn);
                    newitem.tabaghe_1_total_price = Convert.ToInt64(file.tabaghe_1_total_price);
                    newitem.tabaghe_2_ejare       = Convert.ToInt64(file.tabaghe_2_ejare);
                    newitem.tabaghe_2_metri       = Convert.ToInt64(file.tabaghe_2_metri);
                    newitem.tabaghe_2_rahn        = Convert.ToInt64(file.tabaghe_2_rahn);
                    newitem.tabaghe_2_total_price = Convert.ToInt64(file.tabaghe_2_total_price);
                    newitem.tabaghe_3_ejare       = Convert.ToInt64(file.tabaghe_3_ejare);
                    newitem.tabaghe_3_metri       = Convert.ToInt64(file.tabaghe_3_metri);
                    newitem.tabaghe_3_rahn        = Convert.ToInt64(file.tabaghe_3_rahn);
                    newitem.tabaghe_3_total_price = Convert.ToInt64(file.tabaghe_3_total_price);

                    newitem.tabaghe1 = Convert.ToInt64(file.tabaghe1);
                    newitem.tabaghe2 = Convert.ToInt64(file.tabaghe2);
                    newitem.tabaghe3 = Convert.ToInt64(file.tabaghe3);
                    newitem.bed1     = Convert.ToInt64(file.bed1);
                    newitem.bed2     = Convert.ToInt64(file.bed2);
                    newitem.bed3     = Convert.ToInt64(file.bed3);

                    newitem.zirbana1 = Convert.ToInt64(file.zirbana1);
                    newitem.zirbana2 = Convert.ToInt64(file.zirbana2);
                    newitem.zirbana3 = Convert.ToInt64(file.zirbana3);

                    newitem.takhlie         = file.takhlie;
                    newitem.tarakom         = file.tarakom;
                    newitem.title           = file.title;
                    newitem.toole_bar       = file.toole_bar;
                    newitem.total_floor     = Convert.ToInt64(file.total_floor);
                    newitem.total_vahed     = Convert.ToInt64(file.total_vahed);
                    newitem.vahed_per_floor = Convert.ToInt64(file.vahed_per_floor);

                    newitem.zirzamin = file.zirzamin;

                    newitem.balkon1 = file.balkon1;
                    newitem.balkon2 = file.balkon2;
                    newitem.balkon3 = file.balkon3;


                    newitem.hasGym        = file.hasGym;
                    newitem.hasHall       = file.hasHall;
                    newitem.hasLobbyMan   = file.hasLobbyMan;
                    newitem.hasRoofGarden = file.hasRoofGarden;
                    newitem.hasShooting   = file.hasShooting;
                    newitem.isMoble       = file.isMoble;
                    newitem.parking1      = file.parking1;
                    newitem.parking2      = file.parking2;
                    newitem.parking3      = file.parking3;
                    newitem.senn          = Convert.ToInt32(file.senn);

                    newitem.date_updated = file.date_updated.ToGeorgianDateTime();
                    manager.additem(newitem);
                }
                MessageBox.Show("با موفقیت دانلود شد");
            }
        }