public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // mLogCallback = new LogCallback(LogCallback); mKey = Registry.CurrentUser.CreateSubKey(@"Software\Earlab\DesktopEarlabGUI"); mModuleDirectory = new RegistryString(mKey, "ModuleDirectory", null); mOutputDirectory = new RegistryString(mKey, "OutputDirectory", null); mDiagramFile = new RegistryString(mKey, "RunParameterFile", null); mParameterFile = new RegistryString(mKey, "ModuleParameterFile", null); mFrameCount = new RegistryInt(mKey, "FrameCount", 0); udFrameCount.Value = mFrameCount.Value; mWindowState = new RegistryFormWindowState(mKey, "WindowState", FormWindowState.Normal); mWindowLocation = new RegistryPoint(mKey, "WindowLocation", this.Location); mWindowSize = new RegistrySize(mKey, "WindowSize", this.MinimumSize); this.Location = mWindowLocation.Value; this.Size = mWindowSize.Value; this.WindowState = mWindowState.Value; udFrameCount.Focus(); UpdateStatusDisplay(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(ttb.get_data("select max(stt) from ttb_dmbhyt").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } chitra.Value = 0; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { id = 0; try { stt.Value = decimal.Parse(m.get_data("select max(stt) from " + user + ".dmtheodoi").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } ten.Text = ""; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(ttb.get_data("select max(stt) from " + user + ".ttb_loaiphieu where nhom=" + i_nhom).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ten.Text = ""; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(m.get_data("select max(stt) from " + user + "." + sql.SelectedValue.ToString().Trim()).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } i_id = 0; ma.Text = ""; ten.Text = ""; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(d.get_data("select max(stt) from " + user + ".d_dmvay").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ten.Text = ""; thanhpho.Checked = false; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(v.get_data("select max(stt) from " + user + ".ct_giavp where id_loai=" + decimal.Parse(nhom.SelectedValue.ToString())).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ma.Text = ""; ten.Text = ""; ghichu.Text = ""; makp.SelectedIndex = -1; gia_nv.Text = "0"; gia_ngv.Text = "0"; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(d.get_data("select max(stt) from " + user + ".d_dmnhomkho").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ten.Text = ""; nhomcc.SelectedIndex = -1; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(d.get_data("select max(stt) from " + user + "." + table).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } bEdit = false; ma.Text = ""; ten.Text = ""; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { id = 0; try { stt.Value = decimal.Parse(m.get_data("select max(stt) from " + s_user + ".dmphong where makp='" + makp.SelectedValue.ToString() + "'").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } ma.Text = ""; ten.Text = ""; ena_object(true); stt.Focus(); }
/// <summary> /// /// </summary> /// <returns></returns> private bool validateInput() { if (rdoLandscape.Checked) { if (txtWidth.Value < txtLeftMargin.Value + txtRightMargin.Value) { MessageBox.Show( this, PrintingResources.MargeMoreThanPageWidth, this.Text); txtWidth.Focus(); return(false); } if (txtHeight.Value < txtTopMargin.Value + txtBottomMargin.Value) { MessageBox.Show( this, PrintingResources.MargeMoreThanPageHeight, this.Text); txtWidth.Focus(); return(false); } } else { if (txtHeight.Value < txtLeftMargin.Value + txtRightMargin.Value) { MessageBox.Show( this, PrintingResources.MargeMoreThanPageWidth, this.Text); txtWidth.Focus(); return(false); } if (txtWidth.Value < txtTopMargin.Value + txtBottomMargin.Value) { MessageBox.Show( this, PrintingResources.MargeMoreThanPageHeight, this.Text); txtWidth.Focus(); return(false); } } return(true); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(ttb.get_data("select max(stt) from " + user + ".ttb_dmnhom where nhom=" + i_nhom).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ten.Text = ""; chkTheodoi.Checked = false; nhomcc.SelectedIndex = -1; nhomin.SelectedIndex = -1; //nhomvp.SelectedIndex=-1; ena_object(true); stt.Focus(); }
private void butSua_Click(object sender, System.EventArgs e) { Cursor = Cursors.WaitCursor; int i = Convert.ToInt16(tu.Value), j = Convert.ToInt16(den.Value), stt = Convert.ToInt16(tt.Value); if (i > j && j != 0) { tu.Focus(); return; } string sql = "true"; if (i + j > 0) { if (j == 0) { sql = "stt>=" + i; } else { sql = "stt>=" + i + " and stt<=" + j; } } foreach (DataRow r in dt.Select(sql)) { r["stt"] = stt; ttb.execute_data("update ttb_dmbd set stt=" + stt + " where id=" + int.Parse(r["id"].ToString())); stt++; } Cursor = Cursors.Default; }
private bool kiemtra() { if (tu.Value > den.Value) { MessageBox.Show( lan.Change_language_MessageText("Tháng không hợp lệ !"), d.Msg); tu.Focus(); return(false); } s_makho = ""; if (kho.CheckedItems.Count == 0) { for (int i = 0; i < kho.Items.Count; i++) { kho.SetItemCheckState(i, CheckState.Checked); } } for (int i = 0; i < kho.Items.Count; i++) { if (kho.GetItemChecked(i)) { s_makho += dtkho.Rows[i]["id"].ToString() + ","; } } dtdmkho = d.get_data("select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom + " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ") order by stt").Tables[0]; Tao_dataset(); s_mmyy = tu.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2); s_tu = tu.Value.ToString().PadLeft(2, '0'); s_den = den.Value.ToString().PadLeft(2, '0'); s_yy = yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2); // int y1 = int.Parse(yyyy.Value.ToString()), m1 = int.Parse(tu.Value.ToString()); int y2 = int.Parse(yyyy.Value.ToString()), m2 = int.Parse(den.Value.ToString()); int itu, iden; string mmyy = ""; for (int i = y1; i <= y2; i++) { itu = (i == y1)?m1:1; iden = (i == y2)?m2:12; for (int j = itu; j <= iden; j++) { mmyy = j.ToString().PadLeft(2, '0') + i.ToString().Substring(2, 2); if (d.bMmyy(mmyy)) { get_nhap(mmyy); } } } // if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show( lan.Change_language_MessageText("Không có số liệu !"), d.Msg); return(false); } return(true); }
private void _updateCheckBox_CheckedChanged(object sender, System.EventArgs e) { _fakeTextBox.Visible = !(_hoursBox.Enabled = _updateCheckBox.Checked); if (_hoursBox.Enabled) { _hoursBox.Focus(); } }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // mModuleKey = Registry.LocalMachine.CreateSubKey(@"Software\EarLab"); mApplicationKey = Registry.CurrentUser.CreateSubKey(@"Software\EarLab\EarLab GUI"); mLogCallback = new LogCallback(LogCallback); mModuleDirectory = new RegistryString(mModuleKey, "ModulesPath", @"C:\Program Files\EarLab\Modules"); mInputDirectory = new RegistryString(mApplicationKey, "InputDirectory", System.Environment.ExpandEnvironmentVariables("%USERPROFILE%") + @"\My Documents\EarLab\Signals"); mOutputDirectory = new RegistryString(mApplicationKey, "OutputDirectory", System.Environment.ExpandEnvironmentVariables("%USERPROFILE%") + @"\My Documents\EarLab\Output"); mDiagramFile = new RegistryString(mApplicationKey, "RunParameterFile", null); mParameterFile = new RegistryString(mApplicationKey, "ModuleParameterFile", null); mFrameCount = new RegistryInt(mApplicationKey, "FrameCount", 0); mEnableSuperuserMode = new RegistryBool(mApplicationKey, "SuperuserMode", false); udFrameCount.Value = mFrameCount.Value; mWindowState = new RegistryFormWindowState(mApplicationKey, "WindowState", FormWindowState.Normal); mWindowLocation = new RegistryPoint(mApplicationKey, "WindowLocation", this.Location); mWindowSize = new RegistrySize(mApplicationKey, "WindowSize", this.MinimumSize); this.Location = mWindowLocation.Value; this.Size = mWindowSize.Value; this.WindowState = mWindowState.Value; if (mEnableSuperuserMode.Value) { menuEnvironment.Enabled = true; menuEnvironment.Visible = true; menuFileOpenDiagram.Enabled = true; menuFileOpenDiagram.Visible = true; menuFileOpenParameters.Enabled = true; menuFileOpenParameters.Visible = true; menuFileSeparator.Enabled = true; menuFileSeparator.Visible = true; } udFrameCount.Focus(); UpdateStatusDisplay(); }
private void NumericUpDown2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)27) { NumericUpDown3.Focus(); NumericUpDown3.Select(0, NumericUpDown3.Text.Length); } }
private void butMoi_Click(object sender, System.EventArgs e) { if (dt.Rows.Count == 0) { DataRow r1; foreach (DataRow r in m.get_data("select * from " + user + ".cls_loai order by id").Tables[0].Rows) { r1 = dt.NewRow(); r1["id"] = r["id"].ToString(); r1["ten"] = r["ten"].ToString(); r1["so"] = 0; dt.Rows.Add(r1); } } ena_object(true); mm.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { if (phong.SelectedIndex == -1) { phong.Focus(); return; } id = 0; try { stt.Value = decimal.Parse(m.get_data("select max(stt) from " + user + ".dmgiuong where idphong=" + int.Parse(phong.SelectedValue.ToString())).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } ma.Text = dtp.Rows[phong.SelectedIndex]["ma"].ToString().Trim() + "-" + stt.Value.ToString().Trim(); ten.Text = ""; gia_th.Text = ""; gia_bh.Text = ""; gia_cs.Text = ""; gia_dv.Text = ""; gia_nn.Text = ""; chkChenhlech.Checked = false; ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { if (sql.SelectedValue.ToString().Trim().ToLower() == "dmkhudt" && !bAdminHethong) { MessageBox.Show(lan.Change_language_MessageText("Bạn chưa được phân quyền để khai báo danh mục này.")); return; } try { stt.Value = decimal.Parse(m.get_data("select max(stt) from " + user + "." + sql.SelectedValue.ToString().Trim()).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } i_id = 0; ma.Text = ""; ten.Text = ""; ena_object(true); stt.Focus(); }
private void butSua_Click(object sender, System.EventArgs e) { if (dt.Rows.Count == 0) { return; } i_id = int.Parse(dataGrid1[dataGrid1.CurrentCell.RowNumber, 0].ToString()); ena_object(true); stt.Focus(); }
private void butMoi_Click(object sender, System.EventArgs e) { if (bKhoa_phanloai) { MessageBox.Show(lan.Change_language_MessageText("Danh mục này không được thêm mới hay chỉnh sửa.")); return; } try { stt.Value = decimal.Parse(d.get_data("select max(stt) from " + user + ".d_dmloai where nhom=" + i_nhom).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } l_id = 0; ten.Text = ""; chkCaptoa.Checked = true; nhomcc.SelectedIndex = -1; ena_object(true); stt.Focus(); }
private void Button1_Click(System.Object sender, System.EventArgs e) { if (!(NumericUpDown1.Value > 0)) { MessageBox.Show("数量不能小于或等于0"); NumericUpDown1.Focus(); NumericUpDown1.Select(0, NumericUpDown1.Text.Length); return; } this.DialogResult = DialogResult.OK; }
private void butOk_Click(object sender, System.EventArgs e) { mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2); i_makho = int.Parse(makho.SelectedValue.ToString()); tenkho = makho.Text; s_ngay = ngay.Text; if (!d.bMmyy(mmyy)) { MessageBox.Show(lan.Change_language_MessageText("Số liệu tháng") + " " + mmyy.Substring(0, 2) + " " + lan.Change_language_MessageText("năm 20") + mmyy.Substring(2) + " " + lan.Change_language_MessageText("chưa tạo !"), d.Msg); mm.Focus(); return; } bool bKhoaso = d.bKhoaso(i_nhom, mmyy); if (bKhoaso) { MessageBox.Show(lan.Change_language_MessageText("Số liệu tháng") + " " + mmyy.Substring(0, 2) + " " + lan.Change_language_MessageText("đã khóa"), d.Msg); mm.Focus(); return; } d.close(); this.Close(); }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(ttb.get_data("select max(stt) from " + user + ".ttb_nhomkhoa").Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } i_id = 0; ma.Text = ""; ten.Text = ""; for (int k = 0; k < makp.Items.Count; k++) { makp.SetItemCheckState(k, CheckState.Unchecked); } for (int k = 0; k < nhomkho.Items.Count; k++) { nhomkho.SetItemCheckState(k, CheckState.Unchecked); } ena_object(true); stt.Focus(); }
private void butOk_Click(object sender, System.EventArgs e) { if (!kiemtra()) { return; } s_mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2); if (!m.bMmyy(s_mmyy)) { MessageBox.Show(lan.Change_language_MessageText("Số liệu tháng") + " " + mm.Value.ToString() + "/" + yyyy.Value.ToString() + " " + lan.Change_language_MessageText("chưa tạo !"), LibMedi.AccessData.Msg); mm.Focus(); return; } s_makp = makp.SelectedValue.ToString(); s_ngay = ngay.Text; s_tenkp = makp.Text; s_phieu = phieu.Text; i_phieu = int.Parse(phieu.SelectedValue.ToString()); dt = m.get_data("select a.id,a.makp,b.tenkp from " + user + s_mmyy + ".di_duyet a," + user + ".btdkp_bv b where a.makp=b.makp and to_char(a.ngay,'dd/mm/yyyy')='" + ((s_ngay.Length > 10) ? s_ngay.Substring(0, 10) : s_ngay) + "' and a.phieu=" + i_phieu + " and a.makp='" + makp.SelectedValue.ToString() + "'").Tables[0]; l_duyet = (dt.Rows.Count == 0)?0:decimal.Parse(dt.Rows[0][0].ToString()); string ngayt = m.DateToString("dd/MM/yyyy", m.StringToDate("01/" + mm.Value.ToString().PadLeft(2, '0') + "/" + yyyy.Value.ToString().PadLeft(4, '0')).AddMonths(-1)); string mmyyt = m.mmyy(ngayt); if (m.bMmyy(mmyyt)) { sql = "select a.* from " + user + mmyyt + ".di_kthucdonll a," + user + mmyyt + ".di_duyet b "; sql += " where a.idduyet=b.id "; sql += " and to_char(ngay,'dd/mm/yyyy')='" + s_ngay + "'"; sql += " and phieu=" + i_phieu + " and makp='" + makp.SelectedValue.ToString() + "'"; if (m.get_data(sql).Tables[0].Rows.Count > 0) { MessageBox.Show(lan.Change_language_MessageText("Đã nhập trong tháng") + " " + mmyyt.Substring(0, 2) + " năm 20" + mmyyt.Substring(2, 2), LibMedi.AccessData.Msg); mm.Value = decimal.Parse(mmyyt.Substring(0, 2)); yyyy.Value = decimal.Parse("20" + mmyyt.Substring(2, 2)); mm.Focus(); return; } } m.close(); this.Close(); }
private void butOk_Click(object sender, System.EventArgs e) { mmyy = mm.Value.ToString().PadLeft(2, '0') + yyyy.Value.ToString().PadLeft(4, '0').Substring(2, 2); if (!ttb.bMmyy(mmyy)) { MessageBox.Show("Số liệu tháng " + mmyy.Substring(0, 2) + " năm 20" + mmyy.Substring(2) + " chưa tạo !", ttb.Msg); mm.Focus(); return; } xxx = user;//+ mmyy; if (ttb.bKhoaso(i_nhom, mmyy)) { MessageBox.Show("Số liệu tháng " + mmyy.Substring(0, 2) + " năm " + mmyy.Substring(2, 2) + "\nĐã khóa không có phép thay đổi !", ttb.Msg); return; } if (makho.CheckedItems.Count == 0) { for (int i = 0; i < makho.Items.Count; i++) { makho.SetItemCheckState(i, CheckState.Checked); } } s_tenkho = ""; for (int i = 0; i < makho.Items.Count; i++) { if (makho.GetItemChecked(i)) { s_tenkho += dtkho.Rows[i]["ten"].ToString() + "\n"; } } if (MessageBox.Show("Bạn có đồng ý kiểm tra lại tồn đầu \n" + s_tenkho + "Tháng " + mmyy.Substring(0, 2) + " năm " + mmyy.Substring(2, 2), ttb.Msg, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { Cursor = Cursors.WaitCursor; string mmyyt = ttb.Mmyy_truoc(mmyy); if (!ttb.bKhoaso(i_nhom, mmyyt)) { ttb.upd_tonkho(mmyyt, i_nhom, 1); } for (int i = 0; i < makho.Items.Count; i++) { if (makho.GetItemChecked(i)) { ttb.upd_kiemtratondau(mmyy, int.Parse(dtkho.Rows[i]["id"].ToString()), i_userid); } } ttb.upd_tonkho(mmyy, i_nhom, 1); ttb.execute_data("delete from " + xxx + ".ttb_tonkhoct where tondau=0 and slnhap=0 and slxuat=0 and mmyy='" + mmyy + "'"); ttb.execute_data("delete from " + xxx + ".ttb_tonkhoth where tondau=0 and slnhap=0 and slxuat=0 and mmyy='" + mmyy + "'"); Cursor = Cursors.Default; MessageBox.Show("Đã kiểm tra lại tồn đầu \n" + s_tenkho, ttb.Msg); } }
private void butMoi_Click(object sender, System.EventArgs e) { if (b_admin == false) { MessageBox.Show(lan.Change_language_MessageText("Bạn chưa được quyền thêm danh mục này, liên hệ với người quản trị.")); return; } l_id = 0; ena_object(true); stt.Value = decimal.Parse(dtct.Rows.Count.ToString()) + 1; cleartext(); stt.Focus(); }
private void cbKybaocao_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { txtNam.Focus(); } } catch { } }
private void butMoi_Click(object sender, System.EventArgs e) { try { stt.Value = decimal.Parse(ttb.get_data("select max(stt) from " + user + ".ttb_dmkho where nhom=" + i_nhom).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt.Value = 1; } try { stt_medi = int.Parse(ttb.get_data("select max(stt) from " + ttb.UserMedi + ".d_dmkho" + dbLink + " where nhom=" + i_nhom).Tables[0].Rows[0][0].ToString()) + 1; } catch { stt_medi = 1; } l_id = 0; ten.Text = ""; matat.Text = ""; thua.Checked = false; dutru.Checked = true; ketoan.Checked = false; ena_object(true); stt.Focus(); nhomcc.SelectedIndex = 1; }
private bool HealCheck(NumericUpDown num) { bool usedAlready = !healNum.Add((int)num.Value); if (usedAlready) { MessageBox.Show("Error: Heal % for each column must be unique"); tabOptions.SelectTab(4); num.Focus(); } return usedAlready; }