private void btnExecuteAsScalarAsLong_Click(object sender, EventArgs e) { try { lblTitle.Text = "Execute As Scalar to long : GET TOTAL ACTORS (COUNT)"; string functionName = QueryBase.Function_GetActorsCount; long actorsCount = 0; Task.Factory.StartNew(() => { actorsCount = sqlHandler.ExecuteAsScalar <long>(functionName); }).Wait(); ICollection <ReturnData> lstData = new List <ReturnData>(); lstData.Add(new ReturnData() { Data = actorsCount }); dgvResult.DataSource = lstData; } catch (Exception ex) { DisplayError(ex.Message); } }
/// <summary> /// authenticates method for view controls. /// </summary> /// <param name="portalId">portalId</param> /// <param name="userModuleId">userModuleId</param> /// <param name="userName">userName</param> /// <returns>bool </returns> public bool IsPostAuthenticatedView(int portalId, int userModuleId, string userName, string authToken) { string user = GetUsername(portalId, authToken); if (user == "superuser") { return(true); } else if (user != "anonymoususer" && user == userName) { List <KeyValuePair <string, object> > para = new List <KeyValuePair <string, object> >(); para.Add(new KeyValuePair <string, object>("@UserModuleID", userModuleId)); para.Add(new KeyValuePair <string, object>("@PortalID", portalId)); para.Add(new KeyValuePair <string, object>("@userName", userName)); SQLHandler handler = new SQLHandler(); int flag = handler.ExecuteAsScalar <int>("usp_CheckModulePermissionView", para); if (flag == 1) { return(true); } else { return(false); } } return(false); }
private static void SaveDynamicMethods(ShippingProvider provider, int providerId, AspxCommonInfo commonInfo) { foreach (var dynamicMethod in provider.DynamicMethods) { try { List <KeyValuePair <string, object> > paraMeter = new List <KeyValuePair <string, object> >(); paraMeter.Add(new KeyValuePair <string, object>("@ShippingProviderId", providerId)); paraMeter.Add(new KeyValuePair <string, object>("@AssemblyName", provider.AssemblyName)); paraMeter.Add(new KeyValuePair <string, object>("@ClassName", provider.ShippingProviderClass)); paraMeter.Add(new KeyValuePair <string, object>("@NameSpace", provider.ShippingProviderNamespace)); paraMeter.Add(new KeyValuePair <string, object>("@MethodName", dynamicMethod.MethodName)); paraMeter.Add(new KeyValuePair <string, object>("@MethodType", dynamicMethod.MethodType)); paraMeter.Add(new KeyValuePair <string, object>("@ParameterCount", dynamicMethod.DynamicParams.Count())); paraMeter.Add(new KeyValuePair <string, object>("@StoreId", commonInfo.StoreID)); paraMeter.Add(new KeyValuePair <string, object>("@PortalId", commonInfo.PortalID)); paraMeter.Add(new KeyValuePair <string, object>("@UserName", commonInfo.UserName)); SQLHandler sqLh = new SQLHandler(); int dynamicmId = sqLh.ExecuteAsScalar <int>("usp_aspx_AddDynamicMethod", paraMeter); SaveDynamicMethodParams(dynamicMethod.DynamicParams, dynamicmId, commonInfo); } catch (Exception ex) { throw ex; } } }
public string GetFullName(int portalId, string userName) { var paramCol = new List<KeyValuePair<string, object>>(); paramCol.Add(new KeyValuePair<string, object>("@PortalID", portalId)); paramCol.Add(new KeyValuePair<string, object>("@UserName", userName)); var sageSQL = new SQLHandler(); return sageSQL.ExecuteAsScalar<string>("[dbo].[usp_Aspx_GetUserFirstandLastName]", paramCol); }
public static string GetTransactionDetailById(int orderID) { var paraMeter = new List <KeyValuePair <string, object> >(); paraMeter.Add(new KeyValuePair <string, object>("@OrderID", orderID)); var sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <string>("usp_Aspx_GetTransactionDetailById", paraMeter)); }
public string GetUserImageName(string Username) { List <KeyValuePair <string, object> > param = new List <KeyValuePair <string, object> >(); param.Add(new KeyValuePair <string, object>("@Username", Username)); SQLHandler sagesql = new SQLHandler(); return(sagesql.ExecuteAsScalar <string>("[dbo].[usp_GetUserImageName]", param)); }
public static string GetThemeOptions(string templateName) { SQLHandler sagesql = new SQLHandler(); string sp = "usp_Theme_GetThemeOptions"; List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@TemplateName", templateName)); return(sagesql.ExecuteAsScalar <string>(sp, ParaMeterCollection)); }
public static double GetRatefromTable(AspxCommonInfo aspxCommonObj, string currencyCode) { SQLHandler sqlH = new SQLHandler(); List <KeyValuePair <string, object> > Parameter = CommonParmBuilder.GetParamSP(aspxCommonObj); Parameter.Add(new KeyValuePair <string, object>("@CurrencyCode", currencyCode)); decimal rate = sqlH.ExecuteAsScalar <decimal>("[dbo].[usp_Aspx_GetRateFromTable]", Parameter); return(Convert.ToDouble(rate)); }
public static string GetFullName(int portalId, int orderid) { List <KeyValuePair <string, object> > paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("@PortalID", portalId)); paramCol.Add(new KeyValuePair <string, object>("@OrderID", orderid)); SQLHandler sageSQL = new SQLHandler(); return(sageSQL.ExecuteAsScalar <string>("[dbo].[usp_Aspx_GetUserFirstandLastNamebyorder]", paramCol)); }
public string GetFullName(int portalId, string userName) { var paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("@PortalID", portalId)); paramCol.Add(new KeyValuePair <string, object>("@UserName", userName)); var sageSQL = new SQLHandler(); return(sageSQL.ExecuteAsScalar <string>("[dbo].[usp_Aspx_GetUserFirstandLastName]", paramCol)); }
public static string GetCategoryCheckedItems(int CategoryID, AspxCommonInfo aspxCommonObj) { SQLHandler sqlHandler = new SQLHandler(); List <KeyValuePair <string, object> > parameterCollection = CommonParmBuilder.GetParamSP(aspxCommonObj); parameterCollection.Add(new KeyValuePair <string, object>("@CategoryID", CategoryID)); string categoryItem = sqlHandler.ExecuteAsScalar <string>("[dbo].[usp_Aspx_GetItemsByCategoryIDAdmin]", parameterCollection); return(categoryItem); }
private bool IsAuthenticatedToEdit() { //To check the authentication of modulecontrol for current users List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PermissionKey", "EDIT")); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", Int32.Parse(hdnUserModuleID.Value))); ParaMeterCollection.Add(new KeyValuePair<string, object>("@Username", GetUsername)); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", GetPortalID)); SQLHandler sagesql = new SQLHandler(); return sagesql.ExecuteAsScalar<bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection); }
public static string GetStateCode(string cCode, string stateName) { List <KeyValuePair <string, object> > paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("@CountryCode", cCode)); paramCol.Add(new KeyValuePair <string, object>("@StateName", stateName)); SQLHandler sqlHl = new SQLHandler(); string stateCode = sqlHl.ExecuteAsScalar <string>("[dbo].[usp_Aspx_GetStateCodeByName]", paramCol); return(stateCode); }
public static void SaveGiftCardByAdmin(int giftCardId, GiftCard giftCardDetail, bool isActive, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPUC(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("@GiftCardId", giftCardId)); parameter.Add(new KeyValuePair <string, object>("@GiftCardGraphicsId", giftCardDetail.GraphicThemeId)); parameter.Add(new KeyValuePair <string, object>("@IsRecipientNotified", giftCardDetail.IsRecipientNotified)); //add column in table expiry date /add default 1 year after/ paid parameter.Add(new KeyValuePair <string, object>("@ExpireDate", giftCardDetail.ExpireDate)); parameter.Add(new KeyValuePair <string, object>("@Amount", giftCardDetail.Price)); parameter.Add(new KeyValuePair <string, object>("@IsActive", isActive)); parameter.Add(new KeyValuePair <string, object>("@RecipientEmail", giftCardDetail.RecipientEmail)); parameter.Add(new KeyValuePair <string, object>("@RecipientName", giftCardDetail.RecipientName)); parameter.Add(new KeyValuePair <string, object>("@SenderEmail", giftCardDetail.SenderEmail)); parameter.Add(new KeyValuePair <string, object>("@SenderName", giftCardDetail.SenderName)); parameter.Add(new KeyValuePair <string, object>("@Messege", giftCardDetail.Messege)); if (giftCardId > 0) { parameter.Add(new KeyValuePair <string, object>("@GiftCardCode", giftCardDetail.GiftCardCode)); } else { parameter.Add(new KeyValuePair <string, object>("@GiftCardCode", GetGiftCardKey())); } parameter.Add(new KeyValuePair <string, object>("@GiftCardTypeId", giftCardDetail.GiftCardTypeId)); SQLHandler sqlH = new SQLHandler(); int i = sqlH.ExecuteAsScalar <int>("usp_Aspx_SaveGiftCardByAdmin", parameter); var typeId = GetGiftCardType(aspxCommonObj.StoreID, aspxCommonObj.PortalID, i); if (giftCardId == 0) { IssueGiftCard(i, null, aspxCommonObj); if (typeId == 1) //both or virtual { NotifyUser(i, aspxCommonObj); } } else { if ((bool)(!giftCardDetail.IsRecipientNotified)) { NotifyUser(i, aspxCommonObj); } } } catch (Exception e) { throw e; } }
public static bool IsAuthenticatedToEdit(string usermoduleid, string username, int portalid) { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PermissionKey", "EDIT")); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", Int32.Parse(usermoduleid))); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserName", username)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", portalid)); SQLHandler sagesql = new SQLHandler(); return(sagesql.ExecuteAsScalar <bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection)); }
/// <summary> /// Connects to database and obtains user id for given userName. /// </summary> /// <param name="userName">userName</param> /// <returns>UserId</returns> public static int GetUserID(string userName) { string StoredProcedureName = "usp_FileManagerGetUserID"; SQLHandler sagesql = new SQLHandler(); List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserName", userName)); int UserID = 0; UserID = sagesql.ExecuteAsScalar <int>(StoredProcedureName, ParaMeterCollection); return(UserID); }
public decimal GetTotalShippingCost(int shippingMethodID, int storeID, int portalID, string userName, string cultureName) { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@ShippingMethodID", shippingMethodID)); parameter.Add(new KeyValuePair <string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("@UserName", userName)); parameter.Add(new KeyValuePair <string, object>("@CultureName", cultureName)); SQLHandler sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <decimal>("usp_Aspx_ShippingCost", parameter)); }
private bool IsAuthenticatedToEdit() { //To check the authentication of modulecontrol for current users List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PermissionKey", "EDIT")); ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", Int32.Parse(hdnUserModuleID.Value))); ParaMeterCollection.Add(new KeyValuePair <string, object>("@Username", GetUsername)); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", GetPortalID)); SQLHandler sagesql = new SQLHandler(); return(sagesql.ExecuteAsScalar <bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection)); }
public static int CountWishItems(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamNoCID(aspxCommonObj); SQLHandler sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <int>("usp_Aspx_GetWishItemsCount", parameter)); } catch (Exception e) { throw e; } }
public static int CountWishItems(AspxCommonInfo aspxCommonObj) { try { List<KeyValuePair<string, object>> parameter = CommonParmBuilder.GetParamNoCID(aspxCommonObj); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<int>("usp_Aspx_GetWishItemsCount", parameter); } catch (Exception e) { throw e; } }
public static int GetCompareItemsCount(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPUS(aspxCommonObj); SQLHandler sqlH = new SQLHandler(); int compCount = sqlH.ExecuteAsScalar <int>("usp_Aspx_GetCompareItemsCount", parameter); return(compCount); } catch (Exception e) { throw e; } }
public static string GetShoppingBagSetting(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameterCollection = CommonParmBuilder.GetParamSPC(aspxCommonObj); SQLHandler sqlHandle = new SQLHandler(); string bagType = sqlHandle.ExecuteAsScalar <string>("[usp_Aspx_GetShoppingBagSettings]", parameterCollection); return(bagType); } catch (Exception e) { throw e; } }
/// <summary> /// Decodes the given encrpted URL to user friendly URL. /// </summary> /// <param name="key"></param> /// <returns></returns> public string DecodeUrl(string key) { try { List <KeyValuePair <string, object> > ParameterCollection = new List <KeyValuePair <string, object> >(); ParameterCollection.Add(new KeyValuePair <string, object>("@Key", key)); SQLHandler objHandler = new SQLHandler(); return(objHandler.ExecuteAsScalar <string>("[dbo].[USP_SHORTURL_DECODE]", ParameterCollection)); } catch (Exception ex) { throw; } }
public static decimal GetTotalCartItemPrice(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPSCt(aspxCommonObj); SQLHandler sqlH = new SQLHandler(); decimal cartPrice = sqlH.ExecuteAsScalar <decimal>("usp_Aspx_GetCartItemsTotalAmount", parameter); return(cartPrice); } catch (Exception e) { throw e; } }
public static string GetShoppingBagSetting(AspxCommonInfo aspxCommonObj) { try { List<KeyValuePair<string, object>> parameterCollection = CommonParmBuilder.GetParamSPC(aspxCommonObj); SQLHandler sqlHandle = new SQLHandler(); string bagType = sqlHandle.ExecuteAsScalar<string>("[usp_Aspx_GetShoppingBagSettings]", parameterCollection); return bagType; } catch (Exception e) { throw e; } }
/// <summary> /// Decodes the given encrpted URL to user friendly URL. /// </summary> /// <param name="key"></param> /// <returns></returns> public string DecodeUrl(string key) { try { List<KeyValuePair<string, object>> ParameterCollection = new List<KeyValuePair<string, object>>(); ParameterCollection.Add(new KeyValuePair<string, object>("@Key", key)); SQLHandler objHandler = new SQLHandler(); return objHandler.ExecuteAsScalar<string>("[dbo].[USP_SHORTURL_DECODE]", ParameterCollection); } catch { throw; } }
/// <summary> /// Connects to database and returns image path for given ImageId . /// </summary> /// <param name="ImageId">ImageId</param> /// <returns>Image path.</returns> public string GetFileName(int ImageId) { try { List <KeyValuePair <string, object> > Parameter = new List <KeyValuePair <string, object> >(); Parameter.Add(new KeyValuePair <string, object>("@ImageId", ImageId)); SQLHandler sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <string>("usp_SageBannerGetFileName", Parameter)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Initializes a new instance of GetPortalParentURL. /// </summary> /// <param name="PortalID">PortalID</param> /// <returns>Return portal parent URL</returns> public string GetPortalParentURL(int PortalID) { try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID)); SQLHandler sagesql = new SQLHandler(); return(sagesql.ExecuteAsScalar <string>("[dbo].[usp_PortalGetParentURL]", ParaMeterCollection)); } catch (Exception) { throw; } }
private string GetProviderSourceLocation(int shippingMethodId) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@ShippingMethodId", shippingMethodId)); SQLHandler sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <string>("usp_Aspx_GetShippingProviderLocation", parameter)); } catch (Exception ex) { throw ex; } }
public static int GetGiftCardType(AspxCommonInfo aspxCommonObj, int cartitemId) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSP(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("@CartItemId", cartitemId)); SQLHandler sqlH = new SQLHandler(); int strType = sqlH.ExecuteAsScalar <int>("usp_Aspx_GetGiftCardType", parameter); return(strType); } catch (Exception e) { throw e; } }
public static bool CheckGiftCardCategory(AspxCommonInfo aspxCommonObj, string giftcardCategoryName) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPC(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("@GiftCardCategoryName", giftcardCategoryName.Trim())); SQLHandler sqlH = new SQLHandler(); bool isGiftCard = sqlH.ExecuteAsScalar <bool>("usp_Aspx_CheckGiftCardCategory ", parameter); return(isGiftCard); } catch (Exception e) { throw e; } }
public static string GetGiftCardItemCategory(int itemId, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPC(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("@ItemId", itemId)); SQLHandler sqlH = new SQLHandler(); string strValue = sqlH.ExecuteAsScalar <string>("usp_Aspx_GetGiftCardItemCategory", parameter); return(strValue); } catch (Exception e) { throw e; } }
private string GetPaymentGateWaySourceLocation(int paymentGatewayId) { try { var parameter = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("@PaymentGateWayId", paymentGatewayId) }; var sqlH = new SQLHandler(); return(sqlH.ExecuteAsScalar <string>("usp_Aspx_mb_GetPaymentGatewayLocation", parameter)); } catch (Exception ex) { throw ex; } }
public string GetStoreNotAccessPageContent() { try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >(); ParaMeterCollection.Add(new KeyValuePair <string, object>("@StoreID", GetStoreID.ToString())); ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", GetPortalID.ToString())); SQLHandler sagesql = new SQLHandler(); return(sagesql.ExecuteAsScalar <string>("dbo.usp_Aspx_CheckStoreNotAccessPageContent", ParaMeterCollection)); } catch (Exception e) { throw e; } }
public string StoreClosedPageContent() { try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@StoreID", GetStoreID.ToString())); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", GetPortalID.ToString())); SQLHandler sagesql = new SQLHandler(); return sagesql.ExecuteAsScalar<string>("dbo.usp_ASPX_CheckStoreClosedPageContent", ParaMeterCollection); } catch (Exception e) { throw e; } }
public static string GetUserBillingEmail(int addressID, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetFParamNoSCode(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("@AddressID", addressID)); SQLHandler sqlH = new SQLHandler(); string userEmail = sqlH.ExecuteAsScalar <string>("[usp_Aspx_GetUserBillingEmail]", parameter); return(userEmail); } catch (Exception e) { throw e; } }
/// <summary> /// Connects to database and encodes the url. /// </summary> /// <param name="url">User readable URL</param> /// <param name="code">Encrpted url.</param> /// <returns>Encrypted URL.</returns> public string EncodeUrl(string url, string code) { try { List<KeyValuePair<string, object>> ParameterCollection = new List<KeyValuePair<string, object>>(); ParameterCollection.Add(new KeyValuePair<string, object>("@Url", url)); ParameterCollection.Add(new KeyValuePair<string, object>("@Code", code)); SQLHandler objHandler = new SQLHandler(); return objHandler.ExecuteAsScalar<string>("[dbo].[USP_SHORTURL_ENCODE]", ParameterCollection); } catch { //SageFrame.Web.ProcessException(ex); throw; } }
/// <summary> /// Connect to database and obtain module name based on UserModuleID. /// </summary> /// <param name="UserModuleID">UserModuleID</param> /// <returns>Module name.</returns> public static string GetModuleName(int UserModuleID) { SQLHandler Objsql = new SQLHandler(); try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", UserModuleID)); SQLHandler sqlh = new SQLHandler(); string ModuleName = ""; ModuleName = sqlh.ExecuteAsScalar<string>("[dbo].[usp_ModuleControlGetModuleNameFromUserModuleId]", ParaMeterCollection); return ModuleName; } catch (Exception ex) { throw ex; } }
public static string GetCategoryForItem(int storeID, int portalID, string itemSku,string cultureName) { try { List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair<string, object>("@ItemSku", itemSku)); parameter.Add(new KeyValuePair<string, object>("@CultureName", cultureName)); SQLHandler sqlH = new SQLHandler(); string retString= sqlH.ExecuteAsScalar<string>("usp_Aspx_GetCategoryforItems", parameter); return retString; } catch (Exception e) { throw e; } }
private bool CheckIp(System.Net.IPAddress ipAddress, int portalId) { try { var paraMeterCollection = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>("@IPAddress", ipAddress.ToString()), new KeyValuePair<string, object>("@PortalID", portalId) }; var sqlH = new SQLHandler(); var value = sqlH.ExecuteAsScalar<bool>("dbo.usp_sf_CheckIpAccess", paraMeterCollection); return value; } catch (Exception e) { throw e; } }
public static bool CheckGiftCardUsed(AspxCommonInfo aspxCommonObj, string giftCardCode, decimal amount) { try { List<KeyValuePair<string, object>> paramCol = CommonParmBuilder.GetParamSP(aspxCommonObj); paramCol.Add(new KeyValuePair<string, object>("@Amount", amount)); paramCol.Add(new KeyValuePair<string, object>("@GiftCardCode", giftCardCode)); SQLHandler sqlHl = new SQLHandler(); int allowToCheckOut = sqlHl.ExecuteAsScalar<int>("[dbo].[usp_Aspx_CheckGiftCardIsUsed]", paramCol); return allowToCheckOut == 1; } catch (Exception e) { throw e; } }
/// <summary> /// authenticates method for view controls. /// </summary> /// <param name="portalId">portalId</param> /// <param name="userModuleId">userModuleId</param> /// <param name="userName">userName</param> /// <returns>bool </returns> public bool IsPostAuthenticatedView(int portalId, int userModuleId, string userName, string authToken) { string user = GetUsername(portalId, authToken); if (user == "superuser") { return true; } else if (user != "anonymoususer" && user == userName) { List<KeyValuePair<string, object>> para = new List<KeyValuePair<string, object>>(); para.Add(new KeyValuePair<string, object>("@UserModuleID", userModuleId)); para.Add(new KeyValuePair<string, object>("@PortalID", portalId)); para.Add(new KeyValuePair<string, object>("@userName", userName)); SQLHandler handler = new SQLHandler(); int flag = handler.ExecuteAsScalar<int>("usp_CheckModulePermissionView", para); if (flag == 1) return true; else return false; } return false; }
public decimal CheckItemQuantityInCart(int itemID, int storeID, int portalID, int customerID, string sessionCode) { try { List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@ItemID", itemID)); parameter.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair<string, object>("@CustomerID", customerID)); parameter.Add(new KeyValuePair<string, object>("@SessionCode", sessionCode)); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<decimal>("usp_Aspx_CheckCustomerQuantityInCart", parameter); } catch (Exception ex) { throw ex; } }
public static int GetItemID(int iPortalID) { int result = 0; try { List<KeyValuePair<string, object>> parameterCollection = new List<KeyValuePair<string, object>>(); parameterCollection.Add(new KeyValuePair<string, object>("@PortalID", iPortalID)); SQLHandler sqLH = new SQLHandler(); result = sqLH.ExecuteAsScalar<int>("[dbo].[usp_Aspx_CatalogGetTotalItem]", parameterCollection); } catch (Exception e) { throw e; } return result; }
public static int GetMinWeekDay(int ScheduleID) { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@ScheduleId", ScheduleID)); try { SQLHandler sagesql = new SQLHandler(); int value = sagesql.ExecuteAsScalar<int>("usp_ScheduleLowestWeekGetNextWeek", ParaMeterCollection); return value; } catch (Exception) { throw; } }
/// <summary> /// Connects to database and check if the user is authehticate to edit HTML /// </summary> /// <param name="usermoduleid">userModuleID</param> /// <param name="username">username</param> /// <param name="portalid">portalID</param> /// <returns>Returns true if the user is authenticate to edit HTML content</returns> public static bool IsAuthenticatedToEdit(string usermoduleid, string username, int portalid) { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PermissionKey", "EDIT")); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", Int32.Parse(usermoduleid))); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", username)); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", portalid)); SQLHandler sagesql = new SQLHandler(); return sagesql.ExecuteAsScalar<bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection); }
public static int SaveUpdateProviderSetting(ShippingProvider provider, string settingKey, string settingValue, AspxCommonInfo commonInfo) { try { if (!provider.IsUnique) { DeleteShippingProvider(provider.ShippingProviderID, commonInfo); } List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderID", 0)); parameter.Add(new KeyValuePair<string, object>("@StoreID", commonInfo.StoreID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", commonInfo.PortalID)); parameter.Add(new KeyValuePair<string, object>("@CultureName", commonInfo.CultureName)); parameter.Add(new KeyValuePair<string, object>("@UserName", commonInfo.UserName)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderServiceCode", provider.ShippingProviderServiceCode)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderName", provider.ShippingProviderName)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderAliasHelp", provider.ShippingProviderAliasHelp)); parameter.Add(new KeyValuePair<string, object>("@AssemblyName", provider.AssemblyName)); parameter.Add(new KeyValuePair<string, object>("@Namespace", provider.ShippingProviderNamespace)); parameter.Add(new KeyValuePair<string, object>("@Class", provider.ShippingProviderClass)); parameter.Add(new KeyValuePair<string, object>("@SettingControlSrc", provider.SettingControlPath)); parameter.Add(new KeyValuePair<string, object>("@LabelControlSrc", provider.LabelControlPath)); parameter.Add(new KeyValuePair<string, object>("@TrackControlSrc", provider.TrackControlPath)); parameter.Add(new KeyValuePair<string, object>("@IsActive", provider.IsActive)); parameter.Add(new KeyValuePair<string, object>("@IsAddedZipFlag", true)); SQLHandler sqlH = new SQLHandler(); int providerId = sqlH.ExecuteAsScalar<int>("[dbo].[usp_Aspx_ShippingProviderAddUpdate]", parameter); SaveSetting(providerId, settingKey, settingValue, commonInfo); SaveDynamicMethods(provider, providerId, commonInfo); ExtractFile(provider); return providerId; } catch (Exception ex) { throw ex; } }
private static void SaveDynamicMethods(ShippingProvider provider, int providerId, AspxCommonInfo commonInfo) { foreach (var dynamicMethod in provider.DynamicMethods) { try { List<KeyValuePair<string, object>> paraMeter = new List<KeyValuePair<string, object>>(); paraMeter.Add(new KeyValuePair<string, object>("@ShippingProviderId", providerId)); paraMeter.Add(new KeyValuePair<string, object>("@AssemblyName", provider.AssemblyName)); paraMeter.Add(new KeyValuePair<string, object>("@ClassName", provider.ShippingProviderClass)); paraMeter.Add(new KeyValuePair<string, object>("@NameSpace", provider.ShippingProviderNamespace)); paraMeter.Add(new KeyValuePair<string, object>("@MethodName", dynamicMethod.MethodName)); paraMeter.Add(new KeyValuePair<string, object>("@MethodType", dynamicMethod.MethodType)); paraMeter.Add(new KeyValuePair<string, object>("@ParameterCount", dynamicMethod.DynamicParams.Count())); paraMeter.Add(new KeyValuePair<string, object>("@StoreId", commonInfo.StoreID)); paraMeter.Add(new KeyValuePair<string, object>("@PortalId", commonInfo.PortalID)); paraMeter.Add(new KeyValuePair<string, object>("@UserName", commonInfo.UserName)); SQLHandler sqLh = new SQLHandler(); int dynamicmId = sqLh.ExecuteAsScalar<int>("usp_aspx_AddDynamicMethod", paraMeter); SaveDynamicMethodParams(dynamicMethod.DynamicParams, dynamicmId,commonInfo); } catch (Exception ex) { throw ex; } } }
/// <summary> /// Connects to database and checks if the user is authentcate to edit HTML /// </summary> /// <param name="UserModuleID">userModuleID</param> /// <param name="Username">userName</param> /// <param name="PortalID">portalID</param> /// <returns>returns true if the user has permission to edit</returns> public bool IsAuthenticatedToEdit(int UserModuleID, string Username, int PortalID) { try { List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PermissionKey", "EDIT")); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserModuleID", UserModuleID)); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", Username)); ParaMeterCollection.Add(new KeyValuePair<string, object>("@PortalID", PortalID)); SQLHandler sagesql = new SQLHandler(); return sagesql.ExecuteAsScalar<bool>("sp_CheckUserModulePermissionByPermissionKeyADO", ParaMeterCollection); } catch (Exception e) { throw e; } }
public static void ShippingProviderAddUpdate(List<ShippingMethod> methods, ShippingProvider provider, bool isAddedZip, AspxCommonInfo aspxCommonObj) { try { if (!isAddedZip) { List<KeyValuePair<string, object>> parameter = CommonParmBuilder.GetParamSPUC(aspxCommonObj); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderID", provider.ShippingProviderID)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderServiceCode", provider.ShippingProviderServiceCode)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderName", provider.ShippingProviderName)); parameter.Add(new KeyValuePair<string, object>("@ShippingProviderAliasHelp", provider.ShippingProviderAliasHelp)); parameter.Add(new KeyValuePair<string, object>("@AssemblyName", null)); parameter.Add(new KeyValuePair<string, object>("@Namespace", null)); parameter.Add(new KeyValuePair<string, object>("@Class", null)); parameter.Add(new KeyValuePair<string, object>("@SettingControlSrc", null)); parameter.Add(new KeyValuePair<string, object>("@IsActive", provider.IsActive)); parameter.Add(new KeyValuePair<string, object>("@IsAddedZipFlag", false)); SQLHandler sqlH = new SQLHandler(); int id = sqlH.ExecuteAsScalar<int>("[dbo].[usp_Aspx_ShippingProviderAddUpdate]", parameter); //add providers provided shipping methods/services List<KeyValuePair<string, object>> param = new List<KeyValuePair<string, object>>(); param.Add(new KeyValuePair<string, object>("@StoreId", aspxCommonObj.StoreID)); param.Add(new KeyValuePair<string, object>("@PortalId", aspxCommonObj.PortalID)); int displayorder = sqlH.ExecuteAsScalar<int>("[dbo].[usp_Aspx_GetDisplayOrderForShippingMethod]", param); if (methods != null) { if (provider.ShippingProviderID != 0) { foreach (ShippingMethod method in methods) { displayorder++; List<KeyValuePair<string, object>> parameterz = new List<KeyValuePair<string, object>>(); parameterz.Add(new KeyValuePair<string, object>("@ShippingMethodName", method.ShippingMethodName)); parameterz.Add(new KeyValuePair<string, object>("@ShippingMethodCode", method.ShippingMethodCode)); parameterz.Add(new KeyValuePair<string, object>("@ImagePath", "")); parameterz.Add(new KeyValuePair<string, object>("@AlternateText", method.AlternateText)); parameterz.Add(new KeyValuePair<string, object>("@DisplayOrder", displayorder)); parameterz.Add(new KeyValuePair<string, object>("@DeliveryTime", method.DeliveryTime)); parameterz.Add(new KeyValuePair<string, object>("@WeightLimitFrom", method.WeightLimitFrom)); parameterz.Add(new KeyValuePair<string, object>("@WeightLimitTo", method.WeightLimitTo)); parameterz.Add(new KeyValuePair<string, object>("@ShippingProviderID", provider.ShippingProviderID)); parameterz.Add(new KeyValuePair<string, object>("@StoreID", aspxCommonObj.StoreID)); parameterz.Add(new KeyValuePair<string, object>("@PortalID", aspxCommonObj.PortalID)); parameterz.Add(new KeyValuePair<string, object>("@IsActive", method.IsActive)); parameterz.Add(new KeyValuePair<string, object>("@UserName", aspxCommonObj.UserName)); parameterz.Add(new KeyValuePair<string, object>("@CultureName", aspxCommonObj.CultureName)); sqlH.ExecuteNonQuery("usp_Aspx_AddProvidersShippingMethod", parameterz); } } } } else { //add providers provided shipping methods/services int displayorder = 0; if (provider.ShippingProviderID != 0) { foreach (ShippingMethod method in methods) { displayorder++; List<KeyValuePair<string, object>> parameterz = CommonParmBuilder.GetParamSPUC(aspxCommonObj); parameterz.Add(new KeyValuePair<string, object>("@ShippingMethodName", method.ShippingMethodName)); parameterz.Add(new KeyValuePair<string, object>("@ShippingMethodCode", method.ShippingMethodCode)); parameterz.Add(new KeyValuePair<string, object>("@ImagePath", "")); parameterz.Add(new KeyValuePair<string, object>("@AlternateText", method.AlternateText)); parameterz.Add(new KeyValuePair<string, object>("@DisplayOrder", displayorder)); parameterz.Add(new KeyValuePair<string, object>("@DeliveryTime", method.DeliveryTime)); parameterz.Add(new KeyValuePair<string, object>("@WeightLimitFrom", provider.MinWeight)); parameterz.Add(new KeyValuePair<string, object>("@WeightLimitTo", provider.MaxWeight)); parameterz.Add(new KeyValuePair<string, object>("@ShippingProviderID", provider.ShippingProviderID)); parameterz.Add(new KeyValuePair<string, object>("@IsActive", method.IsActive)); SQLHandler sqlH = new SQLHandler(); sqlH.ExecuteNonQuery("usp_Aspx_AddProvidersShippingMethod", parameterz); } } } } catch (Exception e) { throw e; } }
//public List<AttributeFormInfo> GetFormAttributes(Int32 StoreID, Int32 PortalID, string Culture) //{ // List<AttributeFormInfo> formAttributeList = new List<AttributeFormInfo>(); // SqlCommand sqlCmd = new SqlCommand(); // sqlCmd.Connection = conn; // sqlCmd.CommandType = CommandType.StoredProcedure; // sqlCmd.CommandText = "aspx_sp_TestDynamicForm"; // SqlParameter param1 = new SqlParameter("@StoreID", StoreID); // SqlParameter param2 = new SqlParameter("@PortalID", PortalID); // SqlParameter param3 = new SqlParameter("@Culture", Culture); // sqlCmd.Parameters.Add(param1); // sqlCmd.Parameters.Add(param2); // sqlCmd.Parameters.Add(param3); // SqlDataReader reader; // try // { // conn.Open(); // using (reader = sqlCmd.ExecuteReader()) // { // if (reader.HasRows) // { // while (reader.Read()) // { // //forumList=DataSourceHelper.FillCollection(reader, typeof(Forum)); // AttributeFormInfo form = new AttributeFormInfo(); // form.AttributeID = Int32.Parse(reader["AttributeID"].ToString()); // form.AttributeName = reader["AttributeName"].ToString(); // form.DefaultValue = reader["DefaultValue"].ToString(); // form.GroupID = Int32.Parse(reader["GroupID"].ToString()); // form.GroupName = reader["GroupName"].ToString(); // form.Help = reader["Help"].ToString(); // form.InputTypeID = Int32.Parse(reader["InputTypeID"].ToString()); // form.InputTypeValues = reader["InputTypeValues"].ToString(); // form.IsEnableEditor = bool.Parse(reader["IsEnableEditor"].ToString()); // form.IsRequired = bool.Parse(reader["IsRequired"].ToString()); // form.PortalID = Int32.Parse(reader["PortalID"].ToString()); // form.IsUnique = bool.Parse(reader["IsUnique"].ToString()); // form.Length = Int32.Parse(reader["Length"].ToString()); // form.StoreID = Int32.Parse(reader["StoreID"].ToString()); // form.ToolTip = reader["ToolTip"].ToString(); // form.ValidationTypeID = Int32.Parse(reader["ValidationTypeID"].ToString()); // formAttributeList.Add(form); // } // } // } // return formAttributeList; // } // catch (Exception ex) // { // throw ex; // } // finally // { // conn.Close(); // } //} public bool CheckUniquenessBoolean(Int32 flag, Int32 storeID, Int32 portalID, Int32 attributeID, bool attributeValue) { try { SQLHandler sqlH = new SQLHandler(); List<KeyValuePair<string, object>> parameterCollection = new List<KeyValuePair<string, object>>(); parameterCollection.Add(new KeyValuePair<string, object>("@Flag", flag)); parameterCollection.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameterCollection.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameterCollection.Add(new KeyValuePair<string, object>("@AttributeID", attributeID)); parameterCollection.Add(new KeyValuePair<string, object>("@AttributeValue", attributeValue)); bool isUnique = sqlH.ExecuteAsScalar<bool>("dbo.usp_Aspx_CheckUniqueness_Boolean", parameterCollection); return isUnique; } catch (Exception ex) { throw ex; } }
public string SaveCartPricingRule(CartPricingRuleInfo objCartPriceRule, Int32 storeID, Int32 portalID, string userName, string culture, object parentID) { try { List<KeyValuePair<string, object>> p1 = new List<KeyValuePair<string, object>>(); //P1.Add(new KeyValuePair<string,object>("@StoreID", storeID)); p1.Add(new KeyValuePair<string, object>("PortalID", portalID)); SQLHandler sql = new SQLHandler(); int count = sql.ExecuteAsScalar<int>("usp_Aspx_CartPrincingRuleCount", p1); int maxAllowed = 3; int cartPriceRuleId = objCartPriceRule.CartPriceRule.CartPriceRuleID; if (cartPriceRuleId > 0) { maxAllowed++; } if (count < maxAllowed) { PriceRuleController priceRuleController = new PriceRuleController(); priceRuleController.SaveCartPricingRule(objCartPriceRule, storeID, portalID, userName, culture, parentID); //return "({ \"returnStatus\" : 1 , \"Message\" : \"Saving cart pricing rule successfully.\" })"; return "success"; } else { //return "({ \"returnStatus\" : -1 , \"Message\" : \"No more than 3 rules are allowed in Free version of AspxCommerce!\" })"; return "notify"; } } catch (Exception ex) { ErrorHandler errHandler = new ErrorHandler(); if (errHandler.LogWCFException(ex)) { return "({ \"returnStatus\" : -1 , \"errorMessage\" : \"" + ex.Message + "\" })"; } else { return "({ \"returnStatus\" : -1, \"errorMessage\" : \"Error while saving cart pricing rule!\" })"; } } }
private string GetPaymentGateWaySourceLocation(int paymentGatewayId) { try { var parameter = new List<KeyValuePair<string, object>> { new KeyValuePair<string, object>("@PaymentGateWayId", paymentGatewayId) }; var sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<string>("usp_Aspx_mb_GetPaymentGatewayLocation", parameter); } catch (Exception ex) { throw ex; } }
public decimal GetTotalCartItemPrice(int storeID, int portalID, int customerID, string sessionCode) { try { List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@CustomerID", customerID)); parameter.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair<string, object>("@SessionCode", sessionCode)); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<decimal>("usp_Aspx_GetCartItemsTotalAmount", parameter); } catch (Exception ex) { throw ex; } }
public static int GetUserID(string userName) { string StoredProcedureName = "usp_FileManagerGetUserID"; SQLHandler sagesql = new SQLHandler(); List<KeyValuePair<string, object>> ParaMeterCollection = new List<KeyValuePair<string, object>>(); ParaMeterCollection.Add(new KeyValuePair<string, object>("@UserName", userName)); int UserID = 0; UserID = sagesql.ExecuteAsScalar<int>(StoredProcedureName, ParaMeterCollection); return UserID; }
public int GetCompareItemsCount(int storeID, int portalID, string sessionCode,string userName) { try { List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair<string, object>("@SessionCode", sessionCode)); parameter.Add(new KeyValuePair<string, object>("@UserName", userName)); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<int>("usp_Aspx_GetCompareItemsCount", parameter); } catch (Exception ex) { throw ex; } }
public decimal GetTotalShippingCost(int shippingMethodID, int storeID, int portalID, string userName, string cultureName) { List<KeyValuePair<string, object>> parameter = new List<KeyValuePair<string, object>>(); parameter.Add(new KeyValuePair<string, object>("@ShippingMethodID", shippingMethodID)); parameter.Add(new KeyValuePair<string, object>("@StoreID", storeID)); parameter.Add(new KeyValuePair<string, object>("@PortalID", portalID)); parameter.Add(new KeyValuePair<string, object>("@UserName", userName)); parameter.Add(new KeyValuePair<string, object>("@CultureName", cultureName)); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<decimal>("usp_Aspx_ShippingCost", parameter); }
public bool IsStoreExists(string storeName) { bool i = false; var paraMeter = new List<KeyValuePair<string, object>>(); paraMeter.Add(new KeyValuePair<string, object>("@PortalName", storeName)); var sqlH = new SQLHandler(); i = sqlH.ExecuteAsScalar<bool>("usp_Aspx_CheckPortal", paraMeter); return i; }
public string GetFileName(int ImageId) { try { List<KeyValuePair<string, object>> Parameter = new List<KeyValuePair<string, object>>(); Parameter.Add(new KeyValuePair<string, object>("@ImageId", ImageId)); SQLHandler sqlH = new SQLHandler(); return sqlH.ExecuteAsScalar<string>("usp_SageBannerGetFileName", Parameter); } catch (Exception ex) { throw ex; } }
/// <summary> /// Connects to database and returns monthly wise visit. /// </summary> /// <returns>monthly wise visit.</returns> public static int GetMonthlyVisit() { SQLHandler SQLH = new SQLHandler(); return SQLH.ExecuteAsScalar<int>("usp_GetMonthlyVisit"); }