/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="BDCustomerPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <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>object of class BDCustomerAccountCollection</returns> public BDCustomerAccountCollection SelectAllByForeignKeyCustomerIDPaged(BDCustomerPrimaryKey pk, int pageSize, int skipPages, string orderByStatement) { BDCustomerAccountCollection bDCustomerAccountCollection = new BDCustomerAccountCollection(); foreach (POS.DataLayer.BDCustomerAccount _bDCustomerAccount in POS.DataLayer.BDCustomerAccountBase.SelectAllByForeignKeyCustomerIDPaged(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID), pageSize, skipPages, orderByStatement)) { _bDCustomerAccountWCF = new BDCustomerAccount(); _bDCustomerAccountWCF.CustomerAccountNumber = _bDCustomerAccount.CustomerAccountNumber; _bDCustomerAccountWCF.CustomerID = _bDCustomerAccount.CustomerID; _bDCustomerAccountWCF.SalesInvoiceId = _bDCustomerAccount.SalesInvoiceId; _bDCustomerAccountWCF.SalesDate = _bDCustomerAccount.SalesDate; _bDCustomerAccountWCF.InvoiceNumber = _bDCustomerAccount.InvoiceNumber; _bDCustomerAccountWCF.TotalPrice = _bDCustomerAccount.TotalPrice; _bDCustomerAccountWCF.PaidAmount = _bDCustomerAccount.PaidAmount; _bDCustomerAccountWCF.RemainingAmount = _bDCustomerAccount.RemainingAmount; _bDCustomerAccountWCF.IsVoid = _bDCustomerAccount.IsVoid; _bDCustomerAccountWCF.CreatedBy = _bDCustomerAccount.CreatedBy; _bDCustomerAccountWCF.CreateDate = _bDCustomerAccount.CreateDate; _bDCustomerAccountWCF.UpdatedBy = _bDCustomerAccount.UpdatedBy; _bDCustomerAccountWCF.UpdateDate = _bDCustomerAccount.UpdateDate; _bDCustomerAccountWCF.IsDeleted = _bDCustomerAccount.IsDeleted; _bDCustomerAccountWCF.DeletedBy = _bDCustomerAccount.DeletedBy; _bDCustomerAccountWCF.DeletedDate = _bDCustomerAccount.DeletedDate; _bDCustomerAccountWCF.InvoiceType = _bDCustomerAccount.InvoiceType; bDCustomerAccountCollection.Add(_bDCustomerAccountWCF); } return(bDCustomerAccountCollection); }
public override void btn_Delete_Click(object sender, EventArgs e) { int? customerID = 0; if (dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["CustomerID"].Value != null) { if (MessageBox.Show("هل نت متأكد من حذف العميل؟","تحذير",MessageBoxButtons.YesNo) == DialogResult .Yes ) { customerID = Convert.ToInt32(dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["CustomerID"].Value); BDCustomerPrimaryKey customerPK = new BDCustomerPrimaryKey(); customerPK.CustomerID = customerID; try { _bDCustomerWrapper.Delete(customerPK); } catch (Exception ex) { MessageBox.Show ("لا يمكن مسح هذا العميل .. حيث انه مرتبط بفواتير"); } } else { return; } } else { MessageBox.Show("لابد من اختيار عميل"); } Search(); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="BDCustomerPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDCustomerAccountCollection</returns> public BDCustomerAccountCollection SelectAllByForeignKeyCustomerID(BDCustomerPrimaryKey pk) { BDCustomerAccountCollection bDCustomerAccountCollection = new BDCustomerAccountCollection(); foreach (POS.DataLayer.BDCustomerAccount _bDCustomerAccount in POS.DataLayer.BDCustomerAccountBase.SelectAllByForeignKeyCustomerID(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID))) { _bDCustomerAccountWCF = new BDCustomerAccount(); _bDCustomerAccountWCF.CustomerAccountNumber = _bDCustomerAccount.CustomerAccountNumber; _bDCustomerAccountWCF.CustomerID = _bDCustomerAccount.CustomerID; _bDCustomerAccountWCF.SalesInvoiceId = _bDCustomerAccount.SalesInvoiceId; _bDCustomerAccountWCF.SalesDate = _bDCustomerAccount.SalesDate; _bDCustomerAccountWCF.InvoiceNumber = _bDCustomerAccount.InvoiceNumber; _bDCustomerAccountWCF.TotalPrice = _bDCustomerAccount.TotalPrice; _bDCustomerAccountWCF.PaidAmount = _bDCustomerAccount.PaidAmount; _bDCustomerAccountWCF.RemainingAmount = _bDCustomerAccount.RemainingAmount; _bDCustomerAccountWCF.IsVoid = _bDCustomerAccount.IsVoid; _bDCustomerAccountWCF.CreatedBy = _bDCustomerAccount.CreatedBy; _bDCustomerAccountWCF.CreateDate = _bDCustomerAccount.CreateDate; _bDCustomerAccountWCF.UpdatedBy = _bDCustomerAccount.UpdatedBy; _bDCustomerAccountWCF.UpdateDate = _bDCustomerAccount.UpdateDate; _bDCustomerAccountWCF.IsDeleted = _bDCustomerAccount.IsDeleted; _bDCustomerAccountWCF.DeletedBy = _bDCustomerAccount.DeletedBy; _bDCustomerAccountWCF.DeletedDate = _bDCustomerAccount.DeletedDate; _bDCustomerAccountWCF.Depit = _bDCustomerAccount.Depit; _bDCustomerAccountWCF.Credit = _bDCustomerAccount.Credit; _bDCustomerAccountWCF.ChequeNumber = _bDCustomerAccount.ChequeNumber; _bDCustomerAccountWCF.InvoiceType = _bDCustomerAccount.InvoiceType; _bDCustomerAccountWCF.LstDayToPay = _bDCustomerAccount.LstDayToPay; bDCustomerAccountCollection.Add(_bDCustomerAccountWCF); } return(bDCustomerAccountCollection); }
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 return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDCustomerPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDCustomer</returns> public BDCustomer SelectOne(BDCustomerPrimaryKey pk) { _bDCustomerWCF = new BDCustomer(); _bDCustomer = POS.DataLayer.BDCustomerBase.SelectOne(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID)); _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; return(_bDCustomerWCF); }
///<summary> ///This method will Delete the object from the database ///</summary> ///<param name="pk" type="BDCustomerPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <returns>True if succeeded</returns> public bool Delete(BDCustomerPrimaryKey pk) { return(POS.DataLayer.BDCustomerBase.Delete(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID))); }
/// <summary> /// This method will delete row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="BDCustomerPrimaryKey">Primary Key information based on which data is to be deleted.</param> /// /// <returns>True if succeeded</returns> public bool DeleteAllByForeignKeyCustomerID(BDCustomerPrimaryKey pk) { return(POS.DataLayer.BDCustomerAccountBase.DeleteAllByForeignKeyCustomerID(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID))); }
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; }