private void btnStart_Click(object sender, EventArgs e) { if (txtEmployee.Text == "") { frm_MessageWarning warning = new frm_MessageWarning(); warning.index = 1; warning.ShowDialog(); } else { if (txtProduct.Text == "") { frm_MessageWarning warning = new frm_MessageWarning(); warning.index = 2; warning.ShowDialog(); } else { Status(true); //txtLot.Text = (int.Parse(GetLot()) + 1).ToString(); txtDeff.Text = def.ToString(); txtOK.Text = ok.ToString(); txtTotal.Text = total.ToString(); txtMix.Text = mix.ToString(); keycode_ = GetKey(); lbStartTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); txtCodeCheck.Focus(); } } }
private void frm_InputData_FormClosing(object sender, FormClosingEventArgs e) { if (txtTotal.Text.Trim() != "0") { frm_MessageWarning frmwraning = new frm_MessageWarning(); frmwraning.index = 4; frmwraning.ShowDialog(); e.Cancel = true; } }
private void btnEditData_Click(object sender, EventArgs e) { if (dgvData.Rows.Count > 0) { frm_EditDeff frmdef = new frm_EditDeff(); frmdef.keycode = dgvData.CurrentRow.Cells["colkeycode"].Value.ToString(); frmdef.ShowDialog(); LoadData(); } else { frm_MessageWarning warning = new frm_MessageWarning(); warning.index = 5; warning.ShowDialog(); } }
private void frm_EditDeff_Load(object sender, EventArgs e) { string servername_ = tool.Read(pathfile, "DataBase", "Server"); string database_ = tool.Read(pathfile, "DataBase", "DataBase"); string user_ = tool.Read(pathfile, "DataBase", "User"); conn = new ConnectSQL(servername_, database_, user_); frm = this; if (keycode != "") { string sql = "select Wodate,shift,keycode,modelcode,goodqty,defqty,mixqty,total,starttime,endtime,linename,empname from tb_datachecked where keycode='" + keycode + "'"; DataTable dt = conn.GetDataTable(sql); if (dt.Rows.Count == 1) { try { txtdef.Text = dt.Rows[0]["defqty"].ToString(); int.TryParse(txtdef.Text, out deftmp); txtempname.Text = dt.Rows[0]["empname"].ToString(); txtendtime.Text = dt.Rows[0]["endtime"].ToString(); txtgood.Text = dt.Rows[0]["goodqty"].ToString(); txtkeycode.Text = dt.Rows[0]["keycode"].ToString(); txtlinename.Text = dt.Rows[0]["linename"].ToString(); txtmix.Text = dt.Rows[0]["mixqty"].ToString(); txtmodelcode.Text = dt.Rows[0]["modelcode"].ToString(); txtshift.Text = dt.Rows[0]["shift"].ToString(); txtstarttime.Text = dt.Rows[0]["starttime"].ToString(); txttotal.Text = dt.Rows[0]["total"].ToString(); int.TryParse(txttotal.Text, out totaltmp); txtwodate.Text = dt.Rows[0]["wodate"].ToString(); } catch { frm_MessageWarning warning = new frm_MessageWarning(); warning.index = 6; warning.ShowDialog(); } } } GetAllControls(this); foreach (Control c in ControlList) { tool.TranslateControl(this, c, tool.GetLanguage(tool.Read(pathfile, "Infor", "Language"))); } }
private void btnInputData_Click(object sender, EventArgs e) { if (cboShift.Text == "" || cboShift.Text == "-ALL-") { frm_MessageWarning warning = new frm_MessageWarning(); warning.index = 0; warning.ShowDialog(); } else { frm_InputData frm1 = new frm_InputData(); frm1.shift = cboShift.Text; frm1.line = txtLine.Text; frm.Hide(); frm1.ShowDialog(); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtTotal.Text != "0") { WriteData(keycode_, DateTime.Now.ToString("yyyyMMdd"), GetWorkDateTime(), linecode, linename, txtShift.Text, txtEmployee.Text, txtProduct.Text.Trim().ToUpper(), RemoveChar(txtTotal.Text), RemoveChar(txtOK.Text), RemoveChar(txtMix.Text), RemoveChar(txtDeff.Text), lbStartTime.Text, endtime); keycode_ = GetKey(keycode_); ok = 0; total = 0; mix = 0; def = 0; lbCodeTempl.Text = ""; txtDeff.Text = def.ToString(); txtOK.Text = ok.ToString(); txtTotal.Text = total.ToString(); txtMix.Text = mix.ToString(); cboDef.Checked = false; txtDeff.ReadOnly = true; LoadData(); } else { frm_MessageWarning frmwraning = new frm_MessageWarning(); frmwraning.index = 5; frmwraning.ShowDialog(); } }