public void _zendesk(object _p)
        {
            objSQL _params;
            int    i;

            try
            {
                _params = (objSQL)_p;
                using (RedshiftWorker sql = new RedshiftWorker("PSQL_salesdashboard"))
                {
                    DataTable dt = new DataTable(); OdbcDataAdapter da = new OdbcDataAdapter(); DataRow dr;
                    dt.TableName = _params._tablename;
                    sql.GetDT(_params._sql, ref da, ref dt);
                    if (dt.Rows.Count == 0)
                    {
                        dr = dt.NewRow();
                        for (i = 0; i < _params._fields.Count(); i++)
                        {
                            if (_params._dr[i].ToString().Length > 0)
                            {
                                dr[i] = @_params._dr[i];
                            }
                        }
                        dr["dsn"]      = Guid.NewGuid();
                        dr["imported"] = DateTime.Now;
                        dt.Rows.Add(dr);
                    }
                    else
                    {
                        dr = dt.Rows[0];
                        for (i = 0; i < _params._fields.Count(); i++)
                        {
                            if (_params._dr[i].ToString().Replace("[", "").Replace("]", "").Length > 0)
                            {
                                dr[i] = @_params._dr[i];
                            }
                        }
                        dr["lastupdate"] = DateTime.Now;
                    }
                    sql.UpdateDT(ref da, ref dt);
                }
            }
            catch (Exception ex)
            {
                string err = string.Format("{0}: {1}", MethodBase.GetCurrentMethod().Name, ex.ToString());
                Nlogger.Error(err);
            }
        }
 /// <summary>
 /// because AWS redshift doesn't support clacluetd functions dt_values are set by update
 /// </summary>
 public void _dtUpdate()
 {
     try
     {
         using (RedshiftWorker sql = new RedshiftWorker("PSQL_salesdashboard"))
         {
             sql.ExcuteSQL(AppConfig.GetString("update_dt_dealstage", "", "AWSRedshift_Statements"));
             sql.ExcuteSQL(AppConfig.GetString("update_dt_created", "", "AWSRedshift_Statements"));
         }
     }
     catch (Exception ex)
     {
         string err = string.Format("{0}: {1}", MethodBase.GetCurrentMethod().Name, ex.ToString());
         Nlogger.Error(err);
     }
 }