public DataTable GetProductType() { // TODO: Add ProductItemInfoBO.GetUnitOfMeasure implementation try { ITM_ProductDS dsProduct = new ITM_ProductDS(); DataSet dts = dsProduct.GetProductType(); if (dts.Tables.Count > 0) { return(dts.Tables[0]); } else { return(null); } } catch (PCSDBException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// Get report data for specific Product. /// When execute the SQL string, data adapter will return 5 table, Meta, Stock,BOm, Routing, StandardCost. /// We will name these table with provided names (get from Parameters). /// <author>Thachhnn: 01 03 2006 </author> /// </summary> /// <param name="pnProductID"Which Product to get info></param> /// <param name="pstrMetaDataTableName"></param> /// <param name="pstrStockStatusTableName"></param> /// <param name="pstrBOMTableName"></param> /// <param name="pstrStandardCostTableName"></param> /// <returns>DataSet with multiple datatable. This dataset will contain MetaDataTable, StockStatus, BOM, Routing, StandardCost</returns> public DataSet GetItemInformationData(int pnProductID, string pstrMetaDataTableName, string pstrStockStatusTableName, string pstrBOMTableName, string pstrRoutingTableName, string pstrStandardCostTableName) { const string METHOD_NAME = THIS + ".GetItemInformationData()"; ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.GetItemInformationData(pnProductID, pstrMetaDataTableName, pstrStockStatusTableName, pstrBOMTableName, pstrRoutingTableName, pstrStandardCostTableName)); }
//************************************************************************** /// <Description> /// Delete a product /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public void DeleteProduct(int pintProductID) { try { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); objITM_ProductDS.Delete(pintProductID); } catch (PCSDBException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// Get the product ID by code /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public int GetProductIDByCode(string pstrCode) { try { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.GetProductIDByCode(pstrCode)); } catch (PCSException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// Get the product ID by Description /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public int GetProductIDByDescription(string pstrDescription) { try { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.GetProductIDByDescription(pstrDescription)); } catch (PCSException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// This method uses to get ITM_ProductVO object /// </Description> /// <Inputs> /// int Id /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// ITM_ProductVO /// </Returns> /// <Authors> /// DungLa /// </Authors> /// <History> /// 10-Mar-2005 /// </History> /// <Notes> /// </Notes> //************************************************************************** public object GetProductInfo(int pintProductID) { try { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.GetProductInfo(pintProductID)); } catch (PCSException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// Get the Product Information from Database /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public object GetProductInfo(int pintID) { // TODO: Add ProductItemInfoBO.GetObjectVO implementation try { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.GetProductInfo(pintID)); } catch (PCSDBException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// Update the information for an existing product /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public void Update(object pObjectDetail) { // TODO: Add ProductItemInfoBO.Update implementation // TODO: Add ProductItemInfoBO.Add implementation try { if (ValidateBusiness(pObjectDetail)) { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); objITM_ProductDS.UpdateProductInfo(pObjectDetail); } } catch (PCSException ex) { throw ex; } catch (Exception ex) { throw ex; } }
//************************************************************************** /// <Description> /// add a new Product Item into database and return its new ID /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** public int AddAndReturnID(object pObjectDetail, int pintCopyFromProductID) { // TODO: Add ProductItemInfoBO.Add implementation try { if (ValidateBusiness(pObjectDetail)) { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); int intNewlyAddedProductID = objITM_ProductDS.AddAndReturnID(pObjectDetail); if (pintCopyFromProductID > 0) { //we have to copy its BOM, routing, and hearachy //1.Copy from BOM ITM_BOMDS dsITM_BOMDS = new ITM_BOMDS(); dsITM_BOMDS.CopyBOM(pintCopyFromProductID, intNewlyAddedProductID); //2.Copy from Routing ITM_RoutingDS dsITM_RoutingDS = new ITM_RoutingDS(); dsITM_RoutingDS.CopyRouting(pintCopyFromProductID, intNewlyAddedProductID); //3.Copy hearachy ITM_HierarchyDS dsITM_HierarchyDS = new ITM_HierarchyDS(); dsITM_HierarchyDS.CopyHierarchy(pintCopyFromProductID, intNewlyAddedProductID); } return(intNewlyAddedProductID); } else { return(-1); } } catch (PCSException ex) { throw ex; } catch (Exception ex) { throw ex; } }
public int ImportUpdateMappingData(DataTable dtImpData, int intPartyID, int intCCNID, int intMaxLine, DataSet dstMappingData) { int intResult = 0; const string TEMP_QTY_COL_NAME = "TempQty"; //Add new column for temp qty DataColumn objCol = new DataColumn(TEMP_QTY_COL_NAME); objCol.DataType = typeof(Decimal); objCol.DefaultValue = 0; dstMappingData.Tables[0].Columns.Add(objCol); int intMaxID = 0; dstMappingData.Tables[0].DefaultView.Sort = PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD; try { intMaxID = int.Parse(dstMappingData.Tables[0].Rows[dstMappingData.Tables[0].Rows.Count - 1][PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD].ToString()); } catch { intMaxID = 0; } dstMappingData.Tables[0].DefaultView.Sort = string.Empty; //walk through data ITM_ProductDS dsProduct = new ITM_ProductDS(); for (int i = INT_BEGIN_DATA_ROW; i < dtImpData.Rows.Count; i++) { //findout Item Code string strItemCode = dtImpData.Rows[i][INDEX_CODE].ToString(); string strDescription = dtImpData.Rows[i][INDEX_NAME].ToString(); string strRevision = dtImpData.Rows[i][INDEX_REVISION].ToString(); //find out total quantity at last column decimal dcmOrderQty = int.Parse(dtImpData.Rows[i][dtImpData.Columns.Count - 1].ToString()); //check if this item existed, update quantity only DataRow[] arrRows = dstMappingData.Tables[0].Select(ITM_ProductTable.CODE_FLD + "='" + strItemCode + "'"); if (arrRows.Length > 0) { arrRows[0][TEMP_QTY_COL_NAME] = decimal.Parse(arrRows[0][TEMP_QTY_COL_NAME].ToString()) + dcmOrderQty; continue; } if (dcmOrderQty <= 0) { continue; } ITM_ProductVO voProduct = (ITM_ProductVO)dsProduct.GetObjectVO(strItemCode, strDescription, strRevision); //New row DataRow dr = dstMappingData.Tables[0].NewRow(); UtilsBO boUtils = new UtilsBO(); //fill row dr[TEMP_QTY_COL_NAME] = dcmOrderQty; dr[PO_PurchaseOrderDetailTable.ORDERQUANTITY_FLD] = dcmOrderQty; dr[PO_PurchaseOrderDetailTable.PRODUCTID_FLD] = voProduct.ProductID; dr[ITM_ProductTable.CODE_FLD] = voProduct.Code; dr[ITM_ProductTable.DESCRIPTION_FLD] = voProduct.Description; dr[ITM_ProductTable.REVISION_FLD] = voProduct.Revision; dr[PO_PurchaseOrderDetailTable.BUYINGUMID_FLD] = voProduct.BuyingUMID; dr[PO_PurchaseOrderDetailTable.UNITPRICE_FLD] = voProduct.ListPrice; dr[PO_PurchaseOrderDetailTable.TOTALAMOUNT_FLD] = voProduct.ListPrice * dcmOrderQty; dr[PO_PurchaseOrderDetailTable.UMRATE_FLD] = boUtils.GetUMRate(voProduct.StockUMID, voProduct.BuyingUMID); dr[PO_PurchaseOrderDetailTable.LINE_FLD] = ++intMaxLine; dr[PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD] = ++intMaxID; dr[PO_PurchaseOrderDetailTable.STOCKUMID_FLD] = voProduct.StockUMID; dr[TEMP_QTY_COL_NAME] = dcmOrderQty; dstMappingData.Tables[0].Rows.Add(dr); } if (intResult != 0) { dstMappingData.Tables[0].Columns.Remove(objCol); return(intResult); } //refine data, with correct line int intLine = 1; for (int i = 0; i < dstMappingData.Tables[0].Rows.Count; i++) { if (int.Parse(dstMappingData.Tables[0].Rows[i][TEMP_QTY_COL_NAME].ToString()) == 0) { dstMappingData.Tables[0].Rows[i][PO_PurchaseOrderDetailTable.LINE_FLD] = -1; } else { //Update Line dstMappingData.Tables[0].Rows[i][PO_PurchaseOrderDetailTable.LINE_FLD] = intLine; //Update quantity dstMappingData.Tables[0].Rows[i][PO_PurchaseOrderDetailTable.ORDERQUANTITY_FLD] = dstMappingData.Tables[0].Rows[i][TEMP_QTY_COL_NAME]; intLine++; } } dstMappingData.Tables[0].Columns.Remove(objCol); return(intResult); }
public int ImportNewMappingData(DataTable dtImpData, int intPartyID, int intCCNID, int intMaxLine, DataSet dstMappingData) { int intResult = 0; int intMaxID = 0; dstMappingData.Tables[0].DefaultView.Sort = PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD; try { intMaxID = int.Parse(dstMappingData.Tables[0].Rows[dstMappingData.Tables[0].Rows.Count - 1][PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD].ToString()); } catch { intMaxID = 0; } dstMappingData.Tables[0].DefaultView.Sort = string.Empty; ITM_ProductDS dsProduct = new ITM_ProductDS(); for (int i = INT_BEGIN_DATA_ROW; i < dtImpData.Rows.Count; i++) { string strItemCode = dtImpData.Rows[i][INDEX_CODE].ToString(); string strDescription = dtImpData.Rows[i][INDEX_NAME].ToString(); string strRevision = dtImpData.Rows[i][INDEX_REVISION].ToString(); //find out total quantity at last column decimal dcmOrderQty = decimal.Parse(dtImpData.Rows[i][dtImpData.Columns.Count - 1].ToString()); //check if this item existed, update quantity only DataRow[] arrRows = dstMappingData.Tables[0].Select(ITM_ProductTable.CODE_FLD + "='" + strItemCode + "'"); if (arrRows.Length > 0) { arrRows[0][PO_PurchaseOrderDetailTable.ORDERQUANTITY_FLD] = decimal.Parse(arrRows[0][PO_PurchaseOrderDetailTable.ORDERQUANTITY_FLD].ToString()) + dcmOrderQty; continue; } if (dcmOrderQty <= 0) { continue; } ITM_ProductVO voProduct = (ITM_ProductVO)dsProduct.GetObjectVO(strItemCode, strDescription, strRevision); //New row DataRow dr = dstMappingData.Tables[0].NewRow(); UtilsBO boUtils = new UtilsBO(); //fill row dr[PO_PurchaseOrderDetailTable.ORDERQUANTITY_FLD] = dcmOrderQty; dr[PO_PurchaseOrderDetailTable.PRODUCTID_FLD] = voProduct.ProductID; dr[ITM_ProductTable.CODE_FLD] = voProduct.Code; dr[ITM_ProductTable.DESCRIPTION_FLD] = voProduct.Description; dr[ITM_ProductTable.REVISION_FLD] = voProduct.Revision; dr[PO_PurchaseOrderDetailTable.BUYINGUMID_FLD] = voProduct.BuyingUMID; dr[PO_PurchaseOrderDetailTable.UNITPRICE_FLD] = voProduct.ListPrice; dr[PO_PurchaseOrderDetailTable.TOTALAMOUNT_FLD] = voProduct.ListPrice * dcmOrderQty; dr[PO_PurchaseOrderDetailTable.UMRATE_FLD] = boUtils.GetUMRate(voProduct.StockUMID, voProduct.BuyingUMID); dr[PO_PurchaseOrderDetailTable.LINE_FLD] = ++intMaxLine; dr[PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD] = ++intMaxID; dr[PO_PurchaseOrderDetailTable.STOCKUMID_FLD] = voProduct.StockUMID; dstMappingData.Tables[0].Rows.Add(dr); } return(intResult); }
public object GetProductVO(int pintID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.GetObjectVO(pintID)); }
public string GetACAdjustCodeByID(int pintID) { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.GetACAdjustCodeByID(pintID)); }
/// <summary> /// Update LTVariableTime property of product after updating routing info and return LTVariableTime value /// </summary> /// <param name="piProductID"></param> /// <returns>LTVariableTime value</returns> /// <author> Tuan TQ, 09 Jan, 2006. Apply proposal number: 3339</author> public decimal UpdateLTVariableTimeAndReturn(int piProductID) { ITM_ProductDS objITM_ProductDS = new ITM_ProductDS(); return(objITM_ProductDS.UpdateLTVariableTimeAndReturn(piProductID)); }
//************************************************************************** /// <Description> /// Get list of cost method /// </Description> /// <Inputs> /// /// </Inputs> /// <Outputs> /// /// </Outputs> /// <Returns> /// /// </Returns> /// <Authors> /// THIENHD /// </Authors> /// <History> /// 15-Dec-2004 /// </History> /// <Notes> /// </Notes> //************************************************************************** #region HACK: Tuan TQ - 04 Apr, 2006 /* * Del by Tuan TQ * * public DataTable GetCostMethod() * { * // TODO: Add ProductItemInfoBO.GetCostMethod implementation * const string ID_FIELD = "ID"; * const string VALUE_FIELD = "VALUE"; * * try * { * DataTable dtCostMethod = new DataTable(); * dtCostMethod.Columns.Add(ID_FIELD); * dtCostMethod.Columns.Add(VALUE_FIELD); * DataRow drNewRow = dtCostMethod.NewRow(); * drNewRow[ID_FIELD] = ""; * drNewRow[VALUE_FIELD] =""; * dtCostMethod.Rows.Add(drNewRow); * * drNewRow = dtCostMethod.NewRow(); * drNewRow[ID_FIELD] = "0"; * drNewRow[VALUE_FIELD] ="ACT"; * dtCostMethod.Rows.Add(drNewRow); * * drNewRow = dtCostMethod.NewRow(); * drNewRow[ID_FIELD] = "1"; * drNewRow[VALUE_FIELD] ="STD"; * dtCostMethod.Rows.Add(drNewRow); * * drNewRow = dtCostMethod.NewRow(); * * drNewRow[ID_FIELD] = "2"; * drNewRow[VALUE_FIELD] ="AVG"; * dtCostMethod.Rows.Add(drNewRow); * * return dtCostMethod; * } * catch (PCSDBException ex) * { * throw ex; * } * catch (Exception ex) * { * throw ex; * } * } */ /// <summary> /// Get Cost method from database /// </summary> /// <returns></returns> /// <Author> Tuan TQ, 04 Apr, 2006</Author> public DataTable GetCostMethod() { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.GetCostMethod()); }
public DataRow GetItemInfo(int pintProductID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.GetItemInfo(pintProductID)); }
public string GetCategoryCodeByProductID(int pintProductID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.GetCategoryCodeByProductID(pintProductID)); }
/// <summary> /// List all Items of CCN /// </summary> /// <param name="pintCCNID">CCN</param> /// <returns>All Item</returns> public DataTable GetAllItems(int pintCCNID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.List(pintCCNID)); }
public bool HasVendorDeliverySchedule(int pintID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.HasVendorDeliverySchedule(pintID)); }
/// <summary> /// Check for unique Stock Taking Code /// </summary> /// <param name="pstrStockTakingCode">Code to check</param> /// <returns>true if unique, false if failure</returns> public bool CheckUniqueStockTakingCode(int pintProductID, string pstrStockTakingCode) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.CheckUniqueStockTakingCode(pintProductID, pstrStockTakingCode)); }
public DataTable ListProduct(int pintCCNID) { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.List(pintCCNID)); }
public DataTable ListOutsideItem() { ITM_ProductDS dsProduct = new ITM_ProductDS(); return(dsProduct.ListOutsideItem()); }