/// <summary> /// This method is used to execute stored procedure and return value. /// </summary> /// <param name="ParameterCollection"></param> public static string ExecuteScalarSp(clsParameterCollection ParameterCollection) { SqlConnection Connection = getConnection(); try { Connection.Open(); SqlCommand Command = new SqlCommand(ParameterCollection.ProcedureName, Connection); Command.CommandType = CommandType.StoredProcedure; foreach (clsParameter para in ParameterCollection.ParaCollection) { SqlParameter sqlPara = new SqlParameter(para.ParameterName, para.ParameterValue); Command.Parameters.Add(sqlPara); } return Command.ExecuteScalar().ToString(); } catch (Exception ex) { throw ex; } finally { Connection.Close(); Connection.Dispose(); if (Connection.State == ConnectionState.Open) Connection.Close(); } }
/// <summary> /// This method is used to execute stored procedure. /// </summary> /// <param name="ParameterCollection"></param> public static void ExecuteNonQuerySp(clsParameterCollection ParameterCollection) { SqlConnection Connection = getConnection(); try { Connection.Open(); SqlCommand Command = new SqlCommand(ParameterCollection.ProcedureName, Connection); Command.CommandType = CommandType.StoredProcedure; Command.CommandTimeout = 0; foreach (clsParameter para in ParameterCollection.ParaCollection) { SqlParameter sqlPara = new SqlParameter(para.ParameterName, para.ParameterValue); Command.Parameters.Add(sqlPara); } Command.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { Connection.Close(); Connection.Dispose(); if (Connection.State == ConnectionState.Open) Connection.Close(); } }
/// <summary> /// This method is used to get parent menu details. /// </summary> /// <returns></returns> public static DataTable GetMenu() { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_GetMenu"; return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// Get Page List /// </summary> /// <returns></returns> public static DataTable GetPage(int Categoryid) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_GetPage"; ParameterCollection.Add(new clsParameter("@CategoryId", Categoryid)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to get login user storecode. /// </summary> /// <param name="UserID"></param> /// <returns></returns> public static DataTable getLoginUserStoreCode(string UserID) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_getUserStoreCode"; ParameterCollection.Add(new clsParameter("@UserID", UserID)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
public static DataTable DeleteCategory(string CategoryID) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_DeleteCategory"; ParameterCollection.Add(new clsParameter("@CategoryId", Convert.ToInt32(CategoryID))); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to get user details by role id. /// </summary> /// <param name="RoleId"></param> /// <returns></returns> public static DataTable BL_GeCategoryDtls(string RoleId) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_GetCategoryDetails"; ParameterCollection.Add(new clsParameter("@RoleId", RoleId)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to get menu items for role id. /// </summary> /// <param name="RoleId"></param> /// <returns></returns> public static DataTable GetRoleMenu(string RoleId) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_PermissionManagement_GetRoleMenu"; ParameterCollection.Add(new clsParameter("@RoleId", RoleId)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to execute stored procedure and get result in data table. /// </summary> /// <param name="ParameterCollection"></param> /// <returns></returns> public static DataTable ExecuteSpAndGetDataTable(clsParameterCollection ParameterCollection) { SqlConnection Connection = getConnection(); SqlCommand Command = new SqlCommand(ParameterCollection.ProcedureName, Connection); DataSet DataSet = new DataSet(); DataTable DataTable = new DataTable(); try { Connection.Open(); Command.CommandType = CommandType.StoredProcedure; Command.CommandTimeout = 120; List<clsParameter> paracollection = ParameterCollection.ParaCollection; if (paracollection != null) { foreach (clsParameter param in paracollection) { SqlParameter SqlParameter = new SqlParameter(param.ParameterName, param.ParameterValue); Command.Parameters.Add(SqlParameter); } } SqlDataAdapter DataAdapter = new SqlDataAdapter(); DataAdapter.SelectCommand = Command; DataAdapter.Fill(DataTable); } catch (Exception ex) { throw ex; } finally { Command.Connection.Close(); Command.Connection.Dispose(); Command.Dispose(); if (Connection.State == ConnectionState.Open) Connection.Close(); } return DataTable; }
/// <summary> /// This method is used to save user store details. /// </summary> /// <param name="StoreCode"></param> /// <param name="UserId"></param> public static void UpdateUserStoreCode(string EditedUserName, string UserId, string isAdmin) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_UserManagement_UpdateStoreUser"; ParameterCollection.Add(new clsParameter("@Userid", UserId)); ParameterCollection.Add(new clsParameter("@IsAdmim", isAdmin)); ParameterCollection.Add(new clsParameter("@EditedUserName", EditedUserName)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to update user profile details. /// </summary> /// <param name="objUserInfo"></param> /// <returns></returns> public static DataTable UpdateCategory(CategoryInfo objCategoryInfo,string ModifiedBy) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_UpdateCategory"; ParameterCollection.Add(new clsParameter("@Categoryid", objCategoryInfo.CategoryId)); ParameterCollection.Add(new clsParameter("@CategoryName", objCategoryInfo.CategoryName)); ParameterCollection.Add(new clsParameter("@Desciption", objCategoryInfo.Desciption)); ParameterCollection.Add(new clsParameter("@Password", objCategoryInfo.Password)); ParameterCollection.Add(new clsParameter("@IsActive", objCategoryInfo.IsActive)); ParameterCollection.Add(new clsParameter("@Modifiedby", ModifiedBy.Trim())); ParameterCollection.Add(new clsParameter("@Order", objCategoryInfo.Order)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to save user store details. /// </summary> /// <param name="UserId"></param> /// <param name="StoreCode"></param> /// <param name="CreatedBy"></param> public static void SaveCategory(string CategoryName,string Desciption,string password,string CreatedBy, bool isActive,string Categoryorder) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_CategoryManagement_AddCategory"; ParameterCollection.Add(new clsParameter("@CategoryName", CategoryName)); ParameterCollection.Add(new clsParameter("@Desciption", Desciption)); ParameterCollection.Add(new clsParameter("@Password", password)); ParameterCollection.Add(new clsParameter("@CreatedBy", CreatedBy)); ParameterCollection.Add(new clsParameter("@IsActive", isActive)); ParameterCollection.Add(new clsParameter("@Order", Categoryorder)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to get user details by search condition. /// </summary> /// <param name="objUserInfo"></param> /// <returns></returns> public static DataTable GetUserDtlsByCondition(UserManagementInfo objUserInfo) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_GetUserDetailsByCondition"; ParameterCollection.Add(new clsParameter("@SearchCondition", objUserInfo.SearchCondition)); ParameterCollection.Add(new clsParameter("@SearchText", objUserInfo.SearchText)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to save user store details. /// </summary> /// <param name="UserId"></param> /// <param name="StoreCode"></param> /// <param name="CreatedBy"></param> public static void SavePage(string CategoryName, string Desciption, string Categoryid,string vimeoUrl,string CreatedBy, bool isActive,string PageOrder) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_PageManagement_AddPage"; ParameterCollection.Add(new clsParameter("@PageName", CategoryName)); ParameterCollection.Add(new clsParameter("@Desciption", Desciption)); ParameterCollection.Add(new clsParameter("@Categoryid", Convert.ToInt32(Categoryid))); ParameterCollection.Add(new clsParameter("@CreatedBy", CreatedBy)); ParameterCollection.Add(new clsParameter("@VimeoUrl", vimeoUrl)); ParameterCollection.Add(new clsParameter("@IsActive", isActive)); ParameterCollection.Add(new clsParameter("@Pageorder", Convert.ToInt32(PageOrder))); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to set view permission to role. /// </summary> /// <param name="ApplicationName"></param> /// <returns></returns> public static void SetViewPermission(PermissionInfo PermissionInfo) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_PermissionManagement_SetViewPermission"; ParameterCollection.Add(new clsParameter("@MenuId", PermissionInfo.MenuId)); ParameterCollection.Add(new clsParameter("@RoleId", PermissionInfo.RoleId)); ParameterCollection.Add(new clsParameter("@View", PermissionInfo.View)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to update user profile details. /// </summary> /// <param name="objUserInfo"></param> /// <returns></returns> public static DataTable UpdateUserProfile(UserManagementInfo objUserInfo) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_UpdateUserProfile"; ParameterCollection.Add(new clsParameter("@PropertyValuesString", objUserInfo.PropertyValuesString)); ParameterCollection.Add(new clsParameter("@UserName", objUserInfo.UserName)); return DataAccess.ExecuteSpAndGetDataTable(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }