public static string FireBasePushNotificationsURL()
 {
     try
     {
         return(ConfigurationManager.AppSettings["FireBasePushNotificationsURL"]);
     }
     catch (Exception ex)
     {
         ErrHandler.Log("Unable to find FireBasePushNotificationsURL: " + ex.Message);
         throw;
     }
 }
 public static string ServerKey()
 {
     try
     {
         return(ConfigurationManager.AppSettings["ServerKey"]);
     }
     catch (Exception ex)
     {
         ErrHandler.Log("Unable to find ServerKey: " + ex.Message);
         throw;
     }
 }
 public static string EOneConnString()
 {
     try
     {
         return(GTBEncryptLib.DecryptText(ConfigurationManager.ConnectionStrings["EOneConnString"].ConnectionString));
     }
     catch (Exception ex)
     {
         ErrHandler.Log("Unable to find EOneConnString: " + ex.Message);
         throw;
     }
 }
Ejemplo n.º 4
0
        public static SqlResModel SelectWithParam(string ConnString, string CommandName, CommandType cmdType, SqlParameter[] param = null)
        {
            string    classMeth = "SelectWithParam ";
            DataTable ds        = new DataTable();
            var       res       = new SqlResModel();

            using (SqlConnection con = new SqlConnection(ConnString))
            {
                using (SqlCommand cmd = con.CreateCommand())
                {
                    try
                    {
                        cmd.CommandType = cmdType;
                        cmd.CommandText = CommandName;
                        cmd.Parameters.Clear();
                        if (param != null)
                        {
                            cmd.Parameters.AddRange(param);
                        }

                        if (con.State != ConnectionState.Open)
                        {
                            con.Open();
                        }

                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                            res.ResponseCode = "00";
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrHandler.Log(classMeth + "Error occured while executing " + CommandName + " " + ex.Message + " " + ex.StackTrace);
                        res.ResponseCode = "99";
                    }

                    cmd.Parameters.Clear();
                }
            }
            res.ResultDataTable = ds;
            return(res);
        }
Ejemplo n.º 5
0
        public static SqlResModel UpdateWithParam(string ConnString, string CommandName, CommandType commandType, SqlParameter[] param)
        {
            string classMeth = "UpdateWithParam";
            int    result    = 0;
            var    res       = new SqlResModel();

            using (SqlConnection con = new SqlConnection(ConnString))
            {
                using (SqlCommand cmd = con.CreateCommand())
                {
                    try
                    {
                        cmd.CommandType = commandType;
                        cmd.CommandText = CommandName;
                        cmd.Parameters.AddRange(param);

                        if (con.State != ConnectionState.Open)
                        {
                            con.Open();
                        }

                        result = cmd.ExecuteNonQuery();
                        ErrHandler.Log("The response from check Session is " + result);
                        result = Math.Abs(result);
                        ErrHandler.Log("result - " + result);
                        res.ResponseCode = "00";
                    }
                    catch (Exception ex)
                    {
                        ErrHandler.Log(classMeth + "Error occured while executing " + CommandName + " " + ex.Message + " " + ex.StackTrace);
                        result           = 0;
                        res.ResponseCode = "99";
                    }
                }
            }

            res.ResultInt = result;
            return(res);
        }