Example #1
0
        /// <summary>
        /// GetListValues
        /// Calls [usp_selectAll_Setting_values]
        /// </summary>
        public override List <SettingDetails> GetListValues(System.Int32?clientId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_selectAll_Setting_values", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@ClientID", SqlDbType.Int).Value = clientId;
                cn.Open();
                DbDataReader          reader = ExecuteReader(cmd);
                List <SettingDetails> lst    = new List <SettingDetails>();
                while (reader.Read())
                {
                    SettingDetails obj = new SettingDetails();
                    obj.SettingItemID   = GetReaderValue_Int32(reader, "SettingItemID", 0);
                    obj.SettingValue    = GetReaderValue_String(reader, "SettingValue", "");
                    obj.SettingItemName = GetReaderValue_String(reader, "SettingItemName", "");
                    obj.DefaultValue    = GetReaderValue_String(reader, "DefaultValue", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Settings", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Example #2
0
        /// <summary>
        /// GetValue
        /// Calls [usp_select_Setting_Value]
        /// </summary>
        public override SettingDetails GetValue(System.Int32?settingItemId, System.Int32?clientId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_Setting_Value", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@SettingItemID", SqlDbType.Int).Value = settingItemId;
                cmd.Parameters.Add("@ClientID", SqlDbType.Int).Value      = clientId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetSettingFromReader(reader);
                    SettingDetails obj = new SettingDetails();
                    obj.SettingValue = GetReaderValue_String(reader, "SettingValue", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get Setting", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Example #3
0
 public ActionResult DeleteDowntime(DowntimeModel model)
 {
     if (ModelState.IsValid)
     {
         SettingDetails   _details = new SettingDetails();
         Enums.CrudStatus status   = _details.AddDowntime(model, Enums.CrudType.Delete);
         ReturnAlertMessage(status);
     }
     return(RedirectToAction("GetDowntime"));
 }
Example #4
0
 public ActionResult SetDowntime([Bind(Exclude = "Id")] DowntimeModel model)
 {
     if (ModelState.IsValid)
     {
         SettingDetails   _details = new SettingDetails();
         Enums.CrudStatus status   = _details.AddDowntime(model, Enums.CrudType.Insert);
         ReturnAlertMessage(status);
     }
     return(RedirectToAction("GetDowntime"));
 }
Example #5
0
        private static Setting PopulateFromDBDetailsObject(SettingDetails obj)
        {
            Setting objNew = new Setting();

            objNew.SettingID       = obj.SettingID;
            objNew.SettingItemID   = obj.SettingItemID;
            objNew.ClientID        = obj.ClientID;
            objNew.SettingValue    = obj.SettingValue;
            objNew.UpdatedBy       = obj.UpdatedBy;
            objNew.DLUP            = obj.DLUP;
            objNew.SettingItemName = obj.SettingItemName;
            objNew.DefaultValue    = obj.DefaultValue;
            return(objNew);
        }
Example #6
0
        public async Task <SettingsCheckResult> CheckForUpdatedSettingsAsync(
            string v_sCompanyName,
            ObservableCollection <SettingDetails> v_svSettings,
            string v_sAuthID,
            string v_sToken)
        {
            m_wcfClient = new WcfExt116.ServiceClient();
            SettingsCheckResult result = new SettingsCheckResult();

            try
            {
                ObservableCollection <WcfExt116.SettingDetails> lSettingDetails = new ObservableCollection <WcfExt116.SettingDetails>();
                foreach (SettingDetails sd in v_svSettings)
                {
                    WcfExt116.SettingDetails oSD = new WcfExt116.SettingDetails();
                    oSD.LastUpdate   = sd.LastUpdate;
                    oSD.SettingName  = sd.SettingName;
                    oSD.SettingValue = sd.SettingValue;
                    lSettingDetails.Add(oSD);
                }
                WcfExt116.SettingsCheckResult sResult = await m_wcfClient.CheckForUpdatedSettingsAsync(
                    v_sCompanyName,
                    lSettingDetails,
                    v_sAuthID,
                    v_sToken);

                if (sResult.bSuccessfull == true)
                {
                    result.bSuccessfull = sResult.bSuccessfull;
                    result.Settings     = new ObservableCollection <SettingDetails>();
                    foreach (WcfExt116.SettingDetails o in sResult.Settings)
                    {
                        SettingDetails oSD = new SettingDetails();
                        oSD.LastUpdate   = o.LastUpdate;
                        oSD.SettingName  = o.SettingName;
                        oSD.SettingValue = o.SettingValue;
                        result.Settings.Add(oSD);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #7
0
        public JsonResult GetDowntimeJson()
        {
            SettingDetails _details = new SettingDetails();

            return(Json(_details.DowntimeList()));
        }