public JsonResult CreateGlobalSetting(int gSettingsId, string code, string desc, string value, string rangeMin, string rangeMax, bool status) { System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { Int32 returnValue = -2; int checkSession = UserLogin.AuthenticateRequest(); int createdBy = Convert.ToInt32(Session["UserID"]); if (checkSession == 0) { return Json(returnValue); } else { var data = new GlobalSetting { Id = gSettingsId, Code = code, Description = desc, Value = value, RangeMax = rangeMax, RangeMin = rangeMin, Status = status, CreatedBy = createdBy }; int result = data.InsertGlobalSettings(); return Json(result); } } catch (Exception ex) { log.Error("Error: " + ex); return Json(""); } finally { log.Debug("End: " + methodBase.Name); } }
/// <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); } }
private GlobalSetting FetchGlobalSettings(GlobalSetting setting, SafeDataReader dr) { setting.Id = dr.GetInt32("ID"); setting.Code = dr.GetString("Code"); setting.Value = dr.GetString("Value"); setting.RangeMin = dr.GetString("RangeMin"); setting.RangeMax = dr.GetString("RangeMax"); setting.Description = dr.GetString("Description"); setting.Status = dr.GetBoolean("Status"); return setting; }
/// <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); } }