private void Btn_login_Click(object sender, EventArgs e) { DataTable CheckUser = ConnectionStr.executsql("SELECT * FROM TBL_USER WHERE USERNAME='******' AND PASSWORD='******'"); if (CheckUser.Rows.Count > 0) { MessageBox.Show("ยินดีต้อนรับ คุณ" + CheckUser.Rows[0]["USERNAME"] + "เข้าสู่ระบบ", "ยินดีต้อนรับ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void DESCrypt() { var keycode = "jxkejixu".Encryptogram(); var signal = new AutoResetEvent(false); signal.WaitOne(); var encrypeStr = ConnectionStr.Encryptogram("jxkejixu"); var decrypeStr = encrypeStr.Decryptogram("jxkejixu"); Assert.AreEqual(decrypeStr, ConnectionStr); }
private void Form1_Load(object sender, EventArgs e) { ConnectionStr.connnectsql(); DataTable loaddata = ConnectionStr.executsql("SELECT * FROM customer"); datagv.DataSource = loaddata; datagv.Columns[0].HeaderText = "ID"; datagv.Columns[1].HeaderText = "NAME"; datagv.Columns[2].HeaderText = "SURNAME"; datagv.Columns[3].HeaderText = "NICKNAME"; datagv.Columns[4].HeaderText = "AGE"; }
private void button1_Click(object sender, EventArgs e) { if (txtid.Text == "" || txtname.Text == "" || txtnick.Text == "" || txtage.Text == "" || txtsurname.Text == "") { MessageBox.Show("กรุณากรอกให้ครบ", "แจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { ConnectionStr.executsql("INSERT INTO customer(ID,name,surname,nickname,age) " + "VALUES ('" + txtid.Text + "','" + txtname.Text + "','" + txtsurname.Text + "','" + txtnick.Text + "','" + txtage.Text + "')"); MessageBox.Show("บันทึกข้อมูลแล้ว", "บันแล้วสัส", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FormReporting_Load(object sender, EventArgs e) { ConnectionStr.connnectsql(); Process[] pname = Process.GetProcessesByName("KitCash"); if (pname.Length == 0) { MessageBox.Show("กรุณาเข้าสู่ระบบ"); Close(); } foreach (Process process in pname) { //if (!String.IsNullOrEmpty(process.MainWindowTitle)) //{ // MessageBox.Show(process.MainWindowTitle); //} string s = process.MainWindowTitle; s = s.Replace("KitCash - ", ""); DataTable empid = ConnectionStr.executsql("SELECT * FROM Tbl_Employee WHERE Emp_Id = '" + s + "'"); if (empid.Rows.Count > 0) { string n = "KitCash - " + s; if (process.MainWindowTitle != n) { MessageBox.Show("กรุณาเข้าสู่ระบบ"); Close(); } } else { MessageBox.Show("กรุณาเข้าสู่ระบบ"); Close(); } } //if (pname.Length == 0) //{ // MessageBox.Show("กรุณาเข้าสู่ระบบ"); // Close(); //} //var info = Process.GetProcessesByName("KitCash").FirstOrDefault(); //string info2 = Convert.ToString(info); //if (info2 == "KitCash - Menu") //{ //} //else //{ // MessageBox.Show(info2); // Close(); //} }
public db_helper(ConnectionStr ConnStr) { objFactory = SqlClientFactory.Instance; objConn = objFactory.CreateConnection(); objComm = objFactory.CreateCommand(); if (ConnStr == ConnectionStr.HelpdeskConnStr) { objConn.ConnectionString = ConfigurationManager.ConnectionStrings["HelpdeskConnStr"].ToString(); } else if (ConnStr == ConnectionStr.vAppUsersConnStr) { objConn.ConnectionString = ConfigurationManager.ConnectionStrings["vAppUsersConnStr"].ToString(); } else if (ConnStr == ConnectionStr.vPortalConnStr) { objConn.ConnectionString = ConfigurationManager.ConnectionStrings["vPortalConnStr"].ToString(); } else if (ConnStr == ConnectionStr.HelpdeskConnStrLive) { objConn.ConnectionString = ConfigurationManager.ConnectionStrings["HelpdeskConnStrLive"].ToString(); } objComm.Connection = objConn; }
private void b_showtotal_Click(object sender, EventArgs e) { DateTime dtstart = Convert.ToDateTime(dt1.Value.ToString()); DateTime dtend = Convert.ToDateTime(dt2.Value.ToString()); DataTable showpriceSum = ConnectionStr.executsql("select sum(TR_Total) as total from tbl_sale where TR_Date between '" + dtstart.ToString("yyyy-MM-dd", new CultureInfo("en-US")) + "' and '" + dtend.ToString("yyyy-MM-dd" + " 23:59:59", new CultureInfo("en-US")) + "'"); showtotal.Text = showpriceSum.Rows[0]["total"].ToString(); string Str = showtotal.Text.Trim(); double Num; bool isNum = double.TryParse(Str, out Num); if (isNum) { showtotal.Text = Convert.ToDouble(showtotal.Text).ToString("##,##0.00"); } else { showtotal.Text = "0.00"; } }
// Token: 0x06000031 RID: 49 RVA: 0x000043EC File Offset: 0x000025EC public void SetConnection(string connection) { ConnectionPiece = ConnectionStr.Replace("//CONNECTION//", connection); }
private void Form1_Load(object sender, EventArgs e) { ConnectionStr.connnectsql(); }