/// <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="BDSupplierPrimaryKey">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 BDSupplierAccountCollection</returns>
        public BDSupplierAccountCollection SelectAllByForeignKeySupplierIDPaged(BDSupplierPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            BDSupplierAccountCollection bDSupplierAccountCollection = new BDSupplierAccountCollection();

            foreach (POS.DataLayer.BDSupplierAccount _bDSupplierAccount in POS.DataLayer.BDSupplierAccountBase.SelectAllByForeignKeySupplierIDPaged(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID), pageSize, skipPages, orderByStatement))
            {
                _bDSupplierAccountWCF = new BDSupplierAccount();
                _bDSupplierAccountWCF.SupplierAccountId = _bDSupplierAccount.SupplierAccountId;
                _bDSupplierAccountWCF.PurcaseInvoiceID  = _bDSupplierAccount.PurcaseInvoiceID;
                _bDSupplierAccountWCF.PurchaseDate      = _bDSupplierAccount.PurchaseDate;
                _bDSupplierAccountWCF.SupplierID        = _bDSupplierAccount.SupplierID;
                _bDSupplierAccountWCF.InvoiceNumber     = _bDSupplierAccount.InvoiceNumber;
                _bDSupplierAccountWCF.TotalPrice        = _bDSupplierAccount.TotalPrice;
                _bDSupplierAccountWCF.PaidAmount        = _bDSupplierAccount.PaidAmount;
                _bDSupplierAccountWCF.IsVoid            = _bDSupplierAccount.IsVoid;
                _bDSupplierAccountWCF.RemainingAmount   = _bDSupplierAccount.RemainingAmount;
                _bDSupplierAccountWCF.CreateDate        = _bDSupplierAccount.CreateDate;
                _bDSupplierAccountWCF.CreatedBy         = _bDSupplierAccount.CreatedBy;
                _bDSupplierAccountWCF.updateDate        = _bDSupplierAccount.updateDate;
                _bDSupplierAccountWCF.UpdatedBy         = _bDSupplierAccount.UpdatedBy;
                _bDSupplierAccountWCF.IsDeleted         = _bDSupplierAccount.IsDeleted;
                _bDSupplierAccountWCF.DeleteDate        = _bDSupplierAccount.DeleteDate;
                _bDSupplierAccountWCF.DeletedBy         = _bDSupplierAccount.DeletedBy;
                _bDSupplierAccountWCF.InvoiceType       = _bDSupplierAccount.InvoiceType;

                bDSupplierAccountCollection.Add(_bDSupplierAccountWCF);
            }
            return(bDSupplierAccountCollection);
        }
        /// <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="BDSupplierPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class BDSupplierAccountCollection</returns>
        public BDSupplierAccountCollection SelectAllByForeignKeySupplierID(BDSupplierPrimaryKey pk)
        {
            BDSupplierAccountCollection bDSupplierAccountCollection = new BDSupplierAccountCollection();

            foreach (POS.DataLayer.BDSupplierAccount _bDSupplierAccount in POS.DataLayer.BDSupplierAccountBase.SelectAllByForeignKeySupplierID(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID)))
            {
                _bDSupplierAccountWCF = new BDSupplierAccount();
                _bDSupplierAccountWCF.SupplierAccountId = _bDSupplierAccount.SupplierAccountId;
                _bDSupplierAccountWCF.PurcaseInvoiceID  = _bDSupplierAccount.PurcaseInvoiceID;
                _bDSupplierAccountWCF.PurchaseDate      = _bDSupplierAccount.PurchaseDate;
                _bDSupplierAccountWCF.SupplierID        = _bDSupplierAccount.SupplierID;
                _bDSupplierAccountWCF.InvoiceNumber     = _bDSupplierAccount.InvoiceNumber;
                _bDSupplierAccountWCF.TotalPrice        = _bDSupplierAccount.TotalPrice;
                _bDSupplierAccountWCF.PaidAmount        = _bDSupplierAccount.PaidAmount;
                _bDSupplierAccountWCF.IsVoid            = _bDSupplierAccount.IsVoid;
                _bDSupplierAccountWCF.RemainingAmount   = _bDSupplierAccount.RemainingAmount;
                _bDSupplierAccountWCF.CreateDate        = _bDSupplierAccount.CreateDate;
                _bDSupplierAccountWCF.CreatedBy         = _bDSupplierAccount.CreatedBy;
                _bDSupplierAccountWCF.updateDate        = _bDSupplierAccount.updateDate;
                _bDSupplierAccountWCF.UpdatedBy         = _bDSupplierAccount.UpdatedBy;
                _bDSupplierAccountWCF.IsDeleted         = _bDSupplierAccount.IsDeleted;
                _bDSupplierAccountWCF.DeleteDate        = _bDSupplierAccount.DeleteDate;
                _bDSupplierAccountWCF.DeletedBy         = _bDSupplierAccount.DeletedBy;
                _bDSupplierAccountWCF.Depit             = _bDSupplierAccount.Depit;
                _bDSupplierAccountWCF.Credit            = _bDSupplierAccount.Credit;
                _bDSupplierAccountWCF.LstDayToPay       = _bDSupplierAccount.LstDayToPay;
                _bDSupplierAccountWCF.ChequeNumber      = _bDSupplierAccount.ChequeNumber;
                _bDSupplierAccountWCF.InvoiceType       = _bDSupplierAccount.InvoiceType;

                bDSupplierAccountCollection.Add(_bDSupplierAccountWCF);
            }
            return(bDSupplierAccountCollection);
        }
Beispiel #3
0
 public override void btn_Save_Click(object sender, EventArgs e)
 {
     if (tbx_Name.Text != "")
     {
         supplier = new BDSupplier();
         BDSupplierService supplierService = new BDSupplierService();
         if (SupplierID == null)//new supplier
         {
             supplier.SupplierCode = tbx_Code.Text;
             supplier.SupplierName = tbx_Name.Text;
             supplier.Address = tbx_Address.Text;
             supplier.Phone1 = tbx_Pone1.Text;
             supplier.phone2 = tbx_phone2.Text;
             supplier.Mobile1 = tbx_Mobile1.Text;
             supplier.Mobile2 = tbx_Mobile2.Text;
             supplier.Email = tbx_Email.Text;
             supplier.IsActive = chk_IsActive.Checked;
             supplier.Debit = 0;
             supplier.Credit = 0;
             supplierService.Insert(supplier);
            // ClearControls(); 
             MessageBox.Show("تم الحفظ بنجاح");
         }
         else
         {
             BDSupplierPrimaryKey pk = new BDSupplierPrimaryKey();
             pk.SupplierID = SupplierID;
             supplier = supplierService.SelectOne(pk);
             supplier.SupplierCode = tbx_Code.Text;
             supplier.SupplierName = tbx_Name.Text;
             supplier.Address = tbx_Address.Text;
             supplier.Phone1 = tbx_Pone1.Text;
             supplier.phone2 = tbx_phone2.Text;
             supplier.Mobile1 = tbx_Mobile1.Text;
             supplier.Mobile2 = tbx_Mobile2.Text;
             supplier.Email = tbx_Email.Text;
             supplier.IsActive = chk_IsActive.Checked;
            supplierService.Update(supplier);
            MessageBox.Show("تم التعديل بنجاح");
         }
         this.Close();
        
     
     }
     else
     {
         MessageBox.Show("لابد من ادخال إسم المورد");
     }
 }
        private void FillSupplierData()
        {
            try
            {
                BDSupplierPrimaryKey _supplierPrimaryKey = new BDSupplierPrimaryKey();
                _supplierPrimaryKey.SupplierID = _supplierID;
                _supplier = _bDSupplierWrapper.SelectOne(_supplierPrimaryKey);
                num_Credit.Value = _supplier.Credit.Value;
                num_Debit.Value = _supplier.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="BDSupplierPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class BDSupplier</returns>
        public BDSupplier SelectOne(BDSupplierPrimaryKey pk)
        {
            _bDSupplierWCF = new BDSupplier();
            _bDSupplier    = POS.DataLayer.BDSupplierBase.SelectOne(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID));

            _bDSupplierWCF.SupplierID   = _bDSupplier.SupplierID;
            _bDSupplierWCF.SupplierCode = _bDSupplier.SupplierCode;
            _bDSupplierWCF.SupplierName = _bDSupplier.SupplierName;
            _bDSupplierWCF.Address      = _bDSupplier.Address;
            _bDSupplierWCF.Phone1       = _bDSupplier.Phone1;
            _bDSupplierWCF.phone2       = _bDSupplier.Phone2;
            _bDSupplierWCF.Mobile1      = _bDSupplier.Mobile1;
            _bDSupplierWCF.Mobile2      = _bDSupplier.Mobile2;
            _bDSupplierWCF.Email        = _bDSupplier.Email;
            _bDSupplierWCF.IsActive     = _bDSupplier.IsActive;

            return(_bDSupplierWCF);
        }
        /// <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="BDSupplierPrimaryKey">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 PURPurchaseHeaderCollection</returns>
        public PURPurchaseHeaderCollection SelectAllByForeignKeySupplierIDPaged(BDSupplierPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            PURPurchaseHeaderCollection pURPurchaseHeaderCollection = new PURPurchaseHeaderCollection();

            foreach (POS.DataLayer.PURPurchaseHeader _pURPurchaseHeader in POS.DataLayer.PURPurchaseHeaderBase.SelectAllByForeignKeySupplierIDPaged(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID), pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseHeaderWCF = new PURPurchaseHeader();
                _pURPurchaseHeaderWCF.PurcaseHeaderID     = _pURPurchaseHeader.PurcaseHeaderID;
                _pURPurchaseHeaderWCF.PurchaseDate        = _pURPurchaseHeader.PurchaseDate;
                _pURPurchaseHeaderWCF.PaymentTypeID       = _pURPurchaseHeader.PaymentTypeID;
                _pURPurchaseHeaderWCF.SupplierID          = _pURPurchaseHeader.SupplierID;
                _pURPurchaseHeaderWCF.InvoiceNumber       = _pURPurchaseHeader.InvoiceNumber;
                _pURPurchaseHeaderWCF.CreateDate          = _pURPurchaseHeader.CreateDate;
                _pURPurchaseHeaderWCF.CreatedBy           = _pURPurchaseHeader.CreatedBy;
                _pURPurchaseHeaderWCF.updateDate          = _pURPurchaseHeader.updateDate;
                _pURPurchaseHeaderWCF.UpdatedBy           = _pURPurchaseHeader.UpdatedBy;
                _pURPurchaseHeaderWCF.IsDeleted           = _pURPurchaseHeader.IsDeleted;
                _pURPurchaseHeaderWCF.DeleteDate          = _pURPurchaseHeader.DeleteDate;
                _pURPurchaseHeaderWCF.TotalPrice          = _pURPurchaseHeader.TotalPrice;
                _pURPurchaseHeaderWCF.ServicePrice        = _pURPurchaseHeader.ServicePrice;
                _pURPurchaseHeaderWCF.PaidAmount          = _pURPurchaseHeader.PaidAmount;
                _pURPurchaseHeaderWCF.IsClosed            = _pURPurchaseHeader.IsClosed;
                _pURPurchaseHeaderWCF.IsVoid              = _pURPurchaseHeader.IsVoid;
                _pURPurchaseHeaderWCF.IsPrinted           = _pURPurchaseHeader.IsPrinted;
                _pURPurchaseHeaderWCF.RefuseReasonID      = _pURPurchaseHeader.RefuseReasonID;
                _pURPurchaseHeaderWCF.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
                _pURPurchaseHeaderWCF.TotalDiscountRatio  = _pURPurchaseHeader.TotalDiscountRatio;
                _pURPurchaseHeaderWCF.TaxTypeID           = _pURPurchaseHeader.TaxTypeID;
                _pURPurchaseHeaderWCF.RemainingAmount     = _pURPurchaseHeader.RemainingAmount;
                _pURPurchaseHeaderWCF.LastDayToPay        = _pURPurchaseHeader.LastDayToPay;
                _pURPurchaseHeaderWCF.DeletedBy           = _pURPurchaseHeader.DeletedBy;
                _pURPurchaseHeaderWCF.Notes        = _pURPurchaseHeader.Notes;
                _pURPurchaseHeaderWCF.InventoryID  = _pURPurchaseHeader.InventoryID;
                _pURPurchaseHeaderWCF.InvoiceDate  = _pURPurchaseHeader.InvoiceDate;
                _pURPurchaseHeaderWCF.ChequeNumber = _pURPurchaseHeader.ChequeNumber;

                pURPurchaseHeaderCollection.Add(_pURPurchaseHeaderWCF);
            }
            return(pURPurchaseHeaderCollection);
        }
Beispiel #7
0
        public override void btn_Delete_Click(object sender, EventArgs e)
        {

            int? supplierID = 0;
            if (dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["SupplierID"].Value != null)
            {
                if (MessageBox.Show("هل نت متأكد من حذف المورد؟", "تحذير", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    supplierID = Convert.ToInt32(dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["SupplierID"].Value);
                    BDSupplierPrimaryKey customerPK = new BDSupplierPrimaryKey();
                    customerPK.SupplierID = supplierID;
                    try
                    {
                        _bDSupplierWrapper.Delete(customerPK);
                    }
                    catch (Exception ex )
                    {
                        
                        MessageBox.Show ("لا يمكن مسح هذا المورد .. حيث انه مرتبط بفواتير");
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("لابد من اختيار مورد");
            }
            Search();
        }
        private bool ValidateSaving()
        {
            if (cbx_Supplier.SelectedIndex == -1)
            {
                MessageBox.Show("اختار مورد أولا");
                return false;
            }
            if (cbx_Inventory.SelectedIndex == -1)
            {
                MessageBox.Show("اختار المخزن أولا");
                return false;
            }
            if (cbx_PaymentType.SelectedIndex == -1)
            {
                MessageBox.Show("اختار طريقه دفع أولا");
                return false;
            }
            if ((int)cbx_PaymentType.SelectedValue ==1 &&decimal.Parse ( num_Remaining.Text)>0)
            {
                MessageBox.Show(" لا يمكن ان تكون طريقه الدفع كاش ويوجد متبقي  ");
                return false;
            }
              BDSupplierPrimaryKey key=  new BDSupplierPrimaryKey();
            key.SupplierID =int.Parse (cbx_Supplier .SelectedValue.ToString ()) ;

            if (txt_invoiceNumber.Text != "" && _pURPurchaseHeaderWrapper.SelectAllByForeignKeySupplierID(key).Where(h => h.InvoiceNumber == txt_invoiceNumber.Text).Count() > 0)
            {
                MessageBox.Show("يوجد فاتوره بنفس الرقم لنفس المورد");
                return false;
            }
            return true;
        }
Beispiel #9
0
 ///<summary>
 ///This method will Delete the object from the database
 ///</summary>
 ///<param name="pk" type="BDSupplierPrimaryKey">Primary Key information based on which data is to be fetched.</param>
 /// <returns>True if succeeded</returns>
 public bool Delete(BDSupplierPrimaryKey pk)
 {
     return(POS.DataLayer.BDSupplierBase.Delete(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID)));
 }
Beispiel #10
0
 private void LoadControls()
 {
     BDSupplierPrimaryKey pk = new BDSupplierPrimaryKey();
     pk.SupplierID = SupplierID;
     supplier = supplierWrapper.SelectOne(pk);
     tbx_Code.Text = supplier.SupplierCode != null ? supplier.SupplierCode : "";
     tbx_Name.Text = supplier.SupplierName;
     tbx_Address.Text = supplier.Address != null ? supplier.Address : "";
     tbx_Pone1.Text = supplier.Phone1 != null ? supplier.Phone1 : "";
     tbx_phone2.Text = supplier.phone2 != null ? supplier.phone2 : "";
     tbx_Mobile1.Text = supplier.Mobile1 != null ? supplier.Mobile1 : "";
     tbx_Mobile2.Text = supplier.Mobile2 != null ? supplier.Mobile2 : "";
     tbx_Email.Text = supplier.Email != null ? supplier.Email : "";
     chk_IsActive.Checked = supplier.IsActive != null ? (bool)supplier.IsActive : true;
 }
 /// <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="BDSupplierPrimaryKey">Primary Key information based on which data is to be deleted.</param>
 ///
 /// <returns>True if succeeded</returns>
 public bool DeleteAllByForeignKeySupplierID(BDSupplierPrimaryKey pk)
 {
     return(POS.DataLayer.BDSupplierAccountBase.DeleteAllByForeignKeySupplierID(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID)));
 }
 /// <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="BDSupplierPrimaryKey">Primary Key information based on which data is to be deleted.</param>
 ///
 /// <returns>True if succeeded</returns>
 public bool DeleteAllByForeignKeySupplierID(BDSupplierPrimaryKey pk)
 {
     return(POS.DataLayer.PURPurchaseHeaderBase.DeleteAllByForeignKeySupplierID(new POS.DataLayer.BDSupplierPrimaryKey(pk.SupplierID)));
 }