private void btn_Delete_Click(object sender, EventArgs e) { City city = FormToCity(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); if (city.Id == 0) { } else { if (clientArr.DoesExist(city)) { MessageBox.Show("You can not delete this city, it is connected" + " to 1 or more clients", "Can not delete city", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this" + " City? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (city.Delete()) { ClearForm(); CityArrToForm(null); } } } } }
private void pictureBoxEnterSignIn_Click(object sender, EventArgs e) { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client; if (clientArr.FilterMailAndPassWord(textBoxSignInMail.Text, textBoxPassWord.Text) && clientArr.FilterMailAndPassWord(textBoxSignInMail.Text, textBoxPassWord.Text)) { client = GetClientFromForm(); //buttonSaveSignUp.Enabled = false; labelWelcome.Visible = true; labelWelcome.Text = "ברוך שובך " + client.FirstName; buttonSignUp.Visible = false; buttonExitLogIn.Visible = true; tabHouses.SelectedTab = tabPageApartments; buttonUpdate.Visible = true; buttonSignIn.Visible = false; buttonUpdatePersenol.Visible = true; label2.Visible = true; buttonCharts.Visible = true; } else { MessageBox.Show("מייל או סיסמא שגויים", "כניסת משתמש", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//tab "want to rent" private Product FormToProduct() { Product product = new Product(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); product.DateFrom = DateTime.Now; product.ID = Convert.ToInt32(label39.Text); product.Adress = textBoxAdressToRent.Text; product.Catagory = comboBoxCatagoryToRent.SelectedItem as Catagory; product.Client = clientArr.ReturnClientWithMail(textBoxSignInMail.Text).ID; product.Picture1 = GetPicfileName(pictureBox7); product.Picture2 = GetPicfileName(pictureBox6); product.Picture3 = GetPicfileName(pictureBox5); product.Descreption = richTextBoxDescreptionToRent.Text; product.City = comboBoxCityToRent.SelectedItem as City; product.StreetNo = Convert.ToInt32(textBoxStreetNo.Text); //בגלל שמדובר בבית אז אין מספר דירה if ((int)comboBoxCatagoryToRent.SelectedValue == 1) { product.AptNo = 0; } else { product.AptNo = Convert.ToInt32(textBoxAprtNo.Text); } product.Price = Convert.ToInt32(textBoxPrice.Text); product.Size = Convert.ToInt32(textBoxSize.Text); product.Floor = Convert.ToInt32(textBoxFloor.Text); product.IsSold = Convert.ToInt32(labelIsSold.Text); return(product); }
private void textBox_Filter_KeyUp(object sender, KeyEventArgs e) { int id = 0; //אם המשתמש רשם ערך בשדה המזהה if (textBox_FilterId.Text != "") { id = int.Parse(textBox_FilterId.Text); } //מייצרים אוסף של כלל הלקוחות ClientArr clientArr = new ClientArr(); clientArr.Fill(); //מסננים את אוסף הלקוחות לפי שדות הסינון שרשם המשתמש clientArr = clientArr.Filter(id, textBox_FilterLastName.Text, textBox_FilterPhoneNum.Text); //מציבים בתיבת הרשימה את אוסף הלקוחות listBox_Client.DataSource = clientArr; }
private void pictureBoxProperty_Click(object sender, EventArgs e) { ClientArr clientArr = new ClientArr(); ProductArr productArr = new ProductArr(); productArr.Fill(); clientArr.Fill(); Client client = GetClientFromForm(); Product product = productArr.FilterWithID(Convert.ToInt32(((PictureBox)sender).Tag)); if (labelWelcome.Visible == false || labelWelcome.Text == "") { MessageBox.Show("חובה להירשם לפני השכרה", "רישום", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading); } else if (product == null) { MessageBox.Show("אין נכס", "בחירה שגויה", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading); } else { //שולח את הנכס ואת הלקוח שרוצה להשכיר FormToRent formToRent = new FormToRent(client, product); formToRent.ShowDialog(); } }
private void btn_Delete_Click(object sender, EventArgs e) { Street street = FormToStreet(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); if (street.Id == 0) { } else { if (clientArr.DoesExist(street)) { MessageBox.Show("You can not delete this street, it is connected" + " to 1 or more clients", "Can not delete street", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (MessageBox.Show("Are you sure you want to delete this Street? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { street.Delete(); ClearForm(); StreetArrToForm(null); } } } }
public void ClientArrToForm(Client curClient, ComboBox comboBox, bool isMustChoose) { //ממירה את הטנ"מ אוסף ישובים לטופס ClientArr clientArr = new ClientArr(); Client clientDefault = new Client(); clientDefault.ID = -1; if (isMustChoose) { clientDefault.FirstName = "Choose category"; } else { clientDefault.FirstName = "Every category"; } clientArr.Add(clientDefault); clientArr.Fill(); comboBox.DataSource = clientArr; comboBox.ValueMember = "ID"; comboBox.DisplayMember = "FirstName " + "LastName: " + "Taz"; if (curClient != null) { comboBox.SelectedValue = curClient.ID; } }
private void btn_Save_Click(object sender, EventArgs e) { // שומר את המידע שקיבלנו לטבלה if (CheckForm()) { Client client = FormtoClient(); if (client.Id == 0) { if (!IsDataExsits(client.Email, client.PhoneNumber)) { if (client.Insert()) { MessageBox.Show("Data saved successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearForm(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); client = clientArr.GetClientWithMaxId(); ClientArrToForm(client); } } } else { if (client.Update()) { MessageBox.Show("Data updated successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearForm(); } } } }
private void ClientArrToForm() { //ממירה את הטנ"מ אוסף לקוחות לטופס ClientArr clientArr = new ClientArr(); clientArr.Fill(); listBox_Clients.DataSource = clientArr; }
//faire la פעולה filter #endregion OrderPage #region Client private void ClientArrToForm() { ClientArr clientArr = new ClientArr(); clientArr.Fill(); listBox_Clients.DataSource = clientArr; listBox_Clients.ValueMember = "ID"; listBox_Clients.DisplayMember = ""; }
private void buttonUpdatePersenol_Click(object sender, EventArgs e) { tabHouses.SelectedTab = tabPageSignUp; ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client = clientArr.ReturnClientWithMail(textBoxSignInMail.Text); ClientToForm(client); }
private Client GetClientFromForm() { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client = clientArr.ReturnClientWithMail(textBoxSignInMail.Text); return(client); }
private void ClientArrToForm(Client curClient) { ClientArr clientArr = new ClientArr(); clientArr.Fill(); listBox_Data.DataSource = clientArr; listBox_Data.ValueMember = "ID"; listBox_Data.DisplayMember = "PhoneName"; if (curClient != null) { listBox_Data.SelectedValue = curClient.Id; } }
private Client GetClientFromForm() { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client = new Client(); for (int i = 0; i < clientArr.Count; i++) { if ((clientArr[i] as Client).ID == Convert.ToInt32(labelClientID.Text)) { client = clientArr[i] as Client; } } return(client); }
private void CurrentProductToForm(Client clientWantToBuy, Product product) { Client client = new Client(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); pictureBoxProperty0.ImageLocation = FindPicturePath() + product.Picture1; pictureBoxProperty1.ImageLocation = FindPicturePath() + product.Picture1; pictureBoxProperty2.ImageLocation = FindPicturePath() + product.Picture2; pictureBoxProperty3.ImageLocation = FindPicturePath() + product.Picture3; if (product.Catagory.ID == 1) { richTextBox2.Text = product.Adress + " מספר רחוב:" + Convert.ToInt32(product.StreetNo) + " מספר קומות:" + Convert.ToInt32(product.Floor); } else { richTextBox2.Text = product.Adress + " מספר רחוב:" + Convert.ToString(product.StreetNo) + " מספר קומה:" + Convert.ToString(product.Floor + " מספר דירה:" + Convert.ToString(product.AptNo)); } if (product.IsSold == 1) { buttonWantToBuy.Visible = false; } else { buttonWantToBuy.Visible = true; } labelCity.Text = product.City.Name; richTextBox1.Text = product.Descreption; labelProductID.Text = Convert.ToString(product.ID); labelClientID.Text = Convert.ToString(clientWantToBuy.ID); labelSize.Text = " מ''ר " + Convert.ToString(product.Size); labelPrice.Text = Convert.ToString(product.Price); client = clientArr.ReturnClientWithID(product.Client); labelCleintEmail.Text = client.Mail; labelCleintName.Text = client.FirstName + " " + client.LastName; labelCleintPhone.Text = client.CellPhone_AreaCode + client.PhoneNumber; labelCatagory.Text = Convert.ToString(product.Catagory.ID); }
public ClientArr GetClients() { int id = 0; //אם המשתמש רשם ערך בשדה המזהה if (txt_Id.Text != "") { id = int.Parse(txt_Id.Text); } //מייצרים אוסף של כלל הלקוחות ClientArr clientArr = new ClientArr(); clientArr.Fill(); //מסננים את אוסף הלקוחות לפי שדות הסינון שרשם המשתמש clientArr = clientArr.Filter(id, txt_Name.Text, txt_PhoneNumber.Text); return(clientArr); }
private void ClientArrToForm(Client curClient) { ClientArr clientArr = new ClientArr(); clientArr.Fill(); cmb_Client.DataSource = clientArr; cmb_Client.ValueMember = "ID"; cmb_Client.DisplayMember = "FullName"; if (curClient != null) { cmb_Client.SelectedValue = curClient.Id; } else { cmb_Client.SelectedIndex = -1; } }
private void label2_Click(object sender, EventArgs e) { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client = new Client(); if (Convert.ToInt32(labelIDClient.Text) != 0) { client = clientArr.ReturnClientWithMail(textBoxSignInMail.Text); FormSumeryClient formSumeryClient = new FormSumeryClient(client); formSumeryClient.ShowDialog(); } else { MessageBox.Show("חובה להירשם לפני", "רישום", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading); } }
private void deleteButton_Click(object sender, EventArgs e) { City city = FormToCity(); if (city.ID <= 0) { MessageBox.Show("חובה לבחור עיר", "אין בחירה", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (MessageBox.Show("אזהרה", "האם אתה בטוח שאתה רוצה למחוק את העיר?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading) == DialogResult.Yes) { //לפני המחיקה - בדיקה שהישוב לא בשימוש בישויות אחרות //בדיקה עבור לקוחות ClientArr clientArr = new ClientArr(); clientArr.Fill(); ProductArr productArr = new ProductArr(); productArr.Fill(); if (clientArr.DoesExist(city) && productArr.DoesExist(city)) { MessageBox.Show("אי אפשר למחוק עיר שקשורה ליישות קיימת", "יש חיבור בין יישות לעיר", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (city.Delete()) { MessageBox.Show("נמחק", "נמחק", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); CityToFrom(null); CityArrToForm(null); } else { MessageBox.Show("שגיאה"); } } } }
private void button_deleteCity_Click(object sender, EventArgs e) { City city = FormToCity(); if (city.ID == 0) { MessageBox.Show("You must select a city"); } else { if (MessageBox.Show("Warning", "Are you sure you want to delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading) == DialogResult.Yes) { //לפני המחיקה - בדיקה שהישוב לא בשימוש בישויות אחרות //בדיקה עבור לקוחות ClientArr clientArr = new ClientArr(); clientArr.Fill(); if (clientArr.DoesExist(city)) { MessageBox.Show("You can’t delete a city that is related to a client"); } else if (city.Delete()) { MessageBox.Show("Deleted"); CityToForm(null); CityArrToForm(city); } else { MessageBox.Show("Error"); } } } }
private void FilterClient(object sender, KeyEventArgs e) { int id = 0; //אם המשתמש רשם ערך בשדה המזהה if (groupbox_taz.Text != "") { id = int.Parse(groupbox_taz.Text); } //מייצרים אוסף של כלל הלקוחות ClientArr clientArr = new ClientArr(); clientArr.Fill(); //מסננים את אוסף הלקוחות לפי שדות הסינון שרשם המשתמש clientArr = clientArr.Filter(id.ToString(), groupbox_lastname.Text, groupbox_phone.Text); //מציבים בתיבת הרשימה את אוסף הלקוחות listBox_Clients.DataSource = clientArr; }
private void FillListView(Client client, Product product) { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client1 = new Client(); client1 = clientArr.ReturnClientWithID(product.Client); //מוסיף נתונים לפקד תיבת התצוגה //יצירת מקור הנתונים ListViewItem listViewItem; //יצירת פריט-תיבת-תצוגה listViewItem = new ListViewItem(new[] { client.FullName, "", client.City.Name, "" }); //הוספת פריט-תיבת-תצוגה לתיבת תצוגה listViewProducts.Items.Add(listViewItem); if (product.Catagory.ID == 1) { listViewItem = new ListViewItem(new[] { client1.FullName, "בית", product.City.Name, product.Adress + " " + product.StreetNo, Convert.ToString(product.Size), Convert.ToString(product.Price) }); } else { listViewItem = new ListViewItem(new[] { client1.FullName, "דירה", product.City.Name, product.Adress + " " + product.StreetNo + " מספר דירה:" + product.AptNo, Convert.ToString(product.Size), Convert.ToString(product.Price) }); } listViewProducts.Items.Add(listViewItem); richTextBox1.Text = " ההסכם :" + "שנערך ונחתם ביום " + Convert.ToString(DateTime.Today.Day) + " בחודש: " + Convert.ToString(DateTime.Today.Month) + " ובשנת: " + Convert.ToString(DateTime.Today.Year) + " בין:" + " 1. " + client1.FullName + " 2. " + client.FullName + " שניהם מעיר: " + client1.City.Name + " ו " + client.City.Name + " מצד שני; " + "הואיל והמכורים הינם הבעלים והמחזיקים הבלעדיים של הנכס בעיר " + product.City.Name + " וברחוב; " + product.Adress + " במספר; " + product.StreetNo + ", אשר זכויות המוכרים בה רשומות בלשכת רישום המקרקעין. " + "\n" + " הסכם זה הינו הסכם דיגיטלי בין המוכר: " + client1.FullName + " והקונה: " + client.FullName ; }
private void InitializeUpdateForClient() { ClientArr clientArr = new ClientArr(); clientArr.Fill(); Client client = clientArr.ReturnClientWithMail(textBoxSignInMail.Text); ProductArr productArr = new ProductArr(); productArr = productArr.Filter(client); int a = 0; // for apartments int h = 0; // for houses; if (productArr.Count < 1) { MessageBox.Show("אין נכסים לעדכן", "עידכון נכס", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading); } else { //שש מקרים בגלל שיש שש מקומות לשים את התמונות של הדירות for (int i = 0; i < productArr.Count && i < 5; i++) { if ((productArr[i] as Product).Catagory.ID == 1) { switch (h) { case 0: ProductToFormPictureOnly(productArr[i] as Product, pictureBox8); pictureBox8.Tag = (productArr[i] as Product).ID; break; case 1: ProductToFormPictureOnly(productArr[i] as Product, pictureBox9); pictureBox9.Tag = (productArr[i] as Product).ID; break; case 2: ProductToFormPictureOnly(productArr[i] as Product, pictureBox10); pictureBox10.Tag = (productArr[i] as Product).ID; break; } h++; } else { switch (a) { case 0: ProductToFormPictureOnly(productArr[i] as Product, pictureBox13); pictureBox13.Tag = (productArr[i] as Product).ID; break; case 1: ProductToFormPictureOnly(productArr[i] as Product, pictureBox12); pictureBox12.Tag = (productArr[i] as Product).ID; break; case 2: ProductToFormPictureOnly(productArr[i] as Product, pictureBox11); pictureBox11.Tag = (productArr[i] as Product).ID; break; } a++; } } tabHouses.SelectedTab = tabPageUpdateProperty; } }