示例#1
0
        private void openImgToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog Openfile = new OpenFileDialog();

            if (Openfile.ShowDialog() == DialogResult.OK)
            {
                Image <Bgr, Byte> img;
                try
                {
                    img = new Image <Bgr, byte>(Openfile.FileName);
                }
                catch
                {
                    MessageBox.Show(String.Format("Invalide File: {0}", Openfile.FileName));
                    return;
                }
                imageBox1.Image = img;
                ImageProcessing imageProcessing = new ImageProcessing();
                string          bienSo          = filterCharactor(imageProcessing.ProcessImage(img));
                txtBienSo.Text = bienSo;
                TicketType?objPlate = WebServiceHelper.CheckPlate(Constant.WebserviceUrl.CheckTicketType, user,
                                                                  pass, bienSo);
                MotorbikeType?objMotorType = WebServiceHelper.CheckMotorType(Constant.WebserviceUrl.CheckMotorType,
                                                                             user, pass, "29H104178");
                if (objPlate == null)
                {
                    //txtLoaiXe.Text = motorType;
                    txtBienSo.Enabled = true;
                    txtLoaiVe.Text    = "Vé Ngày";
                    txtGiaVe.Text     = "3000";
                }
                else
                {
                    //int price = Int32.Parse(BusinessUtils.GetValue(obj, "Price"));
                    //string motorType = BusinessUtils.GetValue(obj, "Description");
                    //TicketType ticketType = TicketType

                    //Fill to textbox
                    if (objMotorType.ToString() == "XE_GA")
                    {
                        rbtnXeGa.Checked = true;
                        rbtnXeSo.Enabled = false;
                    }
                    else
                    if (objMotorType.ToString() == "XE_SO")
                    {
                        rbtnXeSo.Checked = true;
                        rbtnXeGa.Enabled = false;
                    }
                    txtLoaiVe.Text = objPlate.ToString();
                    txtGiaVe.Text  = "0";
                }
            }
        }