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