//private void pictureBox2_Click(object sender, EventArgs e) //{ // // string search = searchTextBox.Text; // string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); // string allobject = System.IO.File.ReadAllText(filepath); // List<ListOfAdds.Datum> list = new List<ListOfAdds.Datum>(); // List<ListOfAdds.Datum> list2 = new List<ListOfAdds.Datum>(); // ListOfAdds.Datum obj = new ListOfAdds.Datum(); // try // { // list2 = JsonConvert.DeserializeObject<List<ListOfAdds.Datum>>(allobject); // } // catch (Exception) // { // obj = JsonConvert.DeserializeObject<ListOfAdds.Datum>(allobject); // } // if (list2 != null) // { // foreach (var item in list2) // { // list.Add(item); // } // } // List<ListOfAdds.Datum> selected = list.Where(x => x.title.Contains(search)).Select(x => x).ToList(); // this.radListView1.VisualItemFormatting += new Telerik.WinControls.UI.ListViewVisualItemEventHandler(radListView1_VisualItemFormatting); // this.radListView1.CellCreating += new Telerik.WinControls.UI.ListViewCellElementCreatingEventHandler(radListView1_CellCreating); // this.radListView1.ColumnCreating += new ListViewColumnCreatingEventHandler(radListView1_ColumnCreating); // this.radListView1.CellFormatting += new Telerik.WinControls.UI.ListViewCellFormattingEventHandler(radListView1_CellFormatting); // radListView1.DataSource = ConvertToDataTable(selected); // this.radListView1.ValueMember = "server_id"; // radListView1.ViewType = ListViewType.DetailsView; // radListView1.ShowColumnHeaders = false; // radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // // radListView1.Columns["title"]. // radListView1.ItemSize = new Size(0, 100); //} public void getdata() { string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); string allobject = System.IO.File.ReadAllText(filepath); List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } foreach (var item in list2) { list.Add(item); } this.radListView1.VisualItemFormatting += new Telerik.WinControls.UI.ListViewVisualItemEventHandler(radListView1_VisualItemFormatting); this.radListView1.CellCreating += new Telerik.WinControls.UI.ListViewCellElementCreatingEventHandler(radListView1_CellCreating); this.radListView1.ColumnCreating += new ListViewColumnCreatingEventHandler(radListView1_ColumnCreating); this.radListView1.CellFormatting += new Telerik.WinControls.UI.ListViewCellFormattingEventHandler(radListView1_CellFormatting); radListView1.DataSource = ConvertToDataTable(list); this.radListView1.ValueMember = "ID"; radListView1.ViewType = ListViewType.DetailsView; radListView1.ShowColumnHeaders = false; radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // radListView1.Columns["title"]. radListView1.ItemSize = new Size(0, 100); }
private void Form7_Load(object sender, EventArgs e) { this.MinimizeBox = false; this.MaximizeBox = false; add.Font = GlobalVariable.headerlistFONT; label2.Font = GlobalVariable.headerlistFONT; label5.Font = GlobalVariable.headerlistFONT; label26.Font = GlobalVariable.headerlistFONT; label27.Font = GlobalVariable.headerlistFONT; // label28.Font = GlobalVariable.headerlistFONT; width = SystemInformation.VirtualScreen.Width; string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); string allobject = System.IO.File.ReadAllText(filepath); List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } if (list2 != null) { foreach (var item in list2) { list.Add(item); } if (list.Count > 0) { this.radListView1.VisualItemFormatting += new Telerik.WinControls.UI.ListViewVisualItemEventHandler(radListView1_VisualItemFormatting); this.radListView1.CellCreating += new Telerik.WinControls.UI.ListViewCellElementCreatingEventHandler(radListView1_CellCreating); this.radListView1.ColumnCreating += new ListViewColumnCreatingEventHandler(radListView1_ColumnCreating); this.radListView1.CellFormatting += new Telerik.WinControls.UI.ListViewCellFormattingEventHandler(radListView1_CellFormatting); radListView1.DataSource = ConvertToDataTable(list); this.radListView1.ValueMember = "ID"; radListView1.ViewType = ListViewType.DetailsView; radListView1.ShowColumnHeaders = false; radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // radListView1.Columns["title"]. radListView1.ItemSize = new Size(0, 33); } } }
private void radListView1_DoubleClick(object sender, EventArgs e) { GlobalVariable.fromwhere = "sub"; GlobalVariable.selectedOwnObject = new ListOfAdds.Datum(); string allobject = ""; var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string path = Path.Combine(directory, "Arvand", "objects.txt"); if (System.IO.File.Exists(path) == false) { Directory.CreateDirectory(Path.GetDirectoryName(path)); using (FileStream fs = new FileStream(path, FileMode.Create)) { } } using (StreamReader sr = new StreamReader(path, true)) { allobject = sr.ReadToEnd(); } List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } if (list2 != null) { foreach (var item in list2) { list.Add(item); } } string selectedindex = radListView1.SelectedItem.Value.ToString(); ListOfAdds.Datum selected = list.Where(x => x.ID == selectedindex).FirstOrDefault(); GlobalVariable.selectedOwnObject = selected; manageFile form6 = new manageFile(); form6.Show(); }
//private void pictureBox2_Click(object sender, EventArgs e) //{ // // string search = searchTextBox.Text; // string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); // string allobject = System.IO.File.ReadAllText(filepath); // List<ListOfAdds.Datum> list = new List<ListOfAdds.Datum>(); // List<ListOfAdds.Datum> list2 = new List<ListOfAdds.Datum>(); // ListOfAdds.Datum obj = new ListOfAdds.Datum(); // try // { // list2 = JsonConvert.DeserializeObject<List<ListOfAdds.Datum>>(allobject); // } // catch (Exception) // { // obj = JsonConvert.DeserializeObject<ListOfAdds.Datum>(allobject); // } // if (list2 != null) // { // foreach (var item in list2) // { // list.Add(item); // } // } // List<ListOfAdds.Datum> selected = list.Where(x => x.title.Contains(search)).Select(x => x).ToList(); // this.radListView1.VisualItemFormatting += new Telerik.WinControls.UI.ListViewVisualItemEventHandler(radListView1_VisualItemFormatting); // this.radListView1.CellCreating += new Telerik.WinControls.UI.ListViewCellElementCreatingEventHandler(radListView1_CellCreating); // this.radListView1.ColumnCreating += new ListViewColumnCreatingEventHandler(radListView1_ColumnCreating); // this.radListView1.CellFormatting += new Telerik.WinControls.UI.ListViewCellFormattingEventHandler(radListView1_CellFormatting); // radListView1.DataSource = ConvertToDataTable(selected); // this.radListView1.ValueMember = "server_id"; // radListView1.ViewType = ListViewType.DetailsView; // radListView1.ShowColumnHeaders = false; // radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // // radListView1.Columns["title"]. // radListView1.ItemSize = new Size(0, 100); //} public void getdata() { string allobject = ""; var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string path = Path.Combine(directory, "Arvand", "objects.txt"); if (System.IO.File.Exists(path) == false) { Directory.CreateDirectory(Path.GetDirectoryName(path)); using (FileStream fs = new FileStream(path, FileMode.Create)) { } } using (StreamReader sr = new StreamReader(path, true)) { allobject = sr.ReadToEnd(); } List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } foreach (var item in list2) { list.Add(item); } this.radListView1.VisualItemFormatting += new Telerik.WinControls.UI.ListViewVisualItemEventHandler(radListView1_VisualItemFormatting); this.radListView1.CellCreating += new Telerik.WinControls.UI.ListViewCellElementCreatingEventHandler(radListView1_CellCreating); this.radListView1.ColumnCreating += new ListViewColumnCreatingEventHandler(radListView1_ColumnCreating); this.radListView1.CellFormatting += new Telerik.WinControls.UI.ListViewCellFormattingEventHandler(radListView1_CellFormatting); radListView1.DataSource = ConvertToDataTable(list); this.radListView1.ValueMember = "ID"; radListView1.ViewType = ListViewType.DetailsView; radListView1.ShowColumnHeaders = false; radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // radListView1.Columns["title"]. radListView1.ItemSize = new Size(0, 100); }
private void manageFile_Load(object sender, EventArgs e) { List <Control> allControls = fontclass.GetAllControls(this); allControls.ForEach(k => k.Font = GlobalVariable.headerlistFONT); if (GlobalVariable.isadmin == "1") { CATS = JsonConvert.DeserializeObject <CatsAndAreasObject>(GlobalVariable.newCatsAndAreas); } else { CATS = GlobalVariable.catsAndAreas; } if (GlobalVariable.fromwhere6 == "main") { delete.Visible = false; deletepanel.Visible = false; } this.MinimizeBox = false; this.MaximizeBox = false; if (GlobalVariable.selectedOwnObject != null) { obj = GlobalVariable.selectedOwnObject; InitControl(); } else { if (GlobalVariable.isadmin == "1") { setcat(); } else { setcatforclient(); } } }
private void radListView1_DoubleClick(object sender, EventArgs e) { GlobalVariable.fromwhere = "sub"; GlobalVariable.selectedOwnObject = new ListOfAdds.Datum(); string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); string allobject = System.IO.File.ReadAllText(filepath); List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } if (list2 != null) { foreach (var item in list2) { list.Add(item); } } string selectedindex = radListView1.SelectedItem.Value.ToString(); ListOfAdds.Datum selected = list.Where(x => x.ID == selectedindex).Select(x => x).Single(); GlobalVariable.selectedOwnObject = selected; Form6 form6 = new Form6(); form6.Show(); }
private void confirm_Click(object sender, EventArgs e) { if (title.Text != "") { string filepath = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); string allobject = System.IO.File.ReadAllText(filepath); List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } if (list2 != null) { foreach (var item in list2) { list.Add(item); } } if (obj.title != null) { list.Add(obj); } string id = ""; if (ID.Text != "") { id = ID.Text; list.RemoveAll(p => p.ID == id); } else { id = RandomString(10); } List <string> PHNS = new List <string>(); PHNS.Add(phone1.Text); PHNS.Add(phone2.Text); PHNS.Add(phone3.Text); PHNS.Add(phone4.Text); ListOfAdds.Datum model = new ListOfAdds.Datum() { address = address.Text, anbari1 = anbari1.Checked ? "1" : "0", anbari2 = anbari2.Checked ? "1" : "0", anbari3 = anbari3.Checked ? "1" : "0", apartment = apartment.Text, asansor1 = asansor1.Checked ? "1" : "0", asansor2 = asansor2.Checked ? "1" : "0", asansor3 = asansor3.Checked ? "1" : "0", ashpazkhane1 = ashpazkhane1.Text, ashpazkhane2 = ashpazkhane2.Text, ashpazkhane3 = ashpazkhane3.Text, garmayesh_sarmayesh = garmayesh_sarmayesh.Text, desc = desc.Text, ertefa = ertefa.Text, eslahi = eslahi.Text, hasEstakhr = hasEstakhr.Checked ? "1" : "0", hasJakoozi = hasJakoozi.Checked ? "1" : "0", hasSauna = hasSauna.Checked ? "1" : "0", ID = id, isEjare = isEjare.Checked ? "1" : "0", isForoosh = isForoosh.Checked ? "1" : "0", isMoaveze = isMoaveze.Checked ? "1" : "0", isMosharekat = isMosharekat.Checked ? "1" : "0", isRahn = isRahn.Checked ? "1" : "0", kaf_type = kaf_type.Text, kolangi = kolangi.Text, maghaze = maghaze.Checked ? "1" : "0", malek = owner.Text, mantaghe_id = mantaghe_id.Text, mantaghe_name = mantaghe_name.Text, masahat_zamin = masahat_zamin.Text, mostaghellat = mostaghellat.Text, office = office.Text, phones = PHNS, samt = samt.Text, sell2khareji = sell2khareji.Checked ? "1" : "0", senn = senn.Text, seraydar = seraydar.Text, suit = suit.Checked ? "1" : "0", tabaghe_1_ejare = tabaghe_1_ejare.Text, tabaghe_1_metri = tabaghe_1_metri.Text, tabaghe_1_rahn = tabaghe_1_rahn.Text, tabaghe_1_total_price = tabaghe_1_total_price.Text, tabaghe_2_ejare = tabaghe_2_ejare.Text, tabaghe_2_metri = tabaghe_2_metri.Text, tabaghe_2_rahn = tabaghe_2_rahn.Text, tabaghe_2_total_price = tabaghe_2_total_price.Text, tabaghe_3_ejare = tabaghe_3_ejare.Text, tabaghe_3_metri = tabaghe_3_metri.Text, tabaghe_3_rahn = tabaghe_3_rahn.Text, tabaghe_3_total_price = tabaghe_3_total_price.Text, takhlie = takhlie.Checked ? "1" : "0", tarakom = tarakom.Text, title = title.Text, toole_bar = toole_bar.Text, total_floor = total_floor.Text, total_vahed = total_vahed.Text, villa = villa.Text, zirzamin = zirzamin.Text, tabaghe1 = tabaghe1.Text, tabaghe2 = tabaghe2.Text, tabaghe3 = tabaghe3.Text, balkon1 = balkon1.Text, balkon2 = balkon2.Text, balkon3 = balkon3.Text, bed1 = khab1.Text, bed2 = khab2.Text, bed3 = khab3.Text, date_updated = date_updated.Text, hasGym = hasGym.Checked ? "1" : "0", hasHall = hasHall.Checked ? "1" : "0", hasLobbyMan = hasLobbyMan.Checked ? "1" : "0", hasRoofGarden = hasRoofGarden.Checked ? "1" : "0", hasShooting = hasShooting.Checked ? "1" : "0", isMoble = isMoble.Checked ? "1" : "0", parking1 = parking1.Text, parking2 = parking2.Text, parking3 = parking3.Text, sanad = sanad.Text, zirbana1 = zirbana1.Text, zirbana2 = zirbana2.Text, zirbana3 = zirbana3.Text }; list.Add(model); string jsonmodel = JsonConvert.SerializeObject(list); try { string path = Path.Combine(Application.StartupPath, "Resources", "objects.txt"); System.IO.File.WriteAllText(path, jsonmodel); MessageBox.Show("تغییرات مورد نظر با موفقیت انجام شد"); this.Dispose(); } catch (Exception) { } } else { MessageBox.Show("عنوان فایل وجود ندارد"); } }
private void Form6_Load(object sender, EventArgs e) { List <Control> allControls = GetAllControls(this); allControls.ForEach(k => k.Font = GlobalVariable.headerlistFONT); if (GlobalVariable.isadmin == "1") { CATS = JsonConvert.DeserializeObject <CatsAndAreasObject>(GlobalVariable.newCatsAndAreas); } else { CATS = GlobalVariable.catsAndAreas; } if (GlobalVariable.fromwhere6 == "main") { delete.Visible = false; deletepanel.Visible = false; } this.MinimizeBox = false; this.MaximizeBox = false; la12.Font = GlobalVariable.headerlistFONTsmall; la13.Font = GlobalVariable.headerlistFONTsmall; la16.Font = GlobalVariable.headerlistFONTsmall; la17.Font = GlobalVariable.headerlistFONTsmall; la18.Font = GlobalVariable.headerlistFONTsmall; la19.Font = GlobalVariable.headerlistFONTsmall; la09.Font = GlobalVariable.headerlistFONTsmall; la20.Font = GlobalVariable.headerlistFONTsmall; la21.Font = GlobalVariable.headerlistFONTsmall; la22.Font = GlobalVariable.headerlistFONTsmall; if (GlobalVariable.selectedOwnObject != null) { obj = GlobalVariable.selectedOwnObject; InitControl(); } else { if (GlobalVariable.isadmin == "1") { setcat(); } else { setcatforclient(); } } try { } catch (Exception) { throw; } }
private void Form7_Load(object sender, EventArgs e) { this.MinimizeBox = false; this.MaximizeBox = false; //add.Font = GlobalVariable.headerlistFONT; label2.Font = GlobalVariable.headerlistFONT; label5.Font = GlobalVariable.headerlistFONT; label26.Font = GlobalVariable.headerlistFONT; label27.Font = GlobalVariable.headerlistFONT; // label28.Font = GlobalVariable.headerlistFONT; width = ClientRectangle.Width; radListView1.Height = flowLayoutPanel1.Height - 90; flowLayoutPanel1.Width = (int)width; tableLayoutPanel6.Width = (int)width - (Width * 3) / 100; radListView1.Width = (int)width - (Width * 3) / 100; string allobject = ""; var directory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string path = Path.Combine(directory, "Arvand", "objects.txt"); if (System.IO.File.Exists(path) == false) { Directory.CreateDirectory(Path.GetDirectoryName(path)); using (FileStream fs = new FileStream(path, FileMode.Create)) { } } using (StreamReader sr = new StreamReader(path, true)) { allobject = sr.ReadToEnd(); } List <ListOfAdds.Datum> list = new List <ListOfAdds.Datum>(); List <ListOfAdds.Datum> list2 = new List <ListOfAdds.Datum>(); ListOfAdds.Datum obj = new ListOfAdds.Datum(); try { list2 = JsonConvert.DeserializeObject <List <ListOfAdds.Datum> >(allobject); } catch (Exception error) { obj = JsonConvert.DeserializeObject <ListOfAdds.Datum>(allobject); } if (list2 != null) { foreach (var item in list2) { list.Add(item); } if (list.Count > 0) { radListView1.DataSource = ConvertToDataTable(list); this.radListView1.ValueMember = "ID"; radListView1.ViewType = ListViewType.DetailsView; radListView1.ShowColumnHeaders = false; radListView1.Columns["title"].Width = this.radListView1.Size.Width - this.radListView1.ListViewElement.BorderWidth * 2 - 30; // radListView1.Columns["title"]. radListView1.ItemSize = new Size(0, 33); } } }