Exemplo n.º 1
0
 public void QuoteForCsvContainsComma()
 {
     Assert.AreEqual("\",\"", Dbutil.QuoteForCsv(","));
 }
Exemplo n.º 2
0
 public void QuoteForCsvContainsNewLine()
 {
     Assert.AreEqual("\"\r\n\"", Dbutil.QuoteForCsv("\r\n"));
 }
Exemplo n.º 3
0
 public void QuoteForCsvNoQuote()
 {
     Assert.AreEqual("100", Dbutil.QuoteForCsv("100"));
 }
Exemplo n.º 4
0
 public void QuoteForCsvSingleChar()
 {
     Assert.AreEqual("Q", Dbutil.QuoteForCsv("Q"));
 }
Exemplo n.º 5
0
 public void QuoteForCsvNullText()
 {
     Assert.IsNull(Dbutil.QuoteForCsv(null));
 }
Exemplo n.º 6
0
 public void QuoteForCsvEmptyText()
 {
     Assert.AreEqual(string.Empty, Dbutil.QuoteForCsv(string.Empty));
 }
Exemplo n.º 7
0
 public void QuoteForCsvEndsWithTab()
 {
     Assert.AreEqual("\"__\t\"", Dbutil.QuoteForCsv("__\t"));
 }
Exemplo n.º 8
0
 public void FormatBytesWithNullData()
 {
     Assert.IsNull(Dbutil.FormatBytes(null));
 }
Exemplo n.º 9
0
 public void QuoteForCsvEndsWithSpace()
 {
     Assert.AreEqual("\"1.2 \"", Dbutil.QuoteForCsv("1.2 "));
 }
Exemplo n.º 10
0
 public void QuoteForCsvStartsWithTab()
 {
     Assert.AreEqual("\"\t$$\"", Dbutil.QuoteForCsv("\t$$"));
 }
Exemplo n.º 11
0
 public void QuoteForCsvStartsWithSpace()
 {
     Assert.AreEqual("\" hello\"", Dbutil.QuoteForCsv(" hello"));
 }
Exemplo n.º 12
0
 public void QuoteForCsvContainsQuotes()
 {
     // The quote should be doubled and the text surround with quotes
     Assert.AreEqual("\"xx\"\"xx\"", Dbutil.QuoteForCsv("xx\"xx"));
 }
Exemplo n.º 13
0
Arquivo: Form1.cs Projeto: zmYe/dbc
        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"))
                        {
                        }
                    }
                }
            }
        }