/// <summary> /// Returns all currencies for a given service center including inactive /// </summary> /// <param name="dbMessage">DB Message</param> /// <param name="locationCode">ServiceCenter Code</param> /// <returns></returns> private static List <Currency> GetCurrenciesForPOS(ref string dbMessage, string locationCode) { try { DBParameterList dbParamList = new DBParameterList(); dbParamList.Add(new DBParameter("@inputParam", locationCode, DbType.String)); dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dtManager = new DataTaskManager()) { using (DataTable dt = dtManager.ExecuteDataTable("usp_POSCurrencySearch", dbParamList)) { if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Currency currency = new Currency(); currency.CurrencyCode = dt.Rows[i]["CurrencyCode"].ToString(); currency.ConversionRate = Convert.ToDouble(dt.Rows[i]["ConversionRate"]); currency.CurrencyName = dt.Rows[i]["CurrencyName"].ToString(); currency.IsBaseCurrency = Convert.ToBoolean(dt.Rows[i]["IsBaseCurrency"]); s_currencyList.Add(currency); } } } // update database message dbMessage = dbParamList[Common.PARAM_OUTPUT].Value.ToString(); } return(s_currencyList); } catch (Exception ex) { throw ex; } }
public virtual DataTable GetSelectedRecords(DBParameterList dbParam, string spName, ref string errorMessage) { try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(spName, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMessage != string.Empty) { return(null); } else { return(dt); } } catch (Exception ex) { throw ex; } }
public DataTable GetLocationCodes(int promoCategory, int conditionOn, DateTime startDate, DateTime endDate, ref string errorMessage) { DataTable dtLocationCodes = null; DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, promoCategory, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, conditionOn, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_DATA3, startDate, DbType.DateTime)); dbParam.Add(new DBParameter(Common.PARAM_DATA4, endDate, DbType.DateTime)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable("usp_PromotionCondtionCodes", dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (string.IsNullOrEmpty(errorMessage)) { if (dt.Rows.Count > 0) { dtLocationCodes = dt.Copy(); } } } return(dtLocationCodes); }
/// <summary> /// Method to get list of all locations (HO/BO/WH/PC). /// </summary> /// <returns>List of Location(s)</returns> public static List <LocationRole> GetAllLocations() { List <LocationRole> lLocations = new List <LocationRole>(); try { using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); using (DataTable dtLocations = dtManager.ExecuteDataTable(GET_ALL_LOCATIONS, dbParam)) { if (dtLocations != null && dtLocations.Rows.Count > 0) { for (int index = 0; index < dtLocations.Rows.Count; index++) { LocationRole tLocation = new LocationRole(); tLocation.LocationId = Convert.ToInt32(dtLocations.Rows[index]["LocationId"]); tLocation.LocationName = Convert.ToString(dtLocations.Rows[index]["LocationName"]); tLocation.LocationType = Convert.ToString(dtLocations.Rows[index]["LocationType"]); lLocations.Add(tLocation); } } else { throw new Exception(Common.GetMessage("2004")); } } } } catch (Exception ex) { throw ex; } return(lLocations); }
public static bool CheckBatchForLog(string LogNo, int locationId, ref string Message, ref DataTable dtItems) { System.Data.DataTable dTable = new DataTable(); DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@logNo", LogNo, DbType.String)); dbParam.Add(new DBParameter("@locationId", locationId, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dtItems = dtManager.ExecuteDataTable(SP_CI_LOGCHECK, dbParam); Message = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (string.IsNullOrEmpty(Message)) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } }
public bool Save(string xmlDoc, string spName, ref Int32 promotionId, ref string errorMessage) { DBParameterList dbParam; bool isSuccess = false; using (DataTaskManager dtManager = new DataTaskManager()) { dtManager.BeginTransaction(); { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable(spName, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length > 0) { isSuccess = false; dtManager.RollbackTransaction(); } else { isSuccess = true; promotionId = Convert.ToInt32(dt.Rows[0]["PromotionId"]); dtManager.CommitTransaction(); } } } return(isSuccess); }
public string GetPromotionImage(int promotionID, string spName) { string fileName = null; DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); // add the relevant 2 parameters dbParam.Add(new DBParameter("promotionID", promotionID, DbType.Int32)); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(spName, dbParam); if (dt == null || dt.Rows.Count <= 0) { return(null); } fileName = Convert.ToString(dt.Rows[0]["WebImage"]); } catch (Exception ex) { throw ex; } return(fileName); }
public bool ValidatePromotionAgainstExisiting(int promoCategory, int conditionOn, int conditionType, DateTime startDate, DateTime endDate, ref string errorMessage) { bool isValid = true; DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, promoCategory, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, conditionOn, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_DATA3, conditionType, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_DATA4, startDate, DbType.DateTime)); dbParam.Add(new DBParameter(Common.PARAM_DATA5, endDate, DbType.DateTime)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable("usp_PromotionValidator", dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (string.IsNullOrEmpty(errorMessage)) { if (dt.Rows.Count > 0) { isValid = false; } } else { isValid = false; } } return(isValid); }
public bool Save(ref string dbMessage) { try { bool isSuccess = false; using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam; dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(this), DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable(SP_LOG_SAVE, dbParam); dbMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (dt != null && string.IsNullOrEmpty(dbMessage)) { isSuccess = true; this.LogNo = dt.Rows[0]["LogNo"].ToString(); } } return(isSuccess); } catch (Exception ex) { throw ex; } }
public static TaxGroup GetApplicableTaxes(int itemId, string itemCode, int fromStateId, int toStateId, string taxTypeCode, string Date, bool IsFormCApplicable, ref string errorMessage, ref string validationMessage, string sVendorCode, string sLocationCode) { DBParameterList dbParam = null; try { TaxGroup returnTaxGroup = null; dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@itemId", itemId, DbType.Int16)); dbParam.Add(new DBParameter("@itemCode", itemCode, DbType.String)); dbParam.Add(new DBParameter("@fromStateID", fromStateId, DbType.Int16)); dbParam.Add(new DBParameter("@tostateID", toStateId, DbType.Int16)); dbParam.Add(new DBParameter("@TaxTypeCode", taxTypeCode, DbType.String)); dbParam.Add(new DBParameter("@Date", Date, DbType.String)); dbParam.Add(new DBParameter("@IsFormC", IsFormCApplicable, DbType.Boolean)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dbParam.Add(new DBParameter("@validationMessage", string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dbParam.Add(new DBParameter("@vendorCode", sVendorCode, DbType.Int32)); dbParam.Add(new DBParameter("@locationCode", sLocationCode, DbType.Int32)); DataTaskManager dtManager = new DataTaskManager(); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(sp_GetTaxGroup, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); //If no error then process data validationMessage = dbParam["@validationMessage"].Value.ToString(); if (!string.IsNullOrEmpty(validationMessage)) { return(null); } if (string.IsNullOrEmpty(errorMessage) && dt != null) { int rowCount = dt.Rows.Count; for (int i = 0; i < rowCount; i++) { if (i == 0) { returnTaxGroup = new TaxGroup(); returnTaxGroup.TaxGroupId = Convert.ToInt32(dt.Rows[i]["TaxGroupId"]); returnTaxGroup.TaxGroupCode = dt.Rows[i]["TaxGroupCode"].ToString(); returnTaxGroup.TaxCodeList = new List <TaxDetail>(); } TaxDetail taxCode = new TaxDetail(); taxCode.TaxCode = dt.Rows[i]["TaxCode"].ToString(); taxCode.TaxCodeId = Convert.ToInt32(dt.Rows[i]["TaxCodeId"]); taxCode.TaxPercent = Convert.ToDecimal(dt.Rows[i]["TaxPercent"]); taxCode.GroupOrder = Convert.ToInt32(dt.Rows[i]["GroupOrder"]); taxCode.IsInclusive = Convert.ToBoolean(dt.Rows[i]["IsInclusive"]); returnTaxGroup.TaxCodeList.Add(taxCode); } } return(returnTaxGroup);; } catch { throw; } }
public bool Save(ref string errorMessage) { DataTaskManager dtManager = null; try { DBParameterList dbParam; bool isSuccess = false; using (dtManager = new DataTaskManager()) { try { dtManager.BeginTransaction(); { string xmlDoc = Common.ToXml(this); dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable(SP_CI_SAVE, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); { if (errorMessage.Length > 0) { isSuccess = false; dtManager.RollbackTransaction(); } else { isSuccess = true; dtManager.CommitTransaction(); this.InvoiceNo = Convert.ToString(dt.Rows[0]["InvoiceNo"]); } } } } catch (Exception ex) { if (dtManager != null) { dtManager.RollbackTransaction(); } throw ex; } } return(isSuccess); } catch (Exception ex) { throw ex; } }
public virtual bool RetVendorSave(string xmlDoc, string spName, ref string errorMessage) { bool isSuccess = false; try { DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { try { // initialize the parameter list object dbParam = new DBParameterList(); // add the relevant 2 parameters dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // begin the transaction dtManager.BeginTransaction(); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(spName, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMessage != string.Empty) { isSuccess = false; dtManager.RollbackTransaction(); } else { this.ReturnNo = dt.Rows[0]["ReturnNo"].ToString(); this.ModifiedDate = (dt.Rows[0]["ModifiedDate"]).ToString(); this.DebitNoteNo = dt.Rows[0]["DebitNoteNumber"].ToString(); this.ShippingDate = dt.Rows[0]["ShippingDate"].ToString(); dtManager.CommitTransaction(); isSuccess = true; } } catch (Exception ex) { Common.LogException(ex); dtManager.RollbackTransaction(); } } } catch (Exception ex) { Common.LogException(ex); } return(isSuccess); }
/// <summary> /// Returns the Price Object after applying Line Promotion /// </summary> /// <param name="itemCode"></param> /// <param name="itemId"></param> /// <param name="purchaseQty"></param> /// <param name="locationCode"></param> /// <returns></returns> public static Price GetPrice(string itemCode, int itemId, decimal purchaseQty, string locationCode, bool isFirstOrder) { try { int paramFirstOrder = isFirstOrder ? 2 : 1; Price newPrice = null; DBParameterList dbParamList = new DBParameterList(); dbParamList.Add(new DBParameter("@iType", 1, DbType.Int32)); dbParamList.Add(new DBParameter("@vItemCode", itemCode, DbType.String)); dbParamList.Add(new DBParameter("@iItemId", itemId, DbType.Int32)); dbParamList.Add(new DBParameter("@vLocationcode", locationCode, DbType.String)); dbParamList.Add(new DBParameter("@iPurchaseQty", purchaseQty, DbType.Decimal)); dbParamList.Add(new DBParameter("@vCustomerOrder", string.Empty, DbType.String)); dbParamList.Add(new DBParameter("@fromStateID", -1, DbType.Int32)); dbParamList.Add(new DBParameter("@toStateID", -1, DbType.Int32)); dbParamList.Add(new DBParameter("@TaxTypeCode", Common.TaxType.SOTAX.ToString(), DbType.String)); dbParamList.Add(new DBParameter("@Date", null, DbType.DateTime)); dbParamList.Add(new DBParameter("@IsFormC", 0, DbType.Boolean)); dbParamList.Add(new DBParameter("@IsFirstOrder", paramFirstOrder, DbType.Int32)); dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dbParamList.Add(new DBParameter("@validationMessage", string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dtManager = new DataTaskManager()) { DataTable dt = dtManager.ExecuteDataTable(SP_PROMO_ENGINE, dbParamList); if (dt != null && dt.Rows.Count > 0) { newPrice = new Price(Convert.ToInt32(dt.Rows[0]["PromotionId"]) , Convert.ToInt32(dt.Rows[0]["ItemId"]) , dt.Rows[0]["ItemCode"].ToString() , dt.Rows[0]["ItemName"].ToString() , dt.Rows[0]["ShortName"].ToString() , dt.Rows[0]["PrintName"].ToString() , dt.Rows[0]["ReceiptName"].ToString() , dt.Rows[0]["DisplayName"].ToString() , Convert.ToDecimal(dt.Rows[0]["MRP"]) , Convert.ToDecimal(dt.Rows[0]["DistributorPrice"]) , Convert.ToDecimal(dt.Rows[0]["DiscountP"]) , Convert.ToDecimal(dt.Rows[0]["DiscountValue"]) , Convert.ToDecimal(dt.Rows[0]["DiscountedPrice"]) , Convert.ToDecimal(dt.Rows[0]["BusinessVolume"]) , Convert.ToDecimal(dt.Rows[0]["PointValue"]) , purchaseQty ); } } return(newPrice); } catch (Exception ex) { throw ex; } }
public CODetail GetCODetail(string OrderNo, string ItemCode, int itemID, ref string errorMessage) { try { CODetail order = null; if (!OrderNo.Equals(string.Empty) && (!ItemCode.Equals(string.Empty) || itemID > 0)) { System.Data.DataTable dTable = new DataTable(); DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@OrderNo", OrderNo, DbType.String)); dbParam.Add(new DBParameter("@ItemCode", ItemCode, DbType.String)); dbParam.Add(new DBParameter("@ItemID", itemID, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // executing procedure to save the record dTable = dtManager.ExecuteDataTable(SP_CODETAIL_SEARCH, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMessage != string.Empty) { return(null); } else if (dTable != null && dTable.Rows.Count == 1) { order = new CODetail(); order.CreateCODetailObject(dTable.Rows[0]); } } catch (Exception ex) { throw ex; } } return(order); } catch (Exception ex) { throw ex; } }
public decimal GetInventoryAdjItemQty(int locationId, string itemCode, int bucketId, string batchNo, int status, ref string errorMsg) { DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); // add the relevant 2 parameters dbParam.Add(new DBParameter("locationId", locationId, DbType.Int32)); dbParam.Add(new DBParameter("itemCode", itemCode, DbType.String)); dbParam.Add(new DBParameter("bucketId", bucketId, DbType.Int32)); dbParam.Add(new DBParameter("batchNo", batchNo, DbType.String)); dbParam.Add(new DBParameter("status", status, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(SP_INVENTORYADJITEMQTY, dbParam); // update database message errorMsg = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMsg != string.Empty) { return(0); } else { if (dt != null && dt.Rows.Count > 0) { return(Convert.ToDecimal(dt.Rows[0]["Quantity"])); } else { return(0); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to fetch Parameter Data /// </summary> /// <param name="key">Parameter Identifier</param> /// <param name="filter">Parameter Filter Criteria</param> /// <returns></returns> /// //public static public static DataTable TaxLookup(TaxEnum key) { DBParameterList dbParam = null; try { dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@TaxParameter", (int)key, DbType.Int16)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dtManager = new DataTaskManager()) { return(dtManager.ExecuteDataTable(SP_TAX_SEARCH, dbParam)); } } catch { throw; } }
public static List <POSPayments> Search(ref string dbMessage) { try { DBParameterList dbParamList = new DBParameterList(); List <POSPayments> paymentList = new List <POSPayments>(); int Mode = 1; if (Common.IsMiniBranchLocation == 1) { Mode = 2; } else { Mode = 1; } //dbParamList.Add(new DBParameter("@businessLineId", Common.BusinessLine, DbType.String)); dbParamList.Add(new DBParameter(Common.PARAM_MODE, Mode, DbType.Int32)); dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dtManager = new DataTaskManager()) { DataTable dt = dtManager.ExecuteDataTable(SP_PAYMENT_TYPES_SEARCH, dbParamList); if (dt != null) { DataRow[] firstLevelRows = dt.Select("Level = 1"); foreach (DataRow dr in firstLevelRows) { //POSTypes serviceType = new POSTypes(dr["Id"].ToString(), dr["ShortDescription"].ToString(), dr["CustomerTypeId"].ToString(), dr["ReceiptDisplay"].ToString(), dr["ParentType"].ToString(), Convert.ToUInt16(dr["Level"]), Convert.ToDecimal(dr["Price"])); POSPayments payment = CreatePayment(dr); DataRow[] childRows = dt.Select("ParentType = '" + payment.PaymentModeId + "'"); if (childRows.Length > 0) { AddPaymentHierarchy(childRows, payment, dt); } paymentList.Add(payment); } } } return(paymentList); } catch (Exception ex) { throw ex; } }
private DataTable fncItemTaxExtension(int ItemID) { DataTable dtItemTaxExtension = new DataTable(); DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@ItemID", ItemID, DbType.Int32)); dtItemTaxExtension = dtManager.ExecuteDataTable("usp_GetItemTaxExtension", dbParam); } catch (Exception ex) { throw ex; } return(dtItemTaxExtension); }
public bool Save(ref string errorMessage, bool amend) { try { DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { try { dtManager.BeginTransaction(); string xmlDoc = Common.ToXml(this); dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String)); dbParam.Add(new DBParameter("@amend", amend, DbType.Boolean)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable(SP_PO_SAVE, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length > 0) { dtManager.RollbackTransaction(); return(false); } else { this.PONumber = Convert.ToString(dt.Rows[0]["PoNo"]); dtManager.CommitTransaction(); return(true); } } catch (Exception ex) { dtManager.RollbackTransaction(); throw ex; } } } catch (Exception ex) { throw ex; } }
public DataTable SearchForPOandTO(int indentConsolidationId, ref string errorMessage) { string USP_INDENT_SEARCH = "usp_IndentConsolidationSearch"; DBParameterList dbParam; DataTable dt = null; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, string.Empty, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, indentConsolidationId, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dt = dtManager.ExecuteDataTable(USP_INDENT_SEARCH, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); } return(dt); }
public List <COLog> Search(int Status, int BOID, string LogNo, int LogType, int DistributorID, int PCID) { string errorMessage = string.Empty; List <COLog> LogList = new List <COLog>(); System.Data.DataTable dTable = new DataTable(); DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@Status", Status, DbType.Int32)); dbParam.Add(new DBParameter("@BOID", BOID, DbType.Int32)); dbParam.Add(new DBParameter("@LogNo", LogNo, DbType.String)); dbParam.Add(new DBParameter("@LogType", LogType, DbType.Int32)); dbParam.Add(new DBParameter("@DistributorID", DistributorID, DbType.Int32)); dbParam.Add(new DBParameter("@PCID", PCID, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // executing procedure to save the record dTable = dtManager.ExecuteDataTable(SP_LOG_SEARCH, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (dTable != null && dTable.Rows.Count > 0) { foreach (System.Data.DataRow drow in dTable.Rows) { COLog log = CreateLOGObject(drow); LogList.Add(log); } } return(LogList); } catch (Exception ex) { throw ex; } }
//public bool Save(IIndentConsolidation objIndentConsolidation, int intConsolidationStatus, ref int intConsolidationId, ref string poNumbers, ref string toiNumbers, ref string errorMessage) public bool Save(IIndentConsolidation objIndentConsolidation, int intConsolidationStatus, ref int intConsolidationId, ref string errorMessage) { string USP_INDENT_SAVE = "usp_IndentConsolidationSave"; DBParameterList dbParam; bool isSuccess = false; using (DataTaskManager dtManager = new DataTaskManager()) { //dtManager.BeginTransaction(); { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(objIndentConsolidation), DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable(USP_INDENT_SAVE, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length > 0) { isSuccess = false; //dtManager.RollbackTransaction(); } else { if (dt == null) { isSuccess = false; // dtManager.RollbackTransaction(); } else { isSuccess = true; intConsolidationId = Convert.ToInt32(Validators.CheckForDBNull(dt.Rows[0]["ConsolidationId"], Common.INT_DBNULL)); //poNumbers = dt.Rows[0]["PONumbers"].ToString(); //toiNumbers = dt.Rows[0]["TOINumbers"].ToString(); //dtManager.CommitTransaction(); } } } } return(isSuccess); }
public static DataTable FindApplicableTaxes(Int32 taxCategoryId, Int32 taxTypeId, Int32 goodsDirectionId, Int32 taxJurisdictionId, string errorMessage) { DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); // add the relevant 4 parameters dbParam.Add(new DBParameter("TaxCategoryId", taxCategoryId, DbType.Int32)); dbParam.Add(new DBParameter("TaxTypeId", taxTypeId, DbType.Int32)); dbParam.Add(new DBParameter("GoodsDirectionId", goodsDirectionId, DbType.Int32)); dbParam.Add(new DBParameter("TaxJurisdictionId", taxJurisdictionId, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(SP_TAX_APPLICABLE, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMessage != string.Empty) { return(null); } else { return(dt); } } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="lstItemWarehouseRequest"></param> /// <param name="dtItemsDetails"></param> /// <param name="errorMessage"></param> /// <returns></returns> public DataTable GetItemVendorWarehouseInfo(List <Item> lstItemWarehouseRequest, ref String errorMessage) { string SP_NAME = "usp_GetItemVendorWarehouseInfo"; DataTable dtTemp = new DataTable(); //Get Items and Warehouse items detail using (DataTaskManager dtManager = new DataTaskManager()) { //Declare and initialize the parameter list object. DBParameterList dbParam = new DBParameterList(); //Add the relevant 2 parameters dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(lstItemWarehouseRequest), DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dtTemp = dtManager.ExecuteDataTable(SP_NAME, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); } return(dtTemp); }
public List <IndentConsolidation> Search(IIndentConsolidation objIndentConsolidationReq, string PONumber, string TOINumber, ref string errorMessage) { string USP_INDENT_SEARCH = "usp_IndentConsolidationSearch"; List <IndentConsolidation> lstIndentConsolidation = new List <IndentConsolidation>(); DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(objIndentConsolidationReq), DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, Common.INT_DBNULL, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dbParam.Add(new DBParameter("@PONumber", PONumber, DbType.String)); dbParam.Add(new DBParameter("@TOINumber", TOINumber, DbType.String)); DataTable dt = dtManager.ExecuteDataTable(USP_INDENT_SEARCH, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IndentConsolidation indentConsolidation = new IndentConsolidation(); // indentConsolidation.IndentNo = dt.Rows[i]["IndentNo"].ToString(); indentConsolidation.ConsolidationId = Convert.ToInt32(dt.Rows[i]["ConsolidationId"]); indentConsolidation.Status = Convert.ToInt32(dt.Rows[i]["StatusVal"]); indentConsolidation.StatusCap = Convert.ToString(dt.Rows[i]["StatusCap"]); indentConsolidation.Source = Convert.ToInt32(dt.Rows[i]["SourceVal"]); indentConsolidation.SourceCap = Convert.ToString(dt.Rows[i]["SourceCap"]); indentConsolidation.CreatedDate = Convert.ToDateTime(dt.Rows[i]["CreatedDate"]).ToString(Common.DATE_TIME_FORMAT); indentConsolidation.ModifiedDate = Convert.ToDateTime(dt.Rows[i]["ModifiedDate"]).ToString(Common.DATE_TIME_FORMAT); lstIndentConsolidation.Add(indentConsolidation); } } } return(lstIndentConsolidation); }
/// <summary> /// GET Stock Details of Item and Assigns to Object of Indent Detail /// </summary> /// <param name="ItemCode"></param> /// <param name="ItemID"></param> /// <param name="LocationID"></param> public void GetItemStockDetail(string ItemCode, int ItemID, int LocationID) { try { string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@ItemCode", ItemCode, DbType.String)); dbParam.Add(new DBParameter("@ItemId", ItemID, DbType.Int32)); dbParam.Add(new DBParameter("@LocationId", LocationID, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { System.Data.DataTable dTable = new DataTable(); dTable = dt.ExecuteDataTable(SP_ITEMLOCATION_STOCKDETAIL, dbParam); if (dbMessage == string.Empty) { if (dTable != null && dTable.Rows.Count > 0) { this.ItemCode = Convert.ToString(dTable.Rows[0]["ItemCode"]); this.ItemID = Convert.ToInt32(dTable.Rows[0]["ItemId"]); this.ItemName = Convert.ToString(dTable.Rows[0]["ItemName"]); this.StockInHand = Convert.ToDouble(dTable.Rows[0]["StockInHand"]); this.StockInTransit = Convert.ToDouble(dTable.Rows[0]["StockInTransit"]); this.AvgSale = Convert.ToDouble(dTable.Rows[0]["AvgSale"]); this.AvgStockTransfer = Convert.ToDouble(dTable.Rows[0]["AvgStockTransfer"]); this.TotalStock = this.StockInHand + this.StockInTransit; this.TotalSaleStockTransfer = this.AvgSale + this.AvgStockTransfer; // this.TOFromLocationID = Convert.ToDouble(dTable.Rows[0][""]); } } } } catch (Exception ex) { throw ex; } }
public decimal FetchMinimumDistributorPrice(int itemType, int id, ref string errorMessage) { decimal minDistributorPrice = Common.INT_DBNULL; DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, itemType, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, id, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); DataTable dt = dtManager.ExecuteDataTable("usp_getMinDistributorPrice", dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (!string.IsNullOrEmpty(errorMessage)) { minDistributorPrice = Convert.ToDecimal(dt.Rows[0][0].ToString()); } } return(minDistributorPrice); }
public List <CIBatchDetail> GetBatchDetail(string BatchNo, int ItemID, int LocationID, ref string errorMessage) { List <CIBatchDetail> BatchList = new List <CIBatchDetail>(); System.Data.DataTable dTable = new DataTable(); try { string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@BatchNo", BatchNo, DbType.String)); dbParam.Add(new DBParameter("@ItemID", ItemID, DbType.String)); dbParam.Add(new DBParameter("@LocationId", LocationID, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { dTable = dt.ExecuteDataTable(SP_BATCH_DETAIL, dbParam); if (dbMessage == string.Empty) { if (dTable != null && dTable.Rows.Count > 0) { foreach (System.Data.DataRow drow in dTable.Rows) { CIBatchDetail batch = new CIBatchDetail(); batch.CreateBatchObject(drow); BatchList.Add(batch); } } } } return(BatchList); } catch (Exception ex) { throw ex; } }
//public Role RoleSearch() //{ // Role tRole = new Role(); // //List<Role> lRole = new List<Role>(); // List<Module> lModule = new List<Module>(); // try // { // using (DataTaskManager dtManager = new DataTaskManager()) // { // DBParameterList dbParam = new DBParameterList(); // using (DataSet dsRoleData = dtManager.ExecuteDataSet(ROLE_SEARCH, dbParam)) // { // if (dsRoleData != null && dsRoleData.Tables.Count == 3) // { // //Retrieve Role header data from dsRoleData.Tables[0] // //Role tRole = new Role(); // tRole.RoleCode = dsRoleData.Tables[0].Rows[0]["RoleCode"].ToString(); // tRole.RoleName = dsRoleData.Tables[0].Rows[0]["RoleName"].ToString(); // tRole.Description = dsRoleData.Tables[0].Rows[0]["Description"].ToString(); // tRole.Status = (int)dsRoleData.Tables[0].Rows[0]["Status"]; // //Retrieve Module(s) and Function(s) associated with the Role. // //dsRoleData.Tables[1] - Module(s) associated with the Role. // //dsRoleData.Tables[2] - Mudule(s)-Function(s) associated with the Role. // //Set relation between parent(modules) and child(functions) table. // dsRoleData.Relations.Add("RoleModuleFunction", // dsRoleData.Tables[1].Columns["ModuleId"], // dsRoleData.Tables[2].Columns["ModuleId"]); // for (int index = 0; index < dsRoleData.Tables[1].Rows.Count; index++) // { // Module tModule = new Module(); // tModule.ModuleId = Convert.ToInt32(dsRoleData.Tables[1].Rows[index]["ModuleId"]); // //Module Functions // DataRow[] drFunctions; // drFunctions = dsRoleData.Tables[1].Rows[index].GetChildRows("RoleModuleFunction"); // if (drFunctions != null) // { // for (int jindex = 0; jindex < drFunctions.Length; jindex++) // { // Function tFunction = new Function(); // tFunction.FunctionId = Convert.ToInt32(drFunctions[jindex]["FunctionId"]); // tModule.Functions.Add(tFunction); // } // } // lModule.Add(tModule); // } // tRole.AssignedModules = lModule; // //lRole.Add(tRole); // } // else // { // throw new Exception(Common.GetMessage("2002")); // } // } // } // } // catch (Exception ex) // { // throw ex; // } // return tRole; //lRole; //} #endregion RoleSearch - Not in use /// <summary> /// Method to get list of all active roles. /// </summary> /// <returns>List of Roles</returns> public static List <Role> GetAllRoles() { List <Role> lRole = new List <Role>(); try { using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); using (DataTable dtRoles = dtManager.ExecuteDataTable(GET_ALL_ROLES, dbParam)) { if (dtRoles != null) { if (dtRoles.Rows.Count > 0) { for (int index = 0; index < dtRoles.Rows.Count; index++) { Role tRole = new Role(); tRole.RoleId = Convert.ToInt32(dtRoles.Rows[index]["RoleId"]); tRole.RoleName = Convert.ToString(dtRoles.Rows[index]["RoleName"]); lRole.Add(tRole); } } } else { throw new Exception(Common.GetMessage("2004")); } } } return(lRole); } catch (Exception ex) { throw ex; } }
private DataTable GetSelectedRecords(string xmlDoc, string spName, ref string errorMessage) { DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); // initialize the parameter list object dbParam = new DBParameterList(); // add the relevant 2 parameters dbParam.Add(new DBParameter("@ChequeNo", this.ChequeNo, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); // executing procedure to save the record DataTable dt = dtManager.ExecuteDataTable(spName, dbParam); // update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); // if an error returned from the database if (errorMessage != string.Empty) { return(null); } else { return(dt); } } catch (Exception ex) { throw ex; } }