private void btnOK_Click(object sender, EventArgs e)
        {
            #region ������������֤
            string strError = string.Empty;
            if (cbxCarNo.SelectedValue.ToString() == "")

                strError += "ʡ�����Ʋ���Ϊ��!";

            if (txtCarNo.Text.Trim() == "")
            {
                strError += "���ƺŲ���Ϊ��!";
            }
            else
            {
                int iCarNoLength;

                if (int.TryParse(ini.IniReadValue("CarNoSetting", "CarNoLength"), out iCarNoLength))
                {
                    if (txtCarNo.Text.Trim().Length != iCarNoLength)
                    {
                        strError += "���ƺų��Ȳ���ȷ!";
                    }
                    else
                    {
                        string strSql = "Select * from TT_CarInfo where CarNo='" + cbxCarNo.Text + txtCarNo.Text.Trim().Substring(0, 1) + "-" + txtCarNo.Text.Trim().Substring(1) + "'";
                        object obj = DbHelperSQL.GetSingle(strSql);
                        if (obj != null)
                        {
                            strError += "�ó��ƺ��Ѿ�����!";
                        }
                    }
                }
                else
                {
                    strError += "���ƺų��ȸ�ʽ����ȷ!";
                }
            }

            if (txtDriveLicense.Text.Trim() == "")
                strError += "��ʻ֤�Ų���Ϊ��!";
            else
            {
                string strSql = "Select * from TT_CarInfo where DriveLicense='" + txtDriveLicense.Text.Trim() + "'";
                object obj = DbHelperSQL.GetSingle(strSql);
                if (obj != null)
                {
                    strError += "��ʻ֤���Ѿ�����!";
                }
            }
            if (cbxCarType.SelectedIndex == 0)
                strError += "��ѡ���ͺ�!";
            if (txtCarOwnerName.Text.Trim() == "")
                strError += "��������������!";
            if (txtCarOwnerIDCardNo.Text.Trim() == "")
            {
                strError += "�������֤����Ϊ��!";
            }
            else
            {
                if (txtCarOwnerIDCardNo.Text.Trim().Length == 15 || txtCarOwnerIDCardNo.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim())))
                    {

                    }
                    else
                    {
                        strError += "������ij������֤�Ÿ�ʽ����ȷ";

                    }
                }
                else
                {
                    strError += "������ij������֤�ų��Ȳ���ȷ";
                }
            }
            if (txtCarOwnerPhone.Text.Trim() == "")
                strError += "�����绰���벻��Ϊ��!";
            if (txtDriverName.Text.Trim() == "")
                strError += "��ʻԱ��������Ϊ��!";
            if (txtDriveCardID.Text.Trim() == "")
            {
                strError += "��ʻԱ���֤����Ϊ��!";
            }
            else
            {
                if (txtDriveCardID.Text.Trim().Length == 15 || txtDriveCardID.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtDriveCardID.Text.Trim())))
                    {

                    }
                    else
                    {
                        strError += "������ļ�ʻԱ���֤�Ÿ�ʽ����ȷ!";

                    }
                }
                else
                {
                    strError += "������ļ�ʻԱ���֤�ų��Ȳ���ȷ!";
                }
            }
            if (txtDriverPhone.Text.Trim() == "")
                strError += "��ʻԱ�绰���벻��Ϊ��!";
            if (txtMostWeight.Text.Trim() != "")
            {
                if (!CommonMethod.IsNumber(txtMostWeight.Text.Trim()) && !CommonMethod.IsDecimal(txtMostWeight.Text.Trim()))
                    strError += "�������ر���Ϊ��������С��!";
            }
            else
            {
                txtMostWeight.Text = "100.00";
            }
            //���� 2010.05.11 �жϳ�����Ϣ�Ǽ�Ƥ��Ϊ�����ʾ
            if (this.lblDigital.Text == "0.00" || this.lblDigital.Text == "00.00")
                strError += "�ճ���������Ϊ��!";
            #endregion

            if (strError == string.Empty)
            {
                #region ʵ���������Ǽ���Ϣ
                string strsql = "select Count(*) From TT_CarInfo Where CarNo='" + cbxCarNo.Text.Trim() + "-" + CommonMethod.ToDBC(txtCarNo.Text.Trim()).ToUpper() + "'";
                if (Convert.ToInt32(DbHelperSQL.GetSingle(strsql)) > 0)
                {
                    DialogResult dResult = CommonMethod.MessageBox("�ó�����Ϣ�Ѿ��Ǽ�,�Ƿ����¹��������³�Ƥ��Ϣ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dResult == DialogResult.No)
                    {
                        btnClear_Click(sender, e); return;
                    }
                }
                CoalTraffic.Model.TT_CarInfo model = new CoalTraffic.Model.TT_CarInfo();
                model.RoomCode = strRoomCode;
                model.EmptyWeight = Convert.ToDecimal(lblDigital.Text);
                model.MostWeight = Convert.ToDecimal(txtMostWeight.Text.Trim());
                model.CarNo = cbxCarNo.Text.Trim() + CommonMethod.ToDBC(txtCarNo.Text.Trim().Substring(0, 1) + "-" + txtCarNo.Text.Trim().Substring(1)).ToUpper();
                model.DriveLicense = CommonMethod.ToDBC(txtDriveLicense.Text.Trim());
                model.CarType = cbxCarType.Text.Trim();
                model.CarOwnerName = CommonMethod.ToDBC(txtCarOwnerName.Text.Trim());
                model.CarOwnerIDCard = CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim());
                model.CarOwnerPhone = CommonMethod.ToDBC(txtCarOwnerPhone.Text.Trim());
                model.DriverName = CommonMethod.ToDBC(txtDriverName.Text.Trim());
                model.DriverIDCard = CommonMethod.ToDBC(txtDriveCardID.Text.Trim());
                model.DriverPhone = CommonMethod.ToDBC(txtDriverPhone.Text.Trim());
                model.RandomCode = CommonMethod.getRandom(4);
                model.Operator = StaticParameter.UserName;
                model.BangType = BangType;
                if (StaticParameter.IsVideo == "1")
                {
                    if (byteFrontImage == null)
                    {
                        strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        byteFrontImage = this.dhVideo.CapturePic();

                    }
                }
                else
                {
                    model.FirstImage = "";
                    model.FirstImageContent = null;

                }
                model.CarCode = strRoomCode + DateTime.Now.ToString("yyyyMMddhhmmss");
                model.EmptyBangTime = DateTime.Now;
                #endregion

                string strEmptyCode = bll.Add(model);//��ӿճ�������Ϣ����TT_CarInfo���ڴ���ͨ���洢������ʵ�ֵġ��ճ�������Ϣ��ӵ�Զ�����ݿ���
                if (strEmptyCode != "")
                {
                    btnClear_Click(sender, e);  //�������
                    //this.alarmSound.Alarm("������Ϣ�Ǽdzɹ�,��ʼ��ӡ������Ϣ����");
                    this.alarmSound.Alarm("������Ϣ�Ǽdzɹ�");

                    #region ��ӡ�������---���ݳ���Ҫ�󲻴�ӡƱ��
                    //Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                    //string strFileName = "";
                    //if (StaticParameter.ReportFile == "FuYuan.")
                    //{
                    //    strFileName = "ZiChang.";
                    //}
                    //else
                    //{
                    //    strFileName = StaticParameter.ReportFile;//ִ����ʾEmptyWeightPrint�������
                    //}

                    //Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "EmptyWeightPrint");
                    //object obj = Activator.CreateInstance(type, strEmptyCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                    #endregion
                }
                else
                {
                    alarmSound.Alarm("��վ�����ݿ��쳣");
                    InsertState = 0;
                    InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strRoomName + "�����ݿ��쳣");
                }

            }
            else
            {
                alarmSound.Alarm(strError);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            string isConnection = ini.IniReadValue("Connection", "isConnection");

            #region ������������֤
            string strError = string.Empty;
            if (cbxCarNo.SelectedValue.ToString() == "")

                strError += "ʡ�����Ʋ���Ϊ��!";

            if (txtCarNo.Text.Trim() == "")
            {
                strError += "���ƺŲ���Ϊ��!";
            }
            else
            {
                int iCarNoLength;

                if (int.TryParse(ini.IniReadValue("CarNoSetting", "CarNoLength"), out iCarNoLength))
                {
                    if (txtCarNo.Text.Trim().Length != iCarNoLength)
                    {
                        strError += "���ƺų��Ȳ���ȷ!";
                    }
                    else
                    {
                        string strSql = "Select * from TT_CarInfo where CarNo='" + cbxCarNo.Text + txtCarNo.Text.Trim().Substring(0, 1) + "-" + txtCarNo.Text.Trim().Substring(1) + "'";
                        object obj = DbHelperSQL.GetSingle(strSql);
                        if (obj != null)
                        {
                            strError += "�ó��ƺ��Ѿ�����!";
                        }
                    }
                }
                else
                {
                    strError += "���ƺų��ȸ�ʽ����ȷ!";
                }
            }

            if (txtDriveLicense.Text.Trim() == "")
                strError += "��ʻ֤�Ų���Ϊ��!";
            else
            {
                string strSql = "Select * from TT_CarInfo where DriveLicense='" + txtDriveLicense.Text.Trim() + "'";
                object obj = DbHelperSQL.GetSingle(strSql);
                if (obj != null)
                {
                    strError += "��ʻ֤���Ѿ�����!";
                }
            }
            if (cbxCarType.SelectedIndex == 0)
                strError += "��ѡ���ͺ�!";
            if (txtCarOwnerName.Text.Trim() == "")
                strError += "��������������!";
            if (txtCarOwnerIDCardNo.Text.Trim() == "")
            {
                strError += "�������֤����Ϊ��!";
            }
            else
            {
                if (txtCarOwnerIDCardNo.Text.Trim().Length == 15 || txtCarOwnerIDCardNo.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim())))
                    {

                    }
                    else
                    {
                        strError += "������ij������֤�Ÿ�ʽ����ȷ";

                    }
                }
                else
                {
                    strError += "������ij������֤�ų��Ȳ���ȷ";
                }
            }
            if (txtCarOwnerPhone.Text.Trim() == "")
                strError += "�����绰���벻��Ϊ��!";
            if (txtDriverName.Text.Trim() == "")
                strError += "��ʻԱ��������Ϊ��!";
            if (txtDriveCardID.Text.Trim() == "")
            {
                strError += "��ʻԱ���֤����Ϊ��!";
            }
            else
            {
                if (txtDriveCardID.Text.Trim().Length == 15 || txtDriveCardID.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtDriveCardID.Text.Trim())))
                    {

                    }
                    else
                    {
                        strError += "������ļ�ʻԱ���֤�Ÿ�ʽ����ȷ!";

                    }
                }
                else
                {
                    strError += "������ļ�ʻԱ���֤�ų��Ȳ���ȷ!";
                }
            }
            if (txtDriverPhone.Text.Trim() == "")
                strError += "��ʻԱ�绰���벻��Ϊ��!";
            if (txtMostWeight.Text.Trim() != "")
            {
                if (!CommonMethod.IsNumber(txtMostWeight.Text.Trim()) && !CommonMethod.IsDecimal(txtMostWeight.Text.Trim()))
                    strError += "�������ر���Ϊ��������С��!";
            }
            else
            {
                txtMostWeight.Text = "100.00";
            }
            //���� 2010.05.11 �жϳ�����Ϣ�Ǽ�Ƥ��Ϊ�����ʾ
            if (this.lblDigital.Text == "0.00" || this.lblDigital.Text == "00.00")
                strError += "�ճ���������Ϊ��!";
            #endregion

            if (strError == string.Empty)
            {
                #region ʵ���������Ǽ���Ϣ
                string strsql = "select Count(*) From TT_CarInfo Where CarNo='" + cbxCarNo.Text.Trim() + "-" + CommonMethod.ToDBC(txtCarNo.Text.Trim()).ToUpper() + "'";
                if (Convert.ToInt32(DbHelperSQL.GetSingle(strsql)) > 0)
                {
                    DialogResult dResult = CommonMethod.MessageBox("�ó�����Ϣ�Ѿ��Ǽ�,�Ƿ����¹��������³�Ƥ��Ϣ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dResult == DialogResult.No)
                    {
                        btnClear_Click(sender, e); return;
                    }
                }

                CoalTraffic.Model.TT_CarInfo model = new CoalTraffic.Model.TT_CarInfo();
                model.RoomCode = strRoomCode;
                model.EmptyWeight = Convert.ToDecimal(lblDigital.Text);
                model.MostWeight = Convert.ToDecimal(txtMostWeight.Text.Trim());
                model.CarNo = cbxCarNo.Text.Trim() + CommonMethod.ToDBC(txtCarNo.Text.Trim().Substring(0, 1) + "-" + txtCarNo.Text.Trim().Substring(1)).ToUpper();
                model.DriveLicense = CommonMethod.ToDBC(txtDriveLicense.Text.Trim());
                model.CarType = cbxCarType.Text.Trim();
                model.CarOwnerName = CommonMethod.ToDBC(txtCarOwnerName.Text.Trim());
                model.CarOwnerIDCard = CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim());
                model.CarOwnerPhone = CommonMethod.ToDBC(txtCarOwnerPhone.Text.Trim());
                model.DriverName = CommonMethod.ToDBC(txtDriverName.Text.Trim());
                model.DriverIDCard = CommonMethod.ToDBC(txtDriveCardID.Text.Trim());
                model.DriverPhone = CommonMethod.ToDBC(txtDriverPhone.Text.Trim());
                model.RandomCode = CommonMethod.getRandom(4);
                model.Operator = StaticParameter.UserName;
                model.BangType = "�Զ�����";
                if (StaticParameter.IsVideo == "1")
                {
                    if (byteFrontImage == null)
                    {
                        strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        byteFrontImage = this.dhVideo.CapturePic();

                    }
                }
                else
                {
                    model.FirstImage = "";
                    model.FirstImageContent = null;

                }
                model.CarCode = strRoomCode + DateTime.Now.ToString("yyyyMMddhhmmss");
                model.EmptyBangTime = DateTime.Now;
                #endregion

                string strEmptyCode = bll.Add(model);
                if (strEmptyCode != "")
                {

                    #region ��������ʱ������ͬ��sql��䵽��������sql��䱾��ִ��
                    if (isConnection == "0")
                    {
                        StringBuilder sbInsert = new StringBuilder();
                        sbInsert.Append("PT_CarInfo  '" + model.CarCode + "','" + model.EmptyBangTime + "','" + model.RoomCode + "','" + model.EmptyWeight + "','" + model.MostWeight + "',");
                        sbInsert.Append("'" + model.CarNo + "','" + model.CarType + "','" + model.CarOwnerName + "','" + model.CarOwnerIDCard + "','" + model.CarOwnerPhone + "',");
                        sbInsert.Append("'" + model.RandomCode + "','" + model.Operator + "','" + model.BangType + "','" + model.FirstImage + "',");
                        sbInsert.Append("null,'" + model.DriveLicense + "','" + model.DriverName + "','" + model.DriverIDCard + "','" + model.DriverPhone + "'");

                        string sqlInsertLog = "insert [NetWorkDisconnectionLog] (ID, SQLcontext, datetime, IP) values (@ID,@SQLcontext,@datetime,@IP)";
                        SqlParameter[] sqlpars = new SqlParameter[]
                        {
                            new SqlParameter("@ID",DateTime.Now.ToString("yyyyMMddHHmmss")),
                            new SqlParameter("@SQLcontext",sbInsert.ToString()),
                            new SqlParameter("@datetime",DateTime.Now.ToString()),
                            new SqlParameter("@IP",ini.IniReadValue("Connection","LServer"))
                        };
                        DbHelperSQL.ExecuteSql(sqlInsertLog,sqlpars); //����ͬ��sql���
                        DbHelperSQL.ExecuteSql2(sbInsert.ToString(), "1");//sql��䱾��ִ��
                    }
                    #endregion

                    #region ����ʱ����ӿճ�����sql���

                   if (isConnection == "1")
                        {
                            StringBuilder sbInsert = new StringBuilder();
                            sbInsert.Append("PT_CarInfo  '" + model.CarCode + "','" + model.EmptyBangTime + "','" + model.RoomCode + "','" + model.EmptyWeight + "','" + model.MostWeight + "',");
                            sbInsert.Append("'" + model.CarNo + "','" + model.CarType + "','" + model.CarOwnerName + "','" + model.CarOwnerIDCard + "','" + model.CarOwnerPhone + "',");
                            sbInsert.Append("'" + model.RandomCode + "','" + model.Operator + "','" + model.BangType + "','" + model.FirstImage + "',");
                            sbInsert.Append("null,'" + model.DriveLicense + "','" + model.DriverName + "','" + model.DriverIDCard + "','" + model.DriverPhone + "'");

                            string id = DateTime.Now.ToString("yyyyMMddHHmmss");
                            StringBuilder sbsqlcontext = new StringBuilder();
                            sbsqlcontext.Append("insert into NetWorkDisconnection (ID, SQLcontext, DateTime) values(@id,@sqlcontext,@datetime)");
                            SqlParameter[] parameters = new SqlParameter[] {
                                                                                            new SqlParameter("@id",id),
                                                                                            new SqlParameter("@sqlcontext",sbInsert.ToString()),
                                                                                            new SqlParameter("@datetime",DateTime.Now)
                                                                                             };
                            DbHelperSQL.ExecuteSql(sbsqlcontext.ToString(), parameters);
                        }
                    #endregion

                    btnClear_Click(sender, e);  //�������
                    this.alarmSound.Alarm("������Ϣ�Ǽdzɹ�,��ʼ��ӡ������Ϣ����");

                    #region ��ӡ���
                    Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                    string strFileName = "";
                    if (StaticParameter.ReportFile == "FuYuan.")
                    {
                        strFileName = "ZiChang.";
                    }
                    else
                    {
                        strFileName = StaticParameter.ReportFile;
                    }

                    Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "EmptyWeightPrint");
                    object obj = Activator.CreateInstance(type, strEmptyCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                    #endregion
                }
                else
                {
                    if (isConnection == "0")
                    {
                        ini.IniWriteValue("Connection", "isConnection", CommonMethod.ToDBC("1"));
                        MessageBox.Show("ϵͳ��������Ͽ����ӣ�����ϵ���Ļ�����");
                        Application.ExitThread();
                        Application.Exit();
                    }
                    else
                    {
                        alarmSound.Alarm("��վ�����ݿ��쳣");
                        InsertState = 0;
                        InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strRoomName + "�����ݿ��쳣");
                    }
                }

            }
            else
            {
                alarmSound.Alarm(strError);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            #region ������������֤
            string strError = string.Empty;
            //if (cbxCarNo.SelectedValue.ToString() == "")
            //{

            //    alarmSound.Alarm("ʡ�����Ʋ���Ϊ��!");
            //    return;
            //}

            if (txtCarNo.Text.Trim() == "")
            {
                alarmSound.Alarm("���ƺŲ���Ϊ��!");
                return;
            }
            else
            {

                string strSql = "Select * from TT_CarInfo where CarNo='" + txtCarNo.Text.Trim() + "'";
                object obj = DbHelperSQL.GetSingle(strSql);
                if (obj != null)
                {
                    alarmSound.Alarm("�ó��ƺ��Ѿ�����!");
                    CommonMethod.MessageBox("�ó��ƺ��Ѿ�����!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }

            }

            if (txtDriveLicense.Text.Trim() == "")
            {
                alarmSound.Alarm("��ʻ֤�Ų���Ϊ��!");
                return;
            }
            else
            {
                string strSql = "Select * from TT_CarInfo where DriveLicense='" + txtDriveLicense.Text.Trim() + "'";
                object obj = DbHelperSQL.GetSingle(strSql);
                if (obj != null)
                {
                    alarmSound.Alarm("��ʻ֤���Ѿ�����!");
                    CommonMethod.MessageBox("��ʻ֤���Ѿ�����!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
            }
            if (txtCarType.Text.Trim() == "")
            {
                alarmSound.Alarm("���ͺŲ���Ϊ��");
                return;
            }
            if (txtCarOwnerName.Text.Trim() == "")
            {
                alarmSound.Alarm("��������������!");
                return;
            }
            if (txtCarOwnerIDCardNo.Text.Trim() == "")
            {
                alarmSound.Alarm("�������֤����Ϊ��!");
                return;
            }
            else
            {
                if (txtCarOwnerIDCardNo.Text.Trim().Length == 15 || txtCarOwnerIDCardNo.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim())))
                    {

                    }
                    else
                    {
                        alarmSound.Alarm("������ij������֤�Ÿ�ʽ����ȷ");
                        CommonMethod.MessageBox("������ij������֤�Ÿ�ʽ����ȷ!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;

                    }
                }
                else
                {
                    alarmSound.Alarm("������ij������֤�ų��Ȳ���ȷ");
                    CommonMethod.MessageBox("������ij������֤�ų��Ȳ���ȷ!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
            }
            if (txtCarOwnerPhone.Text.Trim() == "")
            {
                alarmSound.Alarm("�����绰���벻��Ϊ��!");
                return;
            }
            if (txtDriverName.Text.Trim() == "")
            {
                alarmSound.Alarm("��ʻԱ��������Ϊ��!");
                return;
            }
            if (txtDriveCardID.Text.Trim() == "")
            {
                alarmSound.Alarm("��ʻԱ���֤����Ϊ��!");
                return;
            }
            else
            {
                if (txtDriveCardID.Text.Trim().Length == 15 || txtDriveCardID.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtDriveCardID.Text.Trim())))
                    {

                    }
                    else
                    {
                        alarmSound.Alarm("������ļ�ʻԱ���֤�Ÿ�ʽ����ȷ!");
                        CommonMethod.MessageBox("������ļ�ʻԱ���֤�Ÿ�ʽ����ȷ!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;

                    }
                }
                else
                {
                    alarmSound.Alarm("������ļ�ʻԱ���֤�ų��Ȳ���ȷ!");
                    CommonMethod.MessageBox("������ļ�ʻԱ���֤�ų��Ȳ���ȷ!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
            }
            if (txtDriverPhone.Text.Trim() == "")
            {
                alarmSound.Alarm("��ʻԱ�绰���벻��Ϊ��!");
                return;
            }
            if (txtMostWeight.Text.Trim() != "")
            {
                if (!CommonMethod.IsNumber(txtMostWeight.Text.Trim()) && !CommonMethod.IsDecimal(txtMostWeight.Text.Trim()))
                {
                    alarmSound.Alarm("�������ر���Ϊ��������С��!");
                    return;
                }
            }
            else
            {
                txtMostWeight.Text = "100.00";
            }
            //���� 2010.05.11 �жϳ�����Ϣ�Ǽ�Ƥ��Ϊ�����ʾ
            if (this.lblDigital.Text == "0.00" || this.lblDigital.Text == "00.00")
            {
                alarmSound.Alarm("�ճ���������Ϊ��!");
                return;
            }
            #endregion

            if (strError == string.Empty)
            {
                #region ʵ�����ճ�������Ϣ
                string strsql = "select Count(*) From TT_CarInfo Where CarNo='" + CommonMethod.ToDBC(txtCarNo.Text.Trim()).ToUpper() + "'";
                if (Convert.ToInt32(DbHelperSQL.GetSingle(strsql)) > 0)
                {
                    DialogResult dResult = CommonMethod.MessageBox("�ó�����Ϣ�Ѿ��Ǽ�,�Ƿ����¹��������³�Ƥ��Ϣ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dResult == DialogResult.No)
                    {
                        btnClear_Click(sender, e); return;
                    }
                }

                CoalTraffic.Model.TT_CarInfo model = new CoalTraffic.Model.TT_CarInfo();
                model.RoomCode = strRoomCode;
                model.EmptyWeight = Convert.ToDecimal(lblDigital.Text);
                model.MostWeight = Convert.ToDecimal(txtMostWeight.Text.Trim());
                model.CarNo = txtCarNo.Text.Trim().ToUpper();
                model.DriveLicense = CommonMethod.ToDBC(txtDriveLicense.Text.Trim());
                model.CarType = txtCarType.Text.Trim();
                model.CarOwnerName = CommonMethod.ToDBC(txtCarOwnerName.Text.Trim());
                model.CarOwnerIDCard = CommonMethod.ToDBC(txtCarOwnerIDCardNo.Text.Trim());
                model.CarOwnerPhone = CommonMethod.ToDBC(txtCarOwnerPhone.Text.Trim());
                model.DriverName = CommonMethod.ToDBC(txtDriverName.Text.Trim());
                model.DriverIDCard = CommonMethod.ToDBC(txtDriveCardID.Text.Trim());
                model.DriverPhone = CommonMethod.ToDBC(txtDriverPhone.Text.Trim());
                model.RandomCode = CommonMethod.getRandom(4);
                model.Operator = StaticParameter.UserName;
                model.BangType = strBangType + "����";
                if (StaticParameter.IsVideo == "1")
                {
                    if (byteFrontImage == null)
                    {
                       // strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        byteFrontImage = this.dhVideo.CapturePic();

                    }
                }
                else
                {
                    model.FirstImage = "";
                    model.FirstImageContent = null;

                }
                model.CarCode = strRoomCode + DateTime.Now.ToString("yyyyMMddhhmmss");
                model.EmptyBangTime = DateTime.Now;
                #endregion

                string strEmptyCode = bll.Add(model);
                if (strEmptyCode != "")
                {
                    //MSMQClient MC = new MSMQClient();

                    #region �������ϴ���������
                    StringBuilder sbInsert = new StringBuilder();

                    sbInsert.Append("PT_CarInfo  '" + model.CarCode + "','" + model.EmptyBangTime + "','" + model.RoomCode + "','" + model.EmptyWeight + "','" + model.MostWeight + "',");
                    sbInsert.Append("'" + model.CarNo + "','" + model.CarType + "','" + model.CarOwnerName + "','" + model.CarOwnerIDCard + "','" + model.CarOwnerPhone + "',");
                    sbInsert.Append("'" + model.RandomCode + "','" + model.Operator + "','" + model.BangType + "','" + model.FirstImage + "',");
                    sbInsert.Append("null,'" + model.DriveLicense + "','" + model.DriverName + "','" + model.DriverIDCard + "','" + model.DriverPhone + "'");
                    //MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_CarInfo" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + sbInsert.ToString());

                    ////����ͼƬ
                    //string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                    //int iSend = MC.ServerStation;
                    ////�Ƿ��Ͱ���
                    //if (strIsSendPicToRoom == "1")
                    //    iSend = MC.AllStation;
                    //string strPic = "";
                    //if (model.FirstImageContent != null)
                    //{
                    //    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                    //        + model.FirstImage + ",jpg," + Convert.ToBase64String(model.FirstImageContent, 0, model.FirstImageContent.Length);
                    //    MC.AddNewSqlText(strPic);
                    //}

                    #endregion

                    btnClear_Click(sender, e);  //�������
                    this.alarmSound.Alarm("�ճ������ɹ�,��ʼ��ӡ�ճ���������");
                    isks = true;

                    Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                    string strFileName = "";
                    if (StaticParameter.ReportFile == "FuYuan.")
                    {
                        strFileName = "ZiChang.";
                    }
                    else
                    {
                        strFileName = StaticParameter.ReportFile;
                    }

                    Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "EmptyWeightPrint");
                    object obj = Activator.CreateInstance(type, strEmptyCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                }
                else
                {
                    alarmSound.Alarm("��վ�����ݿ��쳣");
                    InsertState = 0;
                    InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strRoomName + "�����ݿ��쳣");
                }

            }
            else
            {
                alarmSound.Alarm(strError);
            }
        }