示例#1
0
        /// <summary>
        /// Description  :  
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <param name="GlobalSettingsId">pass the GlobalSettings id which GlobalSettings details you wont </param>
        /// <returns></returns>
        public static GlobalSetting GetGlobalSettingsById(int id)
        {
            var GlobalSettings = new GlobalSetting();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@ID", id);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetGlobalSettingsById]", sqlParams);

                while (reader.Read())
                {
                    GlobalSettings.FetchGlobalSettings(GlobalSettings, new SafeDataReader(reader));
                }

                return GlobalSettings;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return GlobalSettings;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
示例#2
0
        /// <summary>
        /// Description  : 
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  : pavan
        /// Modified Date: 13 May 2014
        /// </summary>
        /// <returns>it will give all the GlobalSettings details available in database</returns>
        public static GlobalSettingInfo GetAllGlobalSettings(int startPage, int resultPerPage, string code, int status, string OrderBy)
        {
            var data = new GlobalSettingInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[5];
                sqlParams[0] = new SqlParameter("@startPage", startPage);
                sqlParams[1] = new SqlParameter("@resultPerPage", resultPerPage);
                sqlParams[2] = new SqlParameter("@code", code);
                sqlParams[3] = new SqlParameter("@status", status);
                sqlParams[4] = new SqlParameter("@OrderBy", OrderBy);

                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetAllMGlobalSettings]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Setting = new GlobalSetting();
                    Setting.FetchGlobalSettings(Setting, safe);
                    data.GlobalSettingList.Add(Setting);
                    data.GlobalSettingsCount = Convert.ToInt32(reader["GlobalSettingCount"]);
                }

                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }