예제 #1
0
        private void frmFunSet_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;//去掉窗体边框

            try
            {
                string setValue = SetConfig.GetValue("ScanDrive");
                _twain = new Twain(new WinFormsWindowMessageHook(this));
                List <DictionaryEntry> listDS = _twain.GetAllSources().Select(x => new DictionaryEntry()
                {
                    Key = x.SourceId.ProductName, Value = x.SourceId.ProductName + " " + x.SourceId.Version.Info
                }).ToList();
                int index = listDS.FindIndex(x => x.Key.ToString() == setValue);
                dgvCompany.DataSource = listDS;

                if ((dgvCompany.DataSource as List <DictionaryEntry>) != null && (dgvCompany.DataSource as List <DictionaryEntry>).Count > 0)
                {
                    dgvCompany.ClearSelection();
                }
                if (index >= 0)
                {
                    dgvCompany.Rows[index].Selected = true;
                    dgvCompany.CurrentCell          = this.dgvCompany.Rows[index].Cells[1];
                }
            }
            catch (Exception)
            {
                //MessageBox.Show("未检测到有扫描仪驱动!");
            }
        }
예제 #2
0
 private void btnSure_Click(object sender, EventArgs e)
 {
     try
     {
         if ((dgvCompany.DataSource as List <DictionaryEntry>) != null && (dgvCompany.DataSource as List <DictionaryEntry>).Count > 0)
         {
             string cellvalue = dgvCompany.Rows[dgvCompany.CurrentRow.Index].Cells["keys"].Value.ToString();
             if (cellvalue != null)
             {
                 SetConfig.setValue("ScanDrive", cellvalue);
                 this.DialogResult = DialogResult.OK;
                 this.Close();
             }
             else
             {
                 MessageBox.Show("未选择扫描仪器");
             }
         }
         else
         {
             MessageBox.Show("请选择扫描仪类型!!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #3
0
 public void login()
 {
     if (!string.IsNullOrEmpty(txtName.Text.Replace("\r", "").Replace("\n", "")) && !string.IsNullOrEmpty(txtPwd.Text.Replace("\r", "").Replace("\n", "")))
     {
         string str = getXmlStr(txtName.Text.Replace("\r", "").Replace("\n", ""), txtPwd.Text.Replace("\r", "").Replace("\n", "")).Replace("\r", "").Replace("\n", "");
         if (str != "0" && !string.IsNullOrEmpty(str))
         {
             TestData jobj  = JsonConvert.DeserializeObject <TestData>(str);
             string   times = SetConfig.GetValue("times");
             if (!string.IsNullOrEmpty(times))
             {
                 if (Convert.ToInt32(times) < Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd")))
                 {
                     SetConfig.setValue("times", DateTime.Now.ToString("yyyyMMdd"));
                     SetConfig.setValue("todayBillNum", "0");
                 }
             }
             else
             {
                 SetConfig.setValue("times", DateTime.Now.ToString("yyyyMMdd"));
                 SetConfig.setValue("todayBillNum", "0");
             }
             string      todayBillNum = SetConfig.GetValue("todayBillNum");
             frmScanMain fsm          = new frmScanMain();
             fsm.telephone   = jobj.telephone;
             fsm.userPicUrl  = jobj.userPicUrl;
             fsm.listCI      = jobj.comInfoList;
             fsm.userName    = jobj.userName;
             fsm.label4.Text = todayBillNum + "张";
             this.Hide();
             fsm.Show();
         }
         else
         {
             this.txtPwd.Text = string.Empty;
             MessageBox.Show("用户名或密码错误");
         }
     }
     else
     {
         MessageBox.Show("请输入用户名或密码");
     }
 }