private void FrmMain_KeyDown(object sender, KeyEventArgs e) { if (_lock==false) { if (e.Control && e.KeyCode == Keys.Enter) btn_Start_Submit_Click(null, null); if (e.Control && e.KeyCode == Keys.PageUp) UcPictureBox1.btn_Xoaytrai_Click(null, null); if (e.Control && e.KeyCode == Keys.PageDown) UcPictureBox1.btn_xoayphai_Click(null, null); if (e.KeyCode == Keys.Escape) { new FrmFreeTime().ShowDialog(); Global.DbBpo.UpdateTimeFree(Global.StrToken, Global.FreeTime); } } }
public string GetImage() { if (Global.StrRole == "DESO") { string temp = (from w in Global.Db.tbl_MissImage_DESOs where w.fBatchName == Global.StrBatch && w.UserName == Global.StrUsername && w.Submit == 0 select w.IdImage).FirstOrDefault(); if (string.IsNullOrEmpty(temp)) { try { var getFilename = (from w in Global.Db.LayHinhMoi_DeSo(Global.StrBatch, Global.StrUsername) select w.Column1).FirstOrDefault(); if (string.IsNullOrEmpty(getFilename)) { return("NULL"); } lb_IdImage.Text = getFilename; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + getFilename, getFilename, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return("Error"); } UcNatsu1.UcNatsuItem1.txt_TruongSo01.Focus(); } catch (Exception) { return("NULL"); } } else { lb_IdImage.Text = temp; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + temp, temp, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return("Error"); } UcNatsu1.UcNatsuItem1.txt_TruongSo01.Focus(); } } return("OK"); }
public string GetImage() { LockControl(true); var ktUser = (from w in Global.DbBpo.tbl_Users where w.Username == Global.StrUsername select w.NotGoodUser).FirstOrDefault(); Global.NotGoodUser = ktUser == true; if (Global.StrRole == "DESO") { if (Global.BatchChiaUser) { if (Global.NotGoodUser) { string temp = (from w in Global.Db.tbl_MissImage_DESOs where w.fBatchName == Global.StrBatch && w.UserName == Global.StrUsername && w.Submit == 0 select w.IdImage).FirstOrDefault(); if (string.IsNullOrEmpty(temp)) { try { var getFilename = (from w in Global.Db.GetImage_Group_Notgood(Global.StrBatch, Global.StrUsername) select w.Column1).FirstOrDefault(); if (string.IsNullOrEmpty(getFilename)) { return "NULL"; } lb_IdImage.Text = getFilename; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + getFilename, getFilename, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } catch (Exception i) { //LogFile.WriteLog(Global.StrUsername + ".txt", i.Message); return "NULL"; } } else { lb_IdImage.Text = temp; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + temp, temp, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } } else { string temp = (from w in Global.Db.tbl_MissImage_DESOs where w.fBatchName == Global.StrBatch && w.UserName == Global.StrUsername && w.Submit == 0 select w.IdImage).FirstOrDefault(); if (string.IsNullOrEmpty(temp)) { try { var getFilename = (from w in Global.Db.GetImage_Group_Good(Global.StrBatch, Global.StrUsername) select w.Column1).FirstOrDefault(); if (string.IsNullOrEmpty(getFilename)) { return "NULL"; } lb_IdImage.Text = getFilename; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + getFilename, getFilename, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } catch (Exception i) { //LogFile.WriteLog(Global.StrUsername + ".txt", i.Message); return "NULL"; } } else { lb_IdImage.Text = temp; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + temp, temp, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } } } else { string temp = (from w in Global.Db.tbl_MissImage_DESOs where w.fBatchName == Global.StrBatch && w.UserName == Global.StrUsername && w.Submit == 0 select w.IdImage).FirstOrDefault(); if (string.IsNullOrEmpty(temp)) { try { var getFilename = (from w in Global.Db.LayHinhMoi_DeSo(Global.StrBatch, Global.StrUsername) select w.Column1).FirstOrDefault(); if (string.IsNullOrEmpty(getFilename)) { return "NULL"; } lb_IdImage.Text = getFilename; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + getFilename, getFilename, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } catch (Exception i) { //LogFile.WriteLog(Global.StrUsername + ".txt", i.Message); return "NULL"; } } else { lb_IdImage.Text = temp; UcPictureBox1.imageBox1.Image = null; if (UcPictureBox1.LoadImage(Global.Webservice + Global.StrBatch + "/" + temp, temp, Settings.Default.ZoomImage) == "Error") { UcPictureBox1.imageBox1.Image = Resources.svn_deleted; return "Error"; } } } UcNatsu1.UcNatsuItem1.txt_TruongSo01.Focus(); } timer1.Enabled = true; return "OK"; }