public void QuoteForCsvContainsComma() { Assert.AreEqual("\",\"", Dbutil.QuoteForCsv(",")); }
public void QuoteForCsvContainsNewLine() { Assert.AreEqual("\"\r\n\"", Dbutil.QuoteForCsv("\r\n")); }
public void QuoteForCsvNoQuote() { Assert.AreEqual("100", Dbutil.QuoteForCsv("100")); }
public void QuoteForCsvSingleChar() { Assert.AreEqual("Q", Dbutil.QuoteForCsv("Q")); }
public void QuoteForCsvNullText() { Assert.IsNull(Dbutil.QuoteForCsv(null)); }
public void QuoteForCsvEmptyText() { Assert.AreEqual(string.Empty, Dbutil.QuoteForCsv(string.Empty)); }
public void QuoteForCsvEndsWithTab() { Assert.AreEqual("\"__\t\"", Dbutil.QuoteForCsv("__\t")); }
public void FormatBytesWithNullData() { Assert.IsNull(Dbutil.FormatBytes(null)); }
public void QuoteForCsvEndsWithSpace() { Assert.AreEqual("\"1.2 \"", Dbutil.QuoteForCsv("1.2 ")); }
public void QuoteForCsvStartsWithTab() { Assert.AreEqual("\"\t$$\"", Dbutil.QuoteForCsv("\t$$")); }
public void QuoteForCsvStartsWithSpace() { Assert.AreEqual("\" hello\"", Dbutil.QuoteForCsv(" hello")); }
public void QuoteForCsvContainsQuotes() { // The quote should be doubled and the text surround with quotes Assert.AreEqual("\"xx\"\"xx\"", Dbutil.QuoteForCsv("xx\"xx")); }
private void btnOK_Click(object sender, EventArgs e) { String ip = CommonUtil.getIP(); String ServerIP; bool InIP; String sql; SqlConnection conn; SqlCommand cmd = new SqlCommand(); if (ip.Equals("172.16.1.32")) { edtName.Text = "00539"; } String UserName_ = edtName.Text.Trim(); String Password_ = edtPassword.Text.Trim(); conn = Dbutil.getSQLServerConnection(228); sql = @"Select * From TimUser Where UserIp=@UserIp"; cmd.CommandText = sql; SqlParameter param = new SqlParameter("@UserIp", ip); cmd.Parameters.Add(param); cmd.Connection = conn; ArrayList list = Dbutil.query(cmd); if (list.Count > 0) { Hashtable ht = (Hashtable)list[0]; edtName.Text = (string)ht["UserName"]; edtPassword.Text = (string)ht["UserPass"]; } Button btn = (Button)sender; if (btn.Name.Equals("BitBtn_ZS")) { UserName_ = "XITLIVE1"; Password_ = "XITLIVE123"; ServerIP = "192.168.0.168"; } else if (btn.Name.Equals("BitBtn1")) { if (UserName_.ToUpper().Equals("XITLIVE1")) { UserName_ = "XITLIVE1"; Password_ = "XITLIVE123"; } else { UserName_ = edtName.Text.Trim(); Password_ = edtPassword.Text.Trim(); } ServerIP = "192.168.0.168"; InIP = false; } else { if (chk_InIP.Checked == true && chk_OutIP.Checked == false) { if (list.Count > 0) { Hashtable ht = (Hashtable)list[0]; edtName.Text = (string)ht["UserName"]; edtPassword.Text = (string)ht["UserPass"]; ServerIP = (string)ht["ServerIP"]; InIP = false; } } else { sql = @"select * from O_Employee where Empno = @Empno or Account = @Account"; SqlParameter p1 = new SqlParameter("@Empno", edtName.Text); SqlParameter p2 = new SqlParameter("@Account", edtName.Text); cmd.CommandText = sql; cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Connection = conn; ArrayList l1 = Dbutil.query(cmd); if (l1.Count > 0) { if (ip.Equals("172.16.1.32")) { } } } } }