private void AddFoodItemCtl_Load(object sender, EventArgs e) { CCategoryAncestorDAO cCategoryAncestorDao = new CCategoryAncestorDAO(); CResult oResult = cCategoryAncestorDao.GetCategoryAnchestors(m_iCat3ID, 3); CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data; LoadRawMaterialCategory(); // add by deb for inventory system this.FillParentCategory(); cmbParent.SelectedValue = oCatAnc.ParentCategoryID; Int32 parentId = Convert.ToInt32(cmbParent.SelectedValue); CCategory1DAO aCategory1Dao = new CCategory1DAO(); List<CCategory1> category1s = aCategory1Dao.GetCategory1IdByParentId(parentId); cmbCategory1.DisplayMember = "Category1Name"; cmbCategory1.ValueMember = "Category1ID"; cmbCategory1.DataSource = category1s; cmbCategory1.SelectedValue = oCatAnc.Category1ID; int cat1Id = Convert.ToInt32(cmbCategory1.SelectedValue); FillFoodType(cat1Id); cmbFoodType.SelectedValue = oCatAnc.Category2ID; Int32 foodTypeID = Convert.ToInt32(cmbFoodType.SelectedValue); FillFoodCategory(foodTypeID); cmbCategory.SelectedValue = m_iCat3ID; //cmbCategory.SelectedValue = objFoodItemUpdate.Category3ID; this.FillAllUoMCmb(); if (m_iCat3ID > 0) { // this.showExistingData(); } //LoadRawProduct(); }
/// <summary> /// Show existing Data /// </summary> private void showExistingData() { CCategory3DAO cCategory3Dao = new CCategory3DAO(); objFoodItemUpdate = new CCategory3(); objFoodItemUpdate = cCategory3Dao.GetAllCategory3ByCategory3ID(m_iCat3ID); CCategoryAncestorDAO cCategoryAncestorDao = new CCategoryAncestorDAO(); CResult oResult = cCategoryAncestorDao.GetCategoryAnchestors(m_iCat3ID, 3); CCategoryAncestor oCatAnc = (CCategoryAncestor)oResult.Data; //if (oResult.IsSuccess && oResult.Data != null) //{ if (objFoodItemUpdate != null) { //objFoodItemUpdate = (CCategory3)oResult.Data; txtProductName.Text = objFoodItemUpdate.Category3Name; //txtBoxBarcode.Text = objFoodItemUpdate.MBarCode; txtInitialQuantity.Text = objFoodItemUpdate.MInitialQuantity.ToString(); if (objFoodItemUpdate.MUnlimitStatus == 1) { //txtInitialQuantity.Clear(); chkunstockable.Checked = true; } else { chkunstockable.Checked = false; //txtInitialQuantity.Text = objFoodItem.InitialItemQuantity.ToString(); } txtReorderLevel.Text = objFoodItemUpdate.MReorderLevel.ToString(); // txtRetailPrice.Text = objFoodItemUpdate.MRetailPrice.ToString("F02"); txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02"); txtDescription.Text = objFoodItemUpdate.Category3Description; txtInitialQuantity.Text = objFoodItemUpdate.MUnitsInStock.ToString(); currentStock = objFoodItemUpdate.MUnitsInStock; chkNontaxable.Checked = objFoodItemUpdate.MNonTaxableGood; if (objFoodItemUpdate.MVatIncluded) { #if VATFIXED cmbboxVatIncluded.SelectedIndex = 0; txtRetailPrice.Text = objFoodItemUpdate.RetailPrice.ToString("F02"); txtLastPurchasePrice.Text = objFoodItemUpdate.LastPurchasePrice.ToString("F02"); txtWholeSalePrice.Text = objFoodItemUpdate.WholeSalePrice.ToString("F02"); #else // chbVatIncluded.Checked = true; // double vat = 1 + Program.vat / 100; //txtRetailPrice.Text = (objFoodItemUpdate.MRetailPrice * vat).ToString("F02"); //txtLastPurchasePrice.Text = (objFoodItemUpdate.MLastPurchasePrice * vat).ToString("F02"); //txtWholeSalePrice.Text = (objFoodItemUpdate.MWholeSalePrice * vat).ToString("F02"); //txtRetailPrice.Text = (objFoodItemUpdate.Category3TablePrice * vat).ToString("F02"); //txtLastPurchasePrice.Text = (objFoodItemUpdate.Category3TakeAwayPrice * vat).ToString("F02"); //txtWholeSalePrice.Text = (objFoodItemUpdate.Category3BarPrice * vat).ToString("F02"); txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02"); txtLastPurchasePrice.Text = objFoodItemUpdate.Category3TakeAwayPrice.ToString("F02"); txtWholeSalePrice.Text = objFoodItemUpdate.Category3BarPrice.ToString("F02"); cmbboxVatIncluded.SelectedIndex = 0; #endif } else { // chbVatIncluded.Checked = false; //txtRetailPrice.Text = objFoodItemUpdate.MRetailPrice.ToString("F02"); //txtLastPurchasePrice.Text = objFoodItemUpdate.MLastPurchasePrice.ToString("F02"); //txtWholeSalePrice.Text = objFoodItemUpdate.MWholeSalePrice.ToString("F02"); txtRetailPrice.Text = objFoodItemUpdate.Category3TablePrice.ToString("F02"); txtLastPurchasePrice.Text = objFoodItemUpdate.Category3TakeAwayPrice.ToString("F02"); txtWholeSalePrice.Text = objFoodItemUpdate.Category3BarPrice.ToString("F02"); cmbboxVatIncluded.SelectedIndex = 1; } if (objFoodItemUpdate.Category3OrderStatus > 0) rdoActive.Checked = true; else rdoInactive.Checked = true; //if (objFoodItem.ItemSellingIn == "Per Piece") cmbSellingIn.SelectedText = "Per Piece"; //else if (objFoodItem.ItemSellingIn == "Per Weight") cmbSellingIn.SelectedText = "Per Weight"; try { cmbSellingIn.SelectedIndex = cmbSellingIn.FindString(objFoodItemUpdate.ItemSellingIn); cmbStanUoM.SelectedIndex = cmbStanUoM.FindString(objFoodItemUpdate.MStandardUoM); cmbSalesUoM.SelectedIndex = cmbSalesUoM.FindString(objFoodItemUpdate.MSalesUoM); cmbPurUoM.SelectedIndex = cmbPurUoM.FindString(objFoodItemUpdate.MPurchaseUoM); //cmbParent.SelectedValue = oCatAnc.ParentCategoryID; //cmbFoodType.SelectedValue = oCatAnc.Category2ID; //cmbCategory.SelectedValue = objFoodItemUpdate.Category3ID; } catch (Exception ex) { } } if (oResult.IsSuccess && oResult.Data != null) { int tmpCat3ID = oCatAnc.Category3ID; int tmpCat2ID = oCatAnc.Category2ID; int tmpCat1ID = oCatAnc.Category1ID; int tmpParentCatID = oCatAnc.ParentCategoryID; if (objFoodItemUpdate.Category3OrderStatus == 1) { //m_activeStatus = true; rdoActive.Checked = true; } else if (objFoodItemUpdate.Category3OrderStatus == 0) { //rdoInActive.Checked = true; //m_activeStatus = false; } // cmbParent.SelectedValue = tmpParentCatID; // cmbFoodType.SelectedValue = tmpCat2ID; // cmbCategory.SelectedValue = tmpCat3ID; } }