Esempio n. 1
0
        /// <summary>
        /// Returns ship method id for company/customer combination
        /// </summary>
        /// <param name="compId"></param>
        /// <param name="CustID"></param>
        /// <returns></returns>
        public static string GetShipMethID(string compId, string CustID)
        {
            string ShipMethID = string.Empty;

            SqlHandler sqlHandler = new SqlHandler();

            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@CompID", compId);
            parameters.Add("@CustID", CustID);

            ShipMethID = sqlHandler.SQLWithRetrieveSingle <string>("sparGetCustShipMethID_rkl", System.Data.CommandType.StoredProcedure, parameters);

            return(ShipMethID);
        }
Esempio n. 2
0
        /// <summary>
        /// Get Vendor Key by Vendor ID
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="vendorId"></param>
        /// <returns></returns>
        public static int GetVendorKey(string companyId, string vendorId)
        {
            int               VendKey    = 0;
            SqlHandler        sqlHandler = new SqlHandler();
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@compid", companyId);
            parameters.Add("@vendid", vendorId);

            dynamic returnObj = sqlHandler.SQLWithRetrieveSingle <dynamic>("spapGetVendorInfo_RKL", System.Data.CommandType.StoredProcedure, parameters);

            VendKey = returnObj.VendKey;

            return(VendKey);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets an item description by item ID
        /// </summary>
        /// <param name="companyID"></param>
        /// <param name="itemID"></param>
        /// <returns></returns>
        public static string GetItemDesc(string companyID, string itemID)
        {
            string     returnString = string.Empty;
            SqlHandler sqlHandler   = new SqlHandler();

            DynamicParameters sqlParameters = new DynamicParameters();

            sqlParameters.Add("@CompID", companyID);
            sqlParameters.Add("@ItemID", itemID);

            dynamic returnObj = sqlHandler.SQLWithRetrieveSingle <dynamic>("spimGetItemInfo_RKL", System.Data.CommandType.StoredProcedure, sqlParameters).FirstOrDefault();

            returnString = returnObj.ShortDesc;

            return(returnString);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets an ItemKey by ItemID and Company ID
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="compId"></param>
        /// <returns></returns>
        public static int GetItemKey(string itemId, string compId)
        {
            int ItemKey = 0;

            SqlHandler        sqlHandler = new SqlHandler();
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@ItemID", itemId);
            parameters.Add("@CompID", compId);
            dynamic returnObj = sqlHandler.SQLWithRetrieveSingle <dynamic>("spimGetItemInfo_RKL", System.Data.CommandType.StoredProcedure, parameters);

            if (returnObj != null)
            {
                ItemKey = returnObj.ItemKey;
            }
            return(ItemKey);
        }
Esempio n. 5
0
        /// <summary>
        /// Gets Vendor Address Key by company, vendor, and addr id
        /// </summary>
        /// <param name="companyId"></param>
        /// <param name="vendorId"></param>
        /// <param name="vendorAddrId"></param>
        /// <returns></returns>
        public static int GetVendorAddressKey(string companyId, string vendorId, string vendorAddrId)
        {
            int VendAddrKey = 0;
            DynamicParameters parameters = new DynamicParameters();

            parameters.Add("@compid", companyId);
            parameters.Add("@vendid", vendorId);
            parameters.Add("@VendaddrID", vendorAddrId);
            SqlHandler sqlHandler = new SqlHandler();

            List <dynamic> returnObj = sqlHandler.SQLWithRetrieveSingle <dynamic>("spapGetVendorAddresses_RKL", System.Data.CommandType.StoredProcedure, parameters).ToList();

            if (returnObj.Count > 0)
            {
                VendAddrKey = returnObj[0].AddrKey;
            }
            return(VendAddrKey);
        }
Esempio n. 6
0
        /// <summary>
        /// Gets a Pmt Terms Key by Pmt Terms ID
        /// </summary>
        /// <param name="pmtTermsID"></param>
        /// <param name="companyID"></param>
        /// <returns></returns>
        public static int GetPmtTermsKey(string pmtTermsID, string companyID)
        {
            SqlHandler sqlHandler  = new SqlHandler();
            int        pmtTermsKey = 0;

            try
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@CompID", companyID);
                parameters.Add("@PmtTermsID", pmtTermsID);
                parameters.Add("@PmtTermsKey", 0);

                pmtTermsKey = sqlHandler.SQLWithRetrieveSingle <int>("spciGetPmtTerms_rkl", System.Data.CommandType.StoredProcedure, parameters);
            }
            catch (Exception exception)
            {
                //we will add logging
            }
            return(pmtTermsKey);
        }
Esempio n. 7
0
        /// <summary>
        /// Validates Customer ID
        /// </summary>
        /// <param name="custID"></param>
        /// <param name="companyID"></param>
        /// <returns></returns>
        public static bool IsValidCustID(string custID, string companyID)
        {
            SqlHandler sqlHandler = new SqlHandler();
            bool       isValid    = false;

            try
            {
                DynamicParameters sqlParameters = new DynamicParameters();
                sqlParameters.Add("@CustID", custID);
                sqlParameters.Add("@CompID", companyID);
                sqlParameters.Add("@CustKey", 0);

                isValid = sqlHandler.SQLWithRetrieveSingle <bool>("sparGetCustInfo_RKL", System.Data.CommandType.StoredProcedure, sqlParameters);
            }
            catch (Exception exception)
            {
                //we will add logging
            }
            return(isValid);
        }
Esempio n. 8
0
        /// <summary>
        /// Primary error logging function
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="shortMessage"></param>
        /// <param name="longMessage"></param>
        /// <param name="webPage"></param>
        /// <param name="IWE"></param>
        public static void LogError(string loginName, string shortMessage, string longMessage, string webPage, string IWE)
        {
            if (!longMessage.Contains("ThreadAbortException"))
            {
                SqlHandler sqlHandler = new SqlHandler();
                try
                {
                    DynamicParameters parameters = new DynamicParameters();
                    parameters.Add("@LoginName", loginName);
                    parameters.Add("@ShortMessage", shortMessage.Replace("'", "''"));
                    parameters.Add("@LongMessage", longMessage.Replace("'", "''"));
                    parameters.Add("@WebPage", webPage);
                    parameters.Add("@IWE", IWE);

                    sqlHandler.SQLExecuteWithoutReturn("spciInsertWebLog_rkl", System.Data.CommandType.StoredProcedure, parameters);
                }
                catch (Exception exception)
                {
                    //do nothing because db error
                }
            }
        }