public void SetProfile(bool mail_enable, bool consort, string towing_co, string forest_co) { Consort = consort; MailEnable = mail_enable; TowingCo = towing_co; ForestCo = forest_co; ErrMail.SendMailInit(MailEnable, Consort); }
public static SqlConnection Connect(string dbo) { try { string strCon = build_con(dbo); SqlConnection con = new SqlConnection(strCon); con.Open(); return(con); } catch (Exception ex) { ErrMail.Fail(ex, System.Reflection.MethodBase.GetCurrentMethod()); return(null); } }
/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ public static int dabScalar(string dbo, string sql) { try { using (SqlConnection con = sqlConnect.Connect(dbo)) { SqlCommand cmd = new SqlCommand(sql, con); int r = (Int32)cmd.ExecuteScalar(); return(r); } } catch (Exception ex) { ErrMail.Fail(ex, System.Reflection.MethodBase.GetCurrentMethod()); return(-1); } }
/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ public static DataTable dabFill(string dbo, string sql) { try { using (SqlConnection con = Connect(dbo)) { using (SqlDataAdapter da = new SqlDataAdapter()) { da.SelectCommand = new SqlCommand(sql, con); DataTable dt = new DataTable(); da.Fill(dt); return(dt); } } } catch (Exception ex) { //ErrDash.SetLastException(ex, System.Reflection.MethodBase.GetCurrentMethod()); ErrMail.Fail(ex, System.Reflection.MethodBase.GetCurrentMethod()); return(new DataTable("*Failure*")); } }
static public DataTable ReadDT(string dbo, string tname, string where) { DataTable dt; try { using (SqlConnection con = sqlConnect.Connect(dbo)) { dt = new DataTable(); SqlCommand cmd = cmd_select(tname, where, con); SqlDataReader dr = cmd.ExecuteReader(); dt.Load(dr); return(dt); } } catch (Exception ex) { ErrMail.Fail(ex, System.Reflection.MethodBase.GetCurrentMethod()); return(new DataTable("*Failure*")); } }