private void btnAdd_Click(object sender, EventArgs e) { cust = BuildObjedtByField(); if (cust != null) { DataRow dr = cust.BuildRow(); CustomersTable prodacts = new CustomersTable(); if (prodacts.Add(dr) == false) { MessageBox.Show("קיים במאגר"); } else { MessageBox.Show("התווסף בהצלחה"); FrmShop1 shop = new FrmShop1(cust.IDCust1, cust.FirstNameCust1 + cust.LustNameCust1); shop.Show(); ClosingOption = 3; this.Close(); } // bool isDetailsValid = true; ////check details validity //errorProvider1.Clear(); ////check card number //if (txtNumCard.Text.Length < 9 ) //{ // errorProvider1.SetError(txtNumCard, "מספר כרטיס לא תקין"); // isDetailsValid = false; //} ////check owner id //if (txtBID.Text.Length < 9 || Helper.isId(txtBID.Text) == false) //{ // errorProvider1.SetError(txtBID, "תז לא תקינה"); // isDetailsValid = false; //} ////check three card digits //if (txtBThree.Text.Length < 3 ) //{ // errorProvider1.SetError(txtBThree, "עליך להקיש 3 ספרות"); // isDetailsValid = false; //} ////check card expire date //if (dtpValidate.Value.AddMonths(-Convert.ToInt32(nudNumOfPayments.Value-1)) < (DateTime.Now)) //{ // errorProvider1.SetError(dtpValidate, "כרטיס אשראי לא בתוקף לעסקה המבוקשת"); // isDetailsValid = false; //} //if (isDetailsValid == true) //{ // bool b= addOrderDetails(); // if (b == true) // { // MessageBox.Show("התשלום התבצע בהצלחה\n"+"סך הכל שולם:"+lblPaymentSum.Text); // ClosingOption = 3; // this.Close(); // } } }
private void button2_Click(object sender, EventArgs e) { cust = BuildObjedtByField(); if (cust != null) { DataRow dr = cust.BuildRow(); CustomersTable prodacts = new CustomersTable(); if (prodacts.Update(dr) == false) { MessageBox.Show("קיים במאגר"); } else { MessageBox.Show("עודכן בהצלחה"); FrmShop1 shop = new FrmShop1(cust.IDCust1, cust.FirstNameCust1 + cust.LustNameCust1); shop.Show(); ClosingOption = 3; this.Close(); } } }
private void button1_Click(object sender, EventArgs e) { //check id validity if (Helper.isId(txtCustId.Text) == false) { MessageBox.Show("תז לא תקינה"); return; } //check if customer exist CustomersTable cust = new CustomersTable(); string name = cust.GetCustomerFullNameById(txtCustId.Text); if (name == null) { MessageBox.Show("לקוח לא קיים במאגר"); } else { FrmShop1 shop = new FrmShop1(txtCustId.Text, name); shop.Show(); this.Close(); } }