Example #1
0
 public override void btn_Edit_Click(object sender, EventArgs e)
 {
     INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey();
     pk.AdjustStockReasonID= (int)dgrid_Result.Rows [dgrid_Result.SelectedCells[0].RowIndex].Cells["AdjustStockReasonID"].Value;
     INVAdjustStockReason reason= adjustStock.SelectOne(pk);
     FrmAdjustReasonAddEdit frm = new FrmAdjustReasonAddEdit(reason);
     frm.ShowDialog();
     dgrid_Result.DataSource = adjustStock.SelectAll();
 }
Example #2
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVAdjustStockReason</returns>
        public INVAdjustStockReason SelectOne(INVAdjustStockReasonPrimaryKey pk)
        {
            _iNVAdjustStockReasonWCF = new INVAdjustStockReason();
            _iNVAdjustStockReason    = POS.DataLayer.INVAdjustStockReasonBase.SelectOne(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID));

            _iNVAdjustStockReasonWCF.AdjustStockReasonID   = _iNVAdjustStockReason.AdjustStockReasonID;
            _iNVAdjustStockReasonWCF.AdjustStockreasonName = _iNVAdjustStockReason.AdjustStockreasonName;

            return(_iNVAdjustStockReasonWCF);
        }
        /// <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="INVAdjustStockReasonPrimaryKey">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 INVAdjustStockCollection</returns>
        public INVAdjustStockCollection SelectAllByForeignKeyAdjustReasonIDPaged(INVAdjustStockReasonPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
        {
            INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection();

            foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAllByForeignKeyAdjustReasonIDPaged(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID), pageSize, skipPages, orderByStatement))
            {
                _iNVAdjustStockWCF = new INVAdjustStock();
                _iNVAdjustStockWCF.AdjustStockID  = _iNVAdjustStock.AdjustStockID;
                _iNVAdjustStockWCF.ProductID      = _iNVAdjustStock.ProductID;
                _iNVAdjustStockWCF.BatchID        = _iNVAdjustStock.BatchID;
                _iNVAdjustStockWCF.Qty            = _iNVAdjustStock.Qty;
                _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID;
                _iNVAdjustStockWCF.CreatedBy      = _iNVAdjustStock.CreatedBy;
                _iNVAdjustStockWCF.CredateDate    = _iNVAdjustStock.CredateDate;
                _iNVAdjustStockWCF.UpdatedBy      = _iNVAdjustStock.UpdatedBy;
                _iNVAdjustStockWCF.UpdateDate     = _iNVAdjustStock.UpdateDate;

                iNVAdjustStockCollection.Add(_iNVAdjustStockWCF);
            }
            return(iNVAdjustStockCollection);
        }
        /// <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="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVAdjustStockCollection</returns>
        public INVAdjustStockCollection SelectAllByForeignKeyAdjustReasonID(INVAdjustStockReasonPrimaryKey pk)
        {
            INVAdjustStockCollection iNVAdjustStockCollection = new INVAdjustStockCollection();

            foreach (POS.DataLayer.INVAdjustStock _iNVAdjustStock in POS.DataLayer.INVAdjustStockBase.SelectAllByForeignKeyAdjustReasonID(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID)))
            {
                _iNVAdjustStockWCF = new INVAdjustStock();
                _iNVAdjustStockWCF.AdjustStockID  = _iNVAdjustStock.AdjustStockID;
                _iNVAdjustStockWCF.ProductID      = _iNVAdjustStock.ProductID;
                _iNVAdjustStockWCF.BatchID        = _iNVAdjustStock.BatchID;
                _iNVAdjustStockWCF.Qty            = _iNVAdjustStock.Qty;
                _iNVAdjustStockWCF.AdjustReasonID = _iNVAdjustStock.AdjustReasonID;
                _iNVAdjustStockWCF.CreatedBy      = _iNVAdjustStock.CreatedBy;
                _iNVAdjustStockWCF.CredateDate    = _iNVAdjustStock.CredateDate;
                _iNVAdjustStockWCF.UpdatedBy      = _iNVAdjustStock.UpdatedBy;
                _iNVAdjustStockWCF.UpdateDate     = _iNVAdjustStock.UpdateDate;

                iNVAdjustStockCollection.Add(_iNVAdjustStockWCF);
            }
            return(iNVAdjustStockCollection);
        }
Example #5
0
 public override void btn_Delete_Click(object sender, EventArgs e)
 {
     if (dgrid_Result .SelectedCells.Count > 0)
     {
         if (MessageBox.Show ("هل نت متأكد من الحذف ؟","تحذير",MessageBoxButtons.YesNo)==  System.Windows.Forms.DialogResult.Yes)
         {
             INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey();
             pk.AdjustStockReasonID = (int)dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["AdjustStockReasonID"].Value;
             try
             {
                 adjustStock.Delete(pk); 
                 MessageBox.Show("لقد تمت عمليه الحذف بنجاح");
             }
             catch (Exception ex)
             {
                 MessageBox.Show("لم تتم عمليه الحذف .. حيث ان السبب مستخدم ");
             }
            
             dgrid_Result.DataSource = adjustStock.SelectAll();
         }
     }
 }
Example #6
0
 public override void btn_Save_Click(object sender, EventArgs e)
 {
     if (txb_AdjustStockReason.Text!="")
     {
         if (_currentReason == null)
         {
             _currentReason = new INVAdjustStockReason();
             _currentReason.AdjustStockreasonName = txb_AdjustStockReason.Text;
             service.Insert(_currentReason);
         }
         else
         {
             INVAdjustStockReasonPrimaryKey pk = new INVAdjustStockReasonPrimaryKey();
             pk.AdjustStockReasonID = _currentReason.AdjustStockReasonID;
             _currentReason = service.SelectOne(pk);
             _currentReason.AdjustStockreasonName = txb_AdjustStockReason.Text;
             service.Update(_currentReason);
         }
         MessageBox.Show("تم الحفظ بنجاح");
         this.Close();
     }
 }
Example #7
0
 ///<summary>
 ///This method will Delete the object from the database
 ///</summary>
 ///<param name="pk" type="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be fetched.</param>
 /// <returns>True if succeeded</returns>
 public bool Delete(INVAdjustStockReasonPrimaryKey pk)
 {
     return(POS.DataLayer.INVAdjustStockReasonBase.Delete(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID)));
 }
 /// <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="INVAdjustStockReasonPrimaryKey">Primary Key information based on which data is to be deleted.</param>
 ///
 /// <returns>True if succeeded</returns>
 public bool DeleteAllByForeignKeyAdjustReasonID(INVAdjustStockReasonPrimaryKey pk)
 {
     return(POS.DataLayer.INVAdjustStockBase.DeleteAllByForeignKeyAdjustReasonID(new POS.DataLayer.INVAdjustStockReasonPrimaryKey(pk.AdjustStockReasonID)));
 }