public frmCustomerAccountEdit(int customerID, FrmCustomerSearch _frmCustomerSearch) { InitializeComponent(); this._customerID = customerID; this._bDCustomerWrapper = new BDCustomerWrapper(); this._customer = new BDCustomer(); this.frmCustomerSearchObj = _frmCustomerSearch; FillCustomerData(); }
public override void btn_Save_Click(object sender, EventArgs e) { if (tbx_Name.Text != "") { customer = new BDCustomer(); BDCustomerService customerService = new BDCustomerService(); if (CustomerID == null)//new customer { customer.CustomerCode = tbx_Code.Text; customer.CustomerName = tbx_Name.Text; customer.Address = tbx_Address.Text; customer.Phone1 = tbx_Pone1.Text; customer.Phone2 = tbx_phone2.Text; customer.Mobile1 = tbx_Mobile1.Text; customer.Mobile2 = tbx_Mobile2.Text; customer.Email = tbx_Email.Text; customer.IsActive = chk_IsActive.Checked; customer.Debit = 0; customer.Credit = 0; customerService.Insert(customer); MessageBox.Show("تم الحفظ بنجاح"); } else { BDCustomerPrimaryKey pk = new BDCustomerPrimaryKey(); pk.CustomerID = CustomerID; customer = customerService.SelectOne(pk); customer.CustomerCode = tbx_Code.Text; customer.CustomerName = tbx_Name.Text; customer.Address = tbx_Address.Text; customer.Phone1 = tbx_Pone1.Text; customer.Phone2 = tbx_phone2.Text; customer.Mobile1 = tbx_Mobile1.Text; customer.Mobile2 = tbx_Mobile2.Text; customer.Email = tbx_Email.Text; customer.IsActive = chk_IsActive.Checked; customerService.Update(customer); MessageBox.Show("تم التعديل بنجاح"); } } else { MessageBox.Show("لابد من ادخال إسم العميل"); } this.Close(); }
private void FillCustomerData() { try { BDCustomerPrimaryKey _customerPrimaryKey = new BDCustomerPrimaryKey(); _customerPrimaryKey.CustomerID = _customerID; _customer = _bDCustomerWrapper.SelectOne(_customerPrimaryKey); num_Credit.Value = _customer.Credit.Value; num_Debit.Value = _customer.Debit.Value; } catch (Exception ex) { MessageBox.Show("حدث خطأ برجاء تكرار العمليه مره اخرى واذا تكرر الخطا برجاءالاتصال بالشخص المصمم للبرنامج وارسال رسالة الخطا التى ستظهر بعد قليل له"); MessageBox.Show(ex.Message); } }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// </summary> /// /// <param name="field" type="string">Field of the class BDCustomer</param> /// <param name="fieldValue" type="object">Value for the field specified.</param> /// <param name="fieldValue2" type="object">Value for the field specified.</param> /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param> /// /// <returns>List of object of class BDCustomer in the form of an object of class BDCustomerCollection</returns> public BDCustomerCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation) { BDCustomerCollection bDCustomerCollection = new BDCustomerCollection(); foreach (POS.DataLayer.BDCustomer _bDCustomer in POS.DataLayer.BDCustomerBase.SelectByField(field, fieldValue, fieldValue2, typeOperation)) { _bDCustomerWCF = new BDCustomer(); _bDCustomerWCF.CustomerID = _bDCustomer.CustomerID; _bDCustomerWCF.CustomerName = _bDCustomer.CustomerName; _bDCustomerWCF.CustomerCode = _bDCustomer.CustomerCode; _bDCustomerWCF.Address = _bDCustomer.Address; _bDCustomerWCF.Phone1 = _bDCustomer.Phone1; _bDCustomerWCF.Phone2 = _bDCustomer.Phone2; _bDCustomerWCF.Mobile1 = _bDCustomer.Mobile1; _bDCustomerWCF.Mobile2 = _bDCustomer.Mobile2; _bDCustomerWCF.Email = _bDCustomer.Email; _bDCustomerWCF.IsActive = _bDCustomer.IsActive; bDCustomerCollection.Add(_bDCustomerWCF); } return(bDCustomerCollection); }
/// <summary> /// This method will return a list of objects representing all records in the table. /// </summary> /// /// <returns>list of objects of class BDCustomer in the form of object of BDCustomerCollection </returns> public BDCustomerCollection SelectAll() { BDCustomerCollection bDCustomerCollection = new BDCustomerCollection(); foreach (POS.DataLayer.BDCustomer _bDCustomer in POS.DataLayer.BDCustomerBase.SelectAll()) { _bDCustomerWCF = new BDCustomer(); _bDCustomerWCF.CustomerID = _bDCustomer.CustomerID; _bDCustomerWCF.CustomerName = _bDCustomer.CustomerName; _bDCustomerWCF.CustomerCode = _bDCustomer.CustomerCode; _bDCustomerWCF.Address = _bDCustomer.Address; _bDCustomerWCF.Phone1 = _bDCustomer.Phone1; _bDCustomerWCF.Phone2 = _bDCustomer.Phone2; _bDCustomerWCF.Mobile1 = _bDCustomer.Mobile1; _bDCustomerWCF.Mobile2 = _bDCustomer.Mobile2; _bDCustomerWCF.Email = _bDCustomer.Email; _bDCustomerWCF.IsActive = _bDCustomer.IsActive; bDCustomerCollection.Add(_bDCustomerWCF); } return(bDCustomerCollection); }
/// <summary> /// This method will return a list of objects representing the specified number of entries from the specified record number in the table. /// </summary> /// /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>list of objects of class BDCustomer in the form of an object of class BDCustomerCollection </returns> public BDCustomerCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement) { BDCustomerCollection bDCustomerCollection = new BDCustomerCollection(); foreach (POS.DataLayer.BDCustomer _bDCustomer in POS.DataLayer.BDCustomerBase.SelectAllPaged(pageSize, skipPages, orderByStatement)) { _bDCustomerWCF = new BDCustomer(); _bDCustomerWCF.CustomerID = _bDCustomer.CustomerID; _bDCustomerWCF.CustomerName = _bDCustomer.CustomerName; _bDCustomerWCF.CustomerCode = _bDCustomer.CustomerCode; _bDCustomerWCF.Address = _bDCustomer.Address; _bDCustomerWCF.Phone1 = _bDCustomer.Phone1; _bDCustomerWCF.Phone2 = _bDCustomer.Phone2; _bDCustomerWCF.Mobile1 = _bDCustomer.Mobile1; _bDCustomerWCF.Mobile2 = _bDCustomer.Mobile2; _bDCustomerWCF.Email = _bDCustomer.Email; _bDCustomerWCF.IsActive = _bDCustomer.IsActive; bDCustomerCollection.Add(_bDCustomerWCF); } return(bDCustomerCollection); }
public BDCustomerCollection SearchByCriteria(string CustomerName,string CustomerCode ) { BDCustomerCollection bDCustomerCollection = new BDCustomerCollection(); foreach (POS.DataLayer.BDCustomer _bDCustomer in POS.DataLayer.BDCustomer.SearcByCriteria(CustomerName,CustomerCode )) { _bDCustomerWCF = new BDCustomer(); _bDCustomerWCF.CustomerID = _bDCustomer.CustomerID; _bDCustomerWCF.CustomerName = _bDCustomer.CustomerName; _bDCustomerWCF.CustomerCode = _bDCustomer.CustomerCode; _bDCustomerWCF.Address = _bDCustomer.Address; _bDCustomerWCF.Phone1 = _bDCustomer.Phone1; _bDCustomerWCF.Phone2 = _bDCustomer.Phone2; _bDCustomerWCF.Mobile1 = _bDCustomer.Mobile1; _bDCustomerWCF.Mobile2 = _bDCustomer.Mobile2; _bDCustomerWCF.Email = _bDCustomer.Email; _bDCustomerWCF.IsActive = _bDCustomer.IsActive; _bDCustomerWCF.Credit = _bDCustomer.Credit; _bDCustomerWCF.Debit = _bDCustomer.Debit; bDCustomerCollection.Add(_bDCustomerWCF); } return bDCustomerCollection; }
private void LoadControls() { BDCustomerPrimaryKey pk = new BDCustomerPrimaryKey(); pk.CustomerID = CustomerID; customer = customerWrapper.SelectOne(pk); tbx_Code.Text = customer.CustomerCode != null ? customer.CustomerCode : ""; tbx_Name.Text = customer.CustomerName; tbx_Address.Text = customer.Address != null ? customer.Address : ""; tbx_Pone1.Text = customer.Phone1 != null ? customer.Phone1 : ""; tbx_phone2.Text = customer.Phone2 != null ? customer.Phone2 : ""; tbx_Mobile1.Text = customer.Mobile1 != null ? customer.Mobile1 : ""; tbx_Mobile2.Text = customer.Mobile2 != null ? customer.Mobile2 : ""; tbx_Email.Text = customer.Email != null ? customer.Email : ""; chk_IsActive.Checked = customer.IsActive != null ? (bool)customer.IsActive : true; }