private void initEntity(int groupId) { BDProductGroupPrimaryKey pk = new BDProductGroupPrimaryKey(); pk.ProductGroupID = groupId; _bdProductGroup = _bdProductGroupWrapper.SelectOne(pk); txt_GroupName.Text =_bdProductGroup.ProductGroupName; txt_Notes.Text = _bdProductGroup.Notes; }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDProductGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProductGroup</returns> public BDProductGroup SelectOne(BDProductGroupPrimaryKey pk) { _bDProductGroupWCF = new BDProductGroup(); _bDProductGroup = POS.DataLayer.BDProductGroupBase.SelectOne(new POS.DataLayer.BDProductGroupPrimaryKey(pk.ProductGroupID)); _bDProductGroupWCF.ProductGroupID = _bDProductGroup.ProductGroupID; _bDProductGroupWCF.ProductGroupName = _bDProductGroup.ProductGroupName; _bDProductGroupWCF.Notes = _bDProductGroup.Notes; return(_bDProductGroupWCF); }
public override void btn_Delete_Click(object sender, EventArgs e) { int? productGroupID = 0; if (dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["ProductGroupID"].Value != null) { if (MessageBox.Show("هل نت متأكد من حذف المجموعة؟", "تحذير", MessageBoxButtons.YesNo) == DialogResult.Yes) { productGroupID = Convert.ToInt32(dgrid_Result.Rows[dgrid_Result.SelectedCells[0].RowIndex].Cells["ProductGroupID"].Value); BDProductGroupPrimaryKey productGroupPK = new BDProductGroupPrimaryKey(); productGroupPK.ProductGroupID = productGroupID; _bdProductGroupWrapper.Delete(productGroupPK); } else { return; } } else { MessageBox.Show("لابد من اختيار مجموعة"); } InitiateGrid(); }
/// <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="BDProductGroupPrimaryKey">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 BDProductCollection</returns> public BDProductCollection SelectAllByForeignKeyProductGroupIDPaged(BDProductGroupPrimaryKey pk, int pageSize, int skipPages, string orderByStatement) { BDProductCollection bDProductCollection = new BDProductCollection(); foreach (POS.DataLayer.BDProduct _bDProduct in POS.DataLayer.BDProductBase.SelectAllByForeignKeyProductGroupIDPaged(new POS.DataLayer.BDProductGroupPrimaryKey(pk.ProductGroupID), pageSize, skipPages, orderByStatement)) { _bDProductWCF = new BDProduct(); _bDProductWCF.ProductID = _bDProduct.ProductID; _bDProductWCF.ProductName = _bDProduct.ProductName; _bDProductWCF.ProductGroupID = _bDProduct.ProductGroupID; _bDProductWCF.ProductCode = _bDProduct.ProductCode; _bDProductWCF.IsAcceptBatch = _bDProduct.IsAcceptBatch; _bDProductWCF.ProductPrice = _bDProduct.ProductPrice; _bDProductWCF.IsFixedPrice = _bDProduct.IsFixedPrice; _bDProductWCF.HasDiscount = _bDProduct.HasDiscount; _bDProductWCF.DiscountAmount = _bDProduct.DiscountAmount; _bDProductWCF.DescountRatio = _bDProduct.DescountRatio; _bDProductWCF.IsActive = _bDProduct.IsActive; _bDProductWCF.Notes = _bDProduct.Notes; bDProductCollection.Add(_bDProductWCF); } return(bDProductCollection); }
/// <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="BDProductGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProductCollection</returns> public BDProductCollection SelectAllByForeignKeyProductGroupID(BDProductGroupPrimaryKey pk) { BDProductCollection bDProductCollection = new BDProductCollection(); foreach (POS.DataLayer.BDProduct _bDProduct in POS.DataLayer.BDProductBase.SelectAllByForeignKeyProductGroupID(new POS.DataLayer.BDProductGroupPrimaryKey(pk.ProductGroupID))) { _bDProductWCF = new BDProduct(); _bDProductWCF.ProductID = _bDProduct.ProductID; _bDProductWCF.ProductName = _bDProduct.ProductName; _bDProductWCF.ProductGroupID = _bDProduct.ProductGroupID; _bDProductWCF.ProductCode = _bDProduct.ProductCode; _bDProductWCF.IsAcceptBatch = _bDProduct.IsAcceptBatch; _bDProductWCF.ProductPrice = _bDProduct.ProductPrice; _bDProductWCF.IsFixedPrice = _bDProduct.IsFixedPrice; _bDProductWCF.HasDiscount = _bDProduct.HasDiscount; _bDProductWCF.DiscountAmount = _bDProduct.DiscountAmount; _bDProductWCF.DescountRatio = _bDProduct.DescountRatio; _bDProductWCF.IsActive = _bDProduct.IsActive; _bDProductWCF.Notes = _bDProduct.Notes; bDProductCollection.Add(_bDProductWCF); } return(bDProductCollection); }
///<summary> ///This method will Delete the object from the database ///</summary> ///<param name="pk" type="BDProductGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <returns>True if succeeded</returns> public bool Delete(BDProductGroupPrimaryKey pk) { return(POS.DataLayer.BDProductGroupBase.Delete(new POS.DataLayer.BDProductGroupPrimaryKey(pk.ProductGroupID))); }
/// <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="BDProductGroupPrimaryKey">Primary Key information based on which data is to be deleted.</param> /// /// <returns>True if succeeded</returns> public bool DeleteAllByForeignKeyProductGroupID(BDProductGroupPrimaryKey pk) { return(POS.DataLayer.BDProductBase.DeleteAllByForeignKeyProductGroupID(new POS.DataLayer.BDProductGroupPrimaryKey(pk.ProductGroupID))); }
private void FillProductCBX(int groupID) { try { BDProductGroupPrimaryKey pk = new BDProductGroupPrimaryKey(); pk.ProductGroupID = groupID; this.cbx_Product.SelectedIndexChanged -= new System.EventHandler(this.cbx_Product_SelectedIndexChanged); cbx_Product.DataSource = null; var result = _bDProductWrapper.SelectAllProductsByGroupID(_inventoryID, pk); if (result != null) { cbx_Product.DataSource = result; cbx_Product.DisplayMember = "ProductName"; cbx_Product.ValueMember = "ProductID"; this.cbx_Product.SelectedIndexChanged += new System.EventHandler(this.cbx_Product_SelectedIndexChanged); cbx_Product.SelectedIndex = -1; } } catch (Exception) { throw; } }
private void FillProductCBX(int groupID) { try { BDProductGroupPrimaryKey pk = new BDProductGroupPrimaryKey(); pk.ProductGroupID = groupID; this.cbx_Product.SelectedIndexChanged -= new System.EventHandler(this.cbx_Product_SelectedIndexChanged); cbx_Product.DataSource = null; cbx_Product.DataSource = null;//_bDProductWrapper.SelectAllByForeignKeyProductGroupID(pk); cbx_Product.DisplayMember = "ProductName"; cbx_Product.ValueMember = "ProductID"; this.cbx_Product.SelectedIndexChanged += new System.EventHandler(this.cbx_Product_SelectedIndexChanged); cbx_Product.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("حدث خطأ برجاء تكرار العمليه مره اخرى واذا تكرر الخطا برجاءالاتصال بالشخص المصمم للبرنامج وارسال رسالة الخطا التى ستظهر بعد قليل له"); MessageBox.Show(ex.Message); } }