예제 #1
0
        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();
        }
예제 #2
0
        public List <BDCustomerAccount> GetCustomerAccounts(int id)
        {
            List <BDCustomerAccount> customerAccountCollection = new List <BDCustomerAccount>();

            BDCustomerPrimaryKey pk = new BDCustomerPrimaryKey();

            pk.CustomerID = id;
            var query = SelectAllByForeignKeyCustomerID(pk);

            if (query.Count == 0)
            {
                return(customerAccountCollection);
            }

            customerAccountCollection = (from item in query
                                         join customer in _customerService.SelectAll() on item.CustomerID equals customer.CustomerID
                                         join _user in _userService.SelectAll() on item.CreatedBy equals _user.UserID
                                         select new BDCustomerAccount()
            {
                CustomerAccountNumber = item.CustomerAccountNumber,
                CustomerID = item.CustomerID,
                CustomerName = customer.CustomerName,
                InvoiceNumber = item.InvoiceNumber,
                IsVoid = item.IsVoid,
                PaidAmount = item.PaidAmount,
                RemainingAmount = item.RemainingAmount,
                SalesDate = item.SalesDate,
                SalesInvoiceId = item.SalesInvoiceId,
                TotalPrice = item.TotalPrice,
                CreateDate = item.CreateDate,
                CreatedByName = _user.UserFullName
            }
                                         ).ToList();
            return(customerAccountCollection);
        }
예제 #3
0
        public List <BDCustomerAccount> GetCustomerAccounts(int?id, DateTime?dateFrom = null, DateTime?toFrom = null)
        {
            List <BDCustomerAccount> customerAccountCollection = new List <BDCustomerAccount>();
            var query = SelectAll().ToList();


            DateTime?fromCreationDate = dateFrom != null ? dateFrom : null;
            DateTime?toCreationDate   = toFrom != null ? toFrom : null;

            if (fromCreationDate != null && toCreationDate != null)
            {
                query = (from item in query
                         where (item.CreateDate.Value.Date >= dateFrom.Value.Date
                                &&
                                item.CreateDate.Value.Date <= toFrom.Value.Date)
                         select item).ToList();
            }


            if (id != null)
            {
                BDCustomerPrimaryKey pk = new BDCustomerPrimaryKey();
                pk.CustomerID = id;
                query         = SelectAllByForeignKeyCustomerID(pk).ToList();
            }

            if (query.Count == 0)
            {
                return(customerAccountCollection);
            }

            customerAccountCollection = (from item in query
                                         join customer in _customerService.SelectAll() on item.CustomerID equals customer.CustomerID
                                         join _user in _userService.SelectAll() on item.CreatedBy equals _user.UserID
                                         select new BDCustomerAccount()
            {
                CustomerAccountNumber = item.CustomerAccountNumber,
                CustomerID = item.CustomerID,
                CustomerName = customer.CustomerName,
                InvoiceNumber = item.InvoiceNumber,
                IsVoid = item.IsVoid,
                PaidAmount = item.PaidAmount,
                RemainingAmount = item.RemainingAmount,
                SalesDate = item.SalesDate,
                SalesInvoiceId = item.SalesInvoiceId,
                TotalPrice = item.TotalPrice,
                CreateDate = item.CreateDate,
                CreatedByName = _user.UserFullName,
                ChequeNumber = item.ChequeNumber,
                Credit = item.Credit,
                Depit = item.Depit,
                InvoiceType = item.InvoiceType,
                LstDayToPay = item.LstDayToPay
            }
                                         ).ToList();
            return(customerAccountCollection);
        }
예제 #4
0
        public List<BDCustomerAccount> GetCustomerAccounts(int? id, DateTime? dateFrom = null, DateTime? toFrom = null)
        {
            List<BDCustomerAccount> customerAccountCollection = new List<BDCustomerAccount>();
            var query = SelectAll().ToList();


            DateTime? fromCreationDate = dateFrom != null ? dateFrom : null;
            DateTime? toCreationDate = toFrom != null ? toFrom : null;

            if (fromCreationDate != null && toCreationDate != null)
            {
                query = (from item in query
                         where (item.CreateDate.Value.Date >= dateFrom.Value.Date
                                               &&
                                               item.CreateDate.Value.Date <= toFrom.Value.Date)
                         select item).ToList();
            }


            if (id != null)
            {
                BDCustomerPrimaryKey pk = new BDCustomerPrimaryKey();
                pk.CustomerID = id;
                query = SelectAllByForeignKeyCustomerID(pk).ToList();
            }

            if (query.Count == 0)
                return customerAccountCollection;

            customerAccountCollection = (from item in query
                                         join customer in _customerService.SelectAll() on item.CustomerID equals customer.CustomerID
                                         join _user in _userService.SelectAll() on item.CreatedBy equals _user.UserID
                                         select new BDCustomerAccount()
                                         {
                                             CustomerAccountNumber = item.CustomerAccountNumber,
                                             CustomerID = item.CustomerID,
                                             CustomerName = customer.CustomerName,
                                             InvoiceNumber = item.InvoiceNumber,
                                             IsVoid = item.IsVoid,
                                             PaidAmount = item.PaidAmount,
                                             RemainingAmount = item.RemainingAmount,
                                             SalesDate = item.SalesDate,
                                             SalesInvoiceId = item.SalesInvoiceId,
                                             TotalPrice = item.TotalPrice,
                                             CreateDate = item.CreateDate,
                                             CreatedByName = _user.UserFullName,
                                             ChequeNumber = item.ChequeNumber,
                                             Credit = item.Credit,
                                             Depit = item.Depit,
                                             InvoiceType = item.InvoiceType,
                                             LstDayToPay = item.LstDayToPay
                                         }
                                          ).ToList();
            return customerAccountCollection;

        }
예제 #5
0
 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)
     {
         throw;
     }
 }
예제 #6
0
        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;
        }
예제 #7
0
 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);
     }
 }
예제 #8
0
        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();
        }
예제 #9
0
		/// <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;
				_bDCustomerWCF.Debit = _bDCustomer.Debit;
				_bDCustomerWCF.Credit = _bDCustomer.Credit;
				
			return _bDCustomerWCF;
		}
예제 #10
0
		///<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));
		}
예제 #11
0
		/// <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 SALSalesHeaderCollection</returns>
		public SALSalesHeaderCollection SelectAllByForeignKeyCustomerIDPaged(BDCustomerPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
		{
			SALSalesHeaderCollection sALSalesHeaderCollection=new SALSalesHeaderCollection();
			foreach (POS.DataLayer.SALSalesHeader _sALSalesHeader in POS.DataLayer.SALSalesHeaderBase.SelectAllByForeignKeyCustomerIDPaged(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID), pageSize, skipPages, orderByStatement))
			{
				_sALSalesHeaderWCF = new SALSalesHeader();
				_sALSalesHeaderWCF.SalesHeaderID = _sALSalesHeader.SalesHeaderID;
				_sALSalesHeaderWCF.SalesDate = _sALSalesHeader.SalesDate;
				_sALSalesHeaderWCF.CustomerID = _sALSalesHeader.CustomerID;
				_sALSalesHeaderWCF.InvoiceNumber = _sALSalesHeader.InvoiceNumber;
				_sALSalesHeaderWCF.InvoiceDate = _sALSalesHeader.InvoiceDate;
				_sALSalesHeaderWCF.SellerID = _sALSalesHeader.SellerID;
				_sALSalesHeaderWCF.PaymentTypeID = _sALSalesHeader.PaymentTypeID;
				_sALSalesHeaderWCF.TotalPrice = _sALSalesHeader.TotalPrice;
				_sALSalesHeaderWCF.PaidAmount = _sALSalesHeader.PaidAmount;
				_sALSalesHeaderWCF.RemainingAmount = _sALSalesHeader.RemainingAmount;
				_sALSalesHeaderWCF.LastDayToPay = _sALSalesHeader.LastDayToPay;
				_sALSalesHeaderWCF.TotalDiscountAmount = _sALSalesHeader.TotalDiscountAmount;
				_sALSalesHeaderWCF.TotalDiscountRatio = _sALSalesHeader.TotalDiscountRatio;
				_sALSalesHeaderWCF.IsClosed = _sALSalesHeader.IsClosed;
				_sALSalesHeaderWCF.IsVoid = _sALSalesHeader.IsVoid;
				_sALSalesHeaderWCF.IsPrinted = _sALSalesHeader.IsPrinted;
				_sALSalesHeaderWCF.ServicePrice = _sALSalesHeader.ServicePrice;
				_sALSalesHeaderWCF.TaxTypeID = _sALSalesHeader.TaxTypeID;
				_sALSalesHeaderWCF.RefuseReasonID = _sALSalesHeader.RefuseReasonID;
				_sALSalesHeaderWCF.CreatedBy = _sALSalesHeader.CreatedBy;
				_sALSalesHeaderWCF.CreateDate = _sALSalesHeader.CreateDate;
				_sALSalesHeaderWCF.UpdatedBy = _sALSalesHeader.UpdatedBy;
				_sALSalesHeaderWCF.UpdateDate = _sALSalesHeader.UpdateDate;
				_sALSalesHeaderWCF.IsDeleted = _sALSalesHeader.IsDeleted;
				_sALSalesHeaderWCF.DeletedBy = _sALSalesHeader.DeletedBy;
				_sALSalesHeaderWCF.DeletDate = _sALSalesHeader.DeletDate;
				_sALSalesHeaderWCF.InventoryID = _sALSalesHeader.InventoryID;
				_sALSalesHeaderWCF.FinalPrice = _sALSalesHeader.FinalPrice;
				_sALSalesHeaderWCF.ChequeNumber = _sALSalesHeader.ChequeNumber;
				
				sALSalesHeaderCollection.Add(_sALSalesHeaderWCF);
			}
			return sALSalesHeaderCollection;
		}
예제 #12
0
			/// <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.SALSalesHeaderBase.DeleteAllByForeignKeyCustomerID(new POS.DataLayer.BDCustomerPrimaryKey(pk.CustomerID));
		}
예제 #13
0
		/// <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.Depit = _bDCustomerAccount.Depit;
				_bDCustomerAccountWCF.Credit = _bDCustomerAccount.Credit;
				_bDCustomerAccountWCF.ChequeNumber = _bDCustomerAccount.ChequeNumber;
				_bDCustomerAccountWCF.InvoiceType = _bDCustomerAccount.InvoiceType;
				_bDCustomerAccountWCF.LstDayToPay = _bDCustomerAccount.LstDayToPay;
				
				bDCustomerAccountCollection.Add(_bDCustomerAccountWCF);
			}
			return bDCustomerAccountCollection;
		}
예제 #14
0
			/// <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));
		}