private void cmbItem_SelectedIndexChanged(object sender, EventArgs e) { //txtGRNUnitCost.Text = "0.0"; // cmbGRNNO.Text = ""; Material objMat = new Material(); BasicProduct objBasic = new BasicProduct(); FinishProduct objFinish = new FinishProduct(); Store objStore = new Store(); Stock_DL objStockDL = new Stock_DL(ConnectionStringClass.GetConnection()); try { String ItemCode = ""; txtUnit.Text = ""; txtAvailableQty.Text = ""; if (cmbItem.Items.Count > 0 && cmbItem.SelectedValue != null) { ItemCode = cmbItem.SelectedValue.ToString(); objStore = (Store)cmbStoreFrom.SelectedItem; if (cmbMTNType.SelectedItem.Equals("Material")) { objMat = objMaterialDL.Get(ItemCode); txtUnit.Text = objMat.MatUnit.UnitName; //txtGRNUnitCost.Text = objStockDL.GetAVGUnitPrice_Material(objStore.StoreID, ItemCode).ToString(); txtAvailableQty.Text = objStockDL.GetAvailableQty(objStore.StoreID, ItemCode, Stock.Type.Material).ToString(); } else if (cmbMTNType.SelectedItem.Equals("Basic Product")) { objBasic = objBasicProductDL.Get(ItemCode); txtUnit.Text = objBasic.BasicProductUnit.UnitName; //txtGRNUnitCost.Text = objStockDL.GetAVGUnitPrice_BasicProduct(objStore.StoreID, ItemCode).ToString(); txtAvailableQty.Text = objStockDL.GetAvailableQty(objStore.StoreID, ItemCode, Stock.Type.BasicProduct).ToString(); } else if (cmbMTNType.SelectedItem.Equals("Finish Product")) { objFinish = objFinishProductDL.Get(ItemCode); txtUnit.Text = objFinish.FinishProductPackingType.PackingTitle; //txtGRNUnitCost.Text = objStockDL.GetAVGUnitPrice_FinishProduct(objStore.StoreID, ItemCode).ToString(); txtAvailableQty.Text = objStockDL.GetAvailableQty(objStore.StoreID, ItemCode, Stock.Type.FinishProduct).ToString(); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Work() { MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection()); Stock_DL objStockDL = new Stock_DL(ConnectionStringClass.GetConnection()); try { int count = objMRDL.GET_Approval_Count(CurrentUser.EmployeeID, MR.Status.Initial); if (count > 0) { TipType = 1; TipText = TipText + "-- " + count + " Material Requisition(s) for approval.\n"; } int count1 = objMRDL.GET_Issue_Count(CurrentUser.EmployeeID, MR.Status.Approved); if (count1 > 0) { TipType = 2; TipText = TipText + "-- " + count1 + " Material Requisition(s) for Item Issue.\n"; } int count2 = objStockDL.Get_ReorderLevel_Below_Count(CurrentUser.EmployeeID); if (count2 > 0) { TipType = 3; TipText = TipText + "-- Quantity of " + count2 + " item(s) in the store low than reorder level.\n"; } } catch (Exception ex) { } finally { objMRDL = null; } }