public List <RetVendorDetails> GetVendorDetail(string xmlDoc, string spName, ref string errorMessage) { List <RetVendorDetails> listDeatil; try { listDeatil = new List <RetVendorDetails>(); DataTaskManager dt = new DataTaskManager(); using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); 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)); using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam)) { errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError { foreach (DataRow drDeatils in ds.Tables[0].Rows) { RetVendorDetails obj = new RetVendorDetails(); obj.BatchNo = Convert.ToString(drDeatils["BatchNo"]); obj.ItemDescription = Convert.ToString(drDeatils["ItemName"]); obj.ItemCode = Convert.ToString(drDeatils["ItemCode"]); obj.PODate = Convert.ToDateTime(drDeatils["PODate"]).ToString(Common.DATE_TIME_FORMAT); //obj.DisplayPODate = Convert.ToDateTime(drDeatils["PODate"]).ToString(Common.DTP_DATE_FORMAT); obj.ItemId = Convert.ToInt32(drDeatils["ItemId"]); obj.POQty = Convert.ToDouble(drDeatils["POQty"]); obj.ReturnQty = Convert.ToInt32(drDeatils["ReturnQty"]); obj.PONumber = Convert.ToString(drDeatils["PONumber"]); obj.ReturnReason = Convert.ToString(drDeatils["ReturnReason"]); obj.Bucket = Convert.ToString(drDeatils["Bucket"]); obj.BucketId = Convert.ToInt32(drDeatils["BucketId"]); obj.AvailableQty = Convert.ToInt32(drDeatils["AvailableQty"]); obj.POAmount = Convert.ToDouble(drDeatils["POAmount"]); obj.GRNInvoiceNumber = drDeatils["GRNInvoiceNo"].ToString(); obj.GRNReceivedQty = Convert.ToDouble(drDeatils["GRNReceivedQty"]); obj.GRNInvoiceType = Convert.ToInt32(drDeatils["GRNInvoiceType"]); obj.LineTaxAmount = Convert.ToDecimal(drDeatils["LineTaxAmount"]); obj.ManufactureBatchNo = drDeatils["ManufactureBatchNo"].ToString(); listDeatil.Add(obj); } } } } return(listDeatil); } catch (Exception) { throw; } }
/// <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; } }
/// <summary> /// Search Header & Detail and return Dataset /// </summary> /// <param name="xmlDoc"></param> /// <param name="spName"></param> /// <param name="errorMessage"></param> /// <returns></returns> public DataSet Search_Header_Detail_DatSet(string xmlDoc, string spName, ref string errorMessage) { try { DataTaskManager dt = new DataTaskManager(); DataSet ds = new DataSet(); using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); 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)); ds = dtManager.ExecuteDataSet(spName, dbParam); { errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage != string.Empty) { return(null); } } } return(ds); } catch (Exception ex) { Common.LogException(ex); throw ex; } }
public DataTable GetVendorDetailDataTable(string xmlDoc, string spName, ref string errorMessage) { try { DataSet ds = new DataSet(); DataTaskManager dt = new DataTaskManager(); using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); 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)); using (ds = dtManager.ExecuteDataSet(spName, dbParam)) { errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length != 0) //No dbError { return(null); } } } return(ds.Tables[0]); } catch (Exception ex) { Common.LogException(ex); throw; } }
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 static POSItem Search(string itemBarcode, string locationCode, bool isKitOrder, int isFirstOrder, ref string dbMessage) { try { POSItem item = null; DBParameterList dbParamList = new DBParameterList(); List <POSItem> itemList = new List <POSItem>(); dbParamList.Add(new DBParameter("@itemBarcode", itemBarcode, DbType.String)); dbParamList.Add(new DBParameter("@inputParam", locationCode, DbType.String)); dbParamList.Add(new DBParameter("@isKitOrder", isKitOrder, DbType.Boolean)); dbParamList.Add(new DBParameter("@isFirstOrder", isFirstOrder, DbType.Int32)); dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dtManager = new DataTaskManager()) { DataSet ds = dtManager.ExecuteDataSet(SP_BarcodeItems_Search, dbParamList); if (ds != null) { DataRow[] rows = ds.Tables[0].Select(); item = CreateItem(rows[0]); } } return(item); } catch (Exception ex) { throw ex; } }
public List <GiftVoucherDistributor> Search() { List <GiftVoucherDistributor> VoucherList = new List <GiftVoucherDistributor>(); System.Data.DataTable dTable = new DataTable(); try { string errorMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@VoucherCode", GiftVoucherCode, DbType.String)); dbParam.Add(new DBParameter("@DistributorID", IssueTo, DbType.Int32)); dbParam.Add(new DBParameter("@Availed", Availed, DbType.Int32)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dTable = GetSelectedRecords(dbParam, SP_GIFTVOUCHER_DISTRIBUTOR_SEARCH, ref errorMessage); if (dTable != null) { foreach (System.Data.DataRow drow in dTable.Rows) { GiftVoucherDistributor _voucher = CreateVoucherObject(drow); VoucherList.Add(_voucher); } } } catch (Exception ex) { throw ex; } return(VoucherList); }
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 DataTable IndentDetailSearchDataTable() { System.Data.DataSet dSet = new DataSet(); try { string errorMessage = string.Empty; string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@IndentNo", this.IndentNo, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { dSet = dt.ExecuteDataSet(SP_INDENT_DETAIL_SEARCH, dbParam); if (dSet == null | dSet.Tables[0].Rows.Count <= 0) { return(null); } } } catch (Exception ex) { Common.LogException(ex); } return(dSet.Tables[0]); }
public void getFromLocationStock(int Locationid, int ItemId) { System.Data.DataSet dSet = new DataSet(); try { string errorMessage = string.Empty; string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@Locationid", Locationid, DbType.Int16)); dbParam.Add(new DBParameter("@Itemid", ItemId, DbType.Int16)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { dSet = dt.ExecuteDataSet(SP_ITEMWHLOCATION_STOCKDETAIL, dbParam); if (dSet == null | dSet.Tables[0].Rows.Count <= 0) { return; } this.whLocatinStock = Convert.ToDouble(dSet.Tables[0].Rows[0]["AvailableQuantity"]); } } catch (Exception ex) { Common.LogException(ex); } }
public DataTable GetIndentDetailForItem(int ItemID) { List <Item> lstItemsForConsolidation = new List <Item>(); DBParameterList dbParam; try { Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager(); //Declare and initialize the parameter list object. dbParam = new DBParameterList(); //Add the relevant 2 parameters 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 DataSet ds = dtManager.ExecuteDataSet(SP_APPROVEDITEM_SEARCH, dbParam); //Populate the List Item from the grid if (ds != null && ds.Tables.Count > 0) { return(ds.Tables[0]); } return(null); } catch (Exception ex) { throw ex; } }
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 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 CheckForValidReturnQty(string xmlDoc, ref string errorMessage) { bool isValid = true; System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo(); nfi.PercentDecimalDigits = Common.DisplayAmountRounding; string strRoundingZeroesFormat = Common.GetRoundingZeroes(Common.DisplayQtyRounding); //"0.00"; DataTaskManager dtDataMgr = new DataTaskManager(); using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); 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)); using (DataSet ds = dtDataMgr.ExecuteDataSet(SP_CHECK_RET_QTY, dbParam)) { string tempErrCode = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (!string.IsNullOrEmpty(tempErrCode)) { //errorMessage = Common.GetMessage(tempErr); DataTable dtTemp = ds.Tables[0]; decimal totGRNRecQty = Convert.ToDecimal(dtTemp.Rows[0]["TotalRemainingQty"].ToString()); errorMessage = Common.GetMessage(tempErrCode, totGRNRecQty.ToString(strRoundingZeroesFormat, nfi)); isValid = false; } } } return(isValid); }
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 static AppUser LogInUser(string userName, string password, string locationCode) { try { AppUser loggedInUser = null; string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter(Common.PARAM_DATA, userName, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_DATA2, string.Empty, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_DATA3, string.Empty, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { object returnObject = dt.ExecuteScalar(SP_USER_SEARCH, dbParam); dbMessage = (returnObject == null)? string.Empty:returnObject.ToString(); if (dbMessage != string.Empty) { if ((new CryptographyManager(CryptographyProviderType.SymmetricCryptoProvider)).Decrypt(dbMessage).CompareTo(password) == 0) { loggedInUser = AppUser.Search(userName, locationCode); } } } return(loggedInUser); } 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 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 List <IndentDetail> GetIndentDetail() { try { List <IndentDetail> _indentDetailList = new List <IndentDetail>(); string dbMessage = string.Empty; DBParameterList dbParam = new DBParameterList(); dbParam.Add(new DBParameter("@IndentNo", this.IndentNo, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); using (DataTaskManager dt = new DataTaskManager()) { System.Data.DataSet dSet = new DataSet(); dSet = dt.ExecuteDataSet(SP_GET_INDENT_DETAIL, dbParam); if (dbMessage.Trim().Equals(string.Empty) && dSet != null && dSet.Tables.Count > 0 && dSet.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dSet.Tables[0].Rows) { IndentDetail detail = new IndentDetail(); detail.CreateIndentDetailObject(dr); detail.GetPONO(dSet.Tables[1]); detail.GetTONO(dSet.Tables[2]); _indentDetailList.Add(detail); } } } return(_indentDetailList); } 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; } }
/// <summary> /// Runs the Interface-OUT stored-procedure /// </summary> public void RunInterfaceOut() { DBParameterList dbParam; using (DataTaskManager dtManager = new DataTaskManager()) { dbParam = new DBParameterList(); dtManager.ExecuteNonQuery(CON_USP_INTERFACEOUT, dbParam); } }
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> /// save pack/unpack details /// </summary> /// <param name="xmlDoc"></param> /// <param name="spName"></param> /// <param name="errorMessage"></param> /// <returns></returns> public bool PUSave(string xmlDoc, string spName, ref string errorMessage) { bool isSuccess = false; try { 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, xmlDoc, DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); try { //Begin the transaction and executing procedure to save the record(s) dtManager.BeginTransaction(); // executing procedure to save the record DataSet ds; ds = dtManager.ExecuteDataSet(spName, dbParam); //Update database message errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); //If an error returned from the database if (errorMessage.Length > 0) { dtManager.RollbackTransaction(); isSuccess = false; } else { dtManager.CommitTransaction(); isSuccess = true; } } catch (Exception ex) { dtManager.RollbackTransaction(); throw ex; } } } catch (Exception ex) { throw ex; } return(isSuccess); }
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; } }
/// <summary> /// This method returns list of all modules and their /// associated functions linked in a 'List of Module' business object. /// </summary> /// <returns>List of Module business object</returns> public List <Module> ModulesFunctionsLink() { List <Module> lModule = new List <Module>(); try { using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); using (DataSet dsModFuncLink = dtManager.ExecuteDataSet(GET_APP_MODULE_FUNCTION_LINK, dbParam)) { if (dsModFuncLink != null && dsModFuncLink.Tables.Count == 2) { dsModFuncLink.Relations.Add("ModuleFunction", dsModFuncLink.Tables[0].Columns["ModuleId"], dsModFuncLink.Tables[1].Columns["ModuleId"]); for (int index = 0; index < dsModFuncLink.Tables[0].Rows.Count; index++) { Module tModule = new Module(); tModule.ModuleId = Convert.ToInt32(dsModFuncLink.Tables[0].Rows[index]["ModuleId"]); tModule.Name = Convert.ToString(dsModFuncLink.Tables[0].Rows[index]["ModuleName"]); tModule.Code = Convert.ToString(dsModFuncLink.Tables[0].Rows[index]["ModuleCode"]); //Module Functions DataRow[] drFunctions; drFunctions = dsModFuncLink.Tables[0].Rows[index].GetChildRows("ModuleFunction"); if (drFunctions != null) { for (int jindex = 0; jindex < drFunctions.Length; jindex++) { Function tFunction = new Function(); tFunction.FunctionId = Convert.ToInt32(drFunctions[jindex]["FunctionId"]); tFunction.Name = Convert.ToString(drFunctions[jindex]["FunctionName"]); tFunction.Code = Convert.ToString(drFunctions[jindex]["FunctionCode"]); tModule.Functions.Add(tFunction); } } lModule.Add(tModule); } } else { throw new Exception(Common.GetMessage("2001")); } } } } catch (Exception ex) { throw ex; } return(lModule); }
public List <RetVendorHeader> GetHeaderDetails(string xmlDoc, string spName, ref string errorMessage) { try { List <RetVendorHeader> listRetVendorHeader = new List <RetVendorHeader>(); DataTaskManager dt = new DataTaskManager(); using (DataTaskManager dtManager = new DataTaskManager()) { DBParameterList dbParam = new DBParameterList(); 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)); using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam)) { errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError { foreach (DataRow drRetVendorHeader in ds.Tables[0].Rows) { RetVendorHeader objRetVendorHeader = new RetVendorHeader(); objRetVendorHeader.ReturnNo = Convert.ToString(drRetVendorHeader["ReturnNo"]); objRetVendorHeader.RetVendorDate = Convert.ToDateTime(drRetVendorHeader["RetVendorDate"]).ToString(Common.DATE_TIME_FORMAT); //objRetVendorHeader.DisplayRetVendorDate = Convert.ToDateTime(drRetVendorHeader["RetVendorDate"]).ToString(Common.DTP_DATE_FORMAT); objRetVendorHeader.ModifiedDate = Convert.ToDateTime(drRetVendorHeader["ModifiedDate"]).ToString(Common.DATE_TIME_FORMAT); objRetVendorHeader.LocationId = Convert.ToInt32(drRetVendorHeader["LocationId"]); objRetVendorHeader.VendorId = Convert.ToInt32(drRetVendorHeader["VendorId"]); objRetVendorHeader.Remarks = Convert.ToString(drRetVendorHeader["Remarks"]); objRetVendorHeader.Quantity = Convert.ToInt32(drRetVendorHeader["Quantity"]); objRetVendorHeader.ShippingDetails = Convert.ToString(drRetVendorHeader["ShippingDetails"]); objRetVendorHeader.ShipmentDate = drRetVendorHeader["ShipmentDate"].ToString().Trim() == string.Empty ? string.Empty : Convert.ToDateTime(drRetVendorHeader["ShipmentDate"]).ToString(Common.DATE_TIME_FORMAT); objRetVendorHeader.StatusName = Convert.ToString(drRetVendorHeader["StatusName"]); objRetVendorHeader.StatusId = Convert.ToInt32(drRetVendorHeader["StatusId"]); objRetVendorHeader.DebitNoteNumber = Convert.ToString(drRetVendorHeader["DebitNoteNumber"]); objRetVendorHeader.DebitNoteAmount = Math.Round(Convert.ToDouble(drRetVendorHeader["DebitNoteAmount"]), 2); objRetVendorHeader.TotalAmount = Math.Round(Convert.ToDouble(drRetVendorHeader["TotalAmount"]), 2); objRetVendorHeader.VendorName = Convert.ToString(drRetVendorHeader["VendorName"]); listRetVendorHeader.Add(objRetVendorHeader); } } } } return(listRetVendorHeader); } catch (Exception) { throw; } }
/// <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 void GetQuerySql(Entity query, StringBuilder sql, DBParameterList parms) { var builder = new EntitySpec <Entity>(query).Sql; if (!string.IsNullOrEmpty(builder.Sql)) { sql.Append(" and (" + this.searchBO.resolveTableName(builder.Sql) + ")"); } if (builder.Parameters.ParameterNames.Count() > 0) { parms.AddExpandoParams(builder.Parameters); } }
/// <summary> /// Get indent consolidation Data /// </summary> /// <param name="indentConsolidationRequest"></param> /// <param name="errorMessage"></param> /// <returns></returns> public DataSet GetIndentConsolidationData(IndentConsolidationRequest indentConsolidationRequest, ref String errorMessage) { string SP_NAME = "usp_GetIndentConsolidationData"; DataSet dsTemp = new DataSet(); //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(indentConsolidationRequest), DbType.String)); dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH)); dsTemp = dtManager.ExecuteDataSet(SP_NAME, dbParam); errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString(); if (string.IsNullOrEmpty(errorMessage)) { if (dsTemp.Tables.Count > 0) { if (dsTemp.Tables[0].Rows.Count > 0) { foreach (DataRow drRow in dsTemp.Tables[0].Rows) { if (!string.IsNullOrEmpty(drRow["ApprovedQty"].ToString())) { drRow["ApprovedQty"] = Math.Round(Convert.ToDouble(drRow["ApprovedQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString(); } if (!string.IsNullOrEmpty(drRow["TOIQty"].ToString())) { drRow["TOIQty"] = Math.Round(Convert.ToDouble(drRow["TOIQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString(); } if (!string.IsNullOrEmpty(drRow["POQty"].ToString())) { drRow["POQty"] = Math.Round(Convert.ToDouble(drRow["POQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString(); } if (!string.IsNullOrEmpty(drRow["WarehouseQtySum"].ToString())) { drRow["WarehouseQtySum"] = Math.Round(Convert.ToDouble(drRow["WarehouseQtySum"].ToString()), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero).ToString(); } } } } } } return(dsTemp); }