コード例 #1
0
ファイル: PfPurchaseJw.aspx.cs プロジェクト: nscseiu/nrcapps
        public void TextSlipNo_TextChanged(object sender, EventArgs e)
        {
            string SlipNo            = TextSlipNo.Text;
            string MatchEmpIDPattern = "^([0-9]{6})$";

            if (SlipNo != null)
            {
                if (Regex.IsMatch(SlipNo, MatchEmpIDPattern))
                {
                    alert_box.Visible = false;

                    OracleConnection conn = new OracleConnection(strConnString);
                    conn.Open();
                    OracleCommand cmd = new OracleCommand();
                    cmd.Connection  = conn;
                    cmd.CommandText = "select SLIP_NO from PF_PURCHASE_JW where SLIP_NO = '" + Convert.ToInt32(SlipNo) + "'";
                    cmd.CommandType = CommandType.Text;

                    OracleDataReader dr = cmd.ExecuteReader();
                    if (dr.HasRows)
                    {
                        CheckSlipNo.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Slip Number is not available</label>";
                        CheckSlipNo.ForeColor = System.Drawing.Color.Red;
                        TextSlipNo.Focus();
                        BtnAdd.Attributes.Add("aria-disabled", "false");
                        BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                    }
                    else
                    {
                        CheckSlipNo.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Slip Number is available</label>";
                        CheckSlipNo.ForeColor = System.Drawing.Color.Green;
                        DropDownSupplierID.Focus();
                        BtnAdd.Attributes.Add("aria-disabled", "true");
                        BtnAdd.Attributes.Add("class", "btn btn-primary active");
                    }
                }
                else
                {
                    CheckSlipNo.Text      = "<label class='control-label'><i class='fa fa-hand-o-left'></i> Enter Slip Number is 6 digit only</label>";
                    CheckSlipNo.ForeColor = System.Drawing.Color.Red;
                    TextSlipNo.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "false");
                    BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                }
            }
        }