private void btn1_Click(object sender, EventArgs e) { string date = ptxt13.Value.Year.ToString() + "/" + (ptxt13.Value.Month < 10 ? "0" + ptxt13.Value.Month.ToString() : ptxt13.Value.Month.ToString()) + "/" + (ptxt13.Value.Day < 10 ? "0" + ptxt13.Value.Day.ToString() : ptxt13.Value.Day.ToString()) + " " + (ptxt13.Value.Hour < 10 ? "0" + ptxt13.Value.Hour.ToString() : ptxt13.Value.Hour.ToString()) + ":" + (ptxt13.Value.Minute < 10 ? "0" + ptxt13.Value.Minute.ToString() : ptxt13.Value.Minute.ToString()); if (type == 1) { sql = "INSERT INTO analizekarkhane(codemahmole, codemahersal, shirtah, charbi, proten, microb, ab, dansite, asidite, alkol, enjemad, dama, date, coderan, nameran, codemagh, namemagh, namayande, tozih)" + " VALUES(N'" + txt1.Text + "', N'" + txt2.Text + "', N'" + txt3.Text + "', N'" + txt4.Text + "', N'" + txt5.Text + "', N'" + txt6.Text + "', N'" + txt7.Text + "', N'" + txt8.Text + "', N'" + txt9.Text + "', N'" + txt10.Text + "', N'" + txt11.Text + "', N'" + txt12.Text + "', N'" + date + "', N'" + txt14.Text + "', N'" + txt15.Text + "', N'" + txt16.Text + "', N'" + txt17.Text + "', N'" + txt18.Text + "', N'" + txt19.Text + "')"; } if (type == 2) { sql = "UPDATE analizekarkhane SET codemahmole = N'" + txt1.Text + "', codemahersal = N'" + txt2.Text + "', shirtah = N'" + txt3.Text + "', charbi = N'" + txt4.Text + "', proten = N'" + txt5.Text + "', microb = N'" + txt6.Text + "', ab = N'" + txt7.Text + "', dansite = N'" + txt8.Text + "', asidite = N'" + txt9.Text + "', alkol = N'" + txt10.Text + "', " + "enjemad = N'" + txt11.Text + "', dama = N'" + txt12.Text + "', date = N'" + date + "', coderan = N'" + txt14.Text + "', nameran = N'" + txt15.Text + "', codemagh = N'" + txt16.Text + "', namemagh = N'" + txt17.Text + "', namayande = N'" + txt18.Text + "', tozih = N'" + txt19.Text + "' WHERE(codemahmole = N'" + code + "')"; } con.connection(); if (con.exe_data(sql)) { FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "خطا", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } if (type == 2) { this.Close(); } clear(); txt1.Focus(); con.Disconnect(); }
private void btn1_Click(object sender, EventArgs e) { string date = Ptxt3.Value.Year.ToString() + "/" + (Ptxt3.Value.Month < 10 ? "0" + Ptxt3.Value.Month.ToString() : Ptxt3.Value.Month.ToString()) + "/" + (Ptxt3.Value.Day < 10 ? "0" + Ptxt3.Value.Day.ToString() : Ptxt3.Value.Day.ToString()); if (type == 1) { sql = "INSERT INTO tahvilshir(codemosh, name, tarikh, nobat, shirtahvili, ab, jarime, dansite, asidite, alkol, ph, enjemad, dama, joosh, tozih)" + " VALUES(N'" + txt1.Text + "', N'" + txt2.Text + "', N'" + date + "', N'" + txt4.Text + "', N'" + txt5.Text + "', N'" + txt6.Text + "', N'" + txt7.Value.ToString() + "', N'" + txt8.Text + "', N'" + txt9.Text + "', N'" + txt10.Text + "', N'" + txt11.Text + "', N'" + txt12.Text + "', N'" + txt13.Text + "', N'" + txt14.Text + "', N'" + txt15.Text + "')"; } if (type == 2) { sql = "UPDATE tahvilshir SET codemosh = N'" + txt1.Text + "', name = N'" + txt2.Text + "', tarikh = N'" + date + "', nobat = N'" + txt4.Text + "', shirtahvili = N'" + txt5.Text + "', ab = N'" + txt6.Text + "', jarime = N'" + txt7.Value.ToString() + "', dansite = N'" + txt8.Text + "', asidite = N'" + txt9.Text + "', alkol = N'" + txt10.Text + "', ph = N'" + txt11.Text + "', " + " enjemad = N'" + txt15.Text + "', dama = N'" + txt15.Text + "', joosh = N'" + txt15.Text + "', tozih = N'" + txt15.Text + "' WHERE (codemosh = N'" + code + "') AND (tarikh = N'" + date + "') AND (nobat = N'" + nobat + "')"; } con.connection(); if (con.exe_data(sql)) { FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "خطا", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } if (type == 2) { this.Close(); } clear(); txt1.Focus(); con.Disconnect(); }
private void btn1_Click(object sender, EventArgs e) { string date = Ptxt3.Value.Year.ToString() + "/" + (Ptxt3.Value.Month < 10 ? "0" + Ptxt3.Value.Month.ToString() : Ptxt3.Value.Month.ToString()) + "/" + (Ptxt3.Value.Day < 10 ? "0" + Ptxt3.Value.Day.ToString() : Ptxt3.Value.Day.ToString()); if (type == 1) { sql = "INSERT INTO analizeshir (codemosh, name, date, nobat, charbi, dama, microb, tozih)" + " VALUES(N'" + txt1.Text + "', N'" + txt2.Text + "', N'" + date + "', N'" + txt3.Text + "', N'" + txt4.Text + "', N'" + txt5.Text + "', N'" + txt6.Text + "', N'" + txt7.Text + "')"; } if (type == 2) { sql = "UPDATE analizeshir SET codemosh = N'" + txt1.Text + "', name = N'" + txt2.Text + "', date = N'" + date + "', nobat = N'" + txt3.Text + "', charbi = N'" + txt4.Text + "', dama = N'" + txt5.Text + "', microb = N'" + txt6.Text + "', tozih = N'" + txt7.Text + "' " + " WHERE (codemosh = N'" + code + "' and date = N'" + dat + "' and nobat = N'" + nobat + "')"; } con.connection(); if (con.exe_data(sql)) { FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "خطا", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } if (type == 2) { this.Close(); } clear(); txt1.Focus(); con.Disconnect(); }
private void buttonX3_Click(object sender, EventArgs e) { if (flag == 0) { mtxt1.Focus(); return; } if (flag == 1) { sql = "INSERT INTO moshtary(code, codemar, name, family, phon, kosoorat, shhesab, address)" + "VALUES(N'" + mtxt1.Text + "', N'" + mtxt2.Text + "', N'" + txt3.Text + "', N'" + txt4.Text + "', N'" + txt5.Text + "', N'" + txt6.Text + "', N'" + txt7.Text + "', N'" + txt8.Text + "')"; } else if (flag == 2) { sql = "UPDATE moshtary " + "SET code = N'" + mtxt1.Text + "', codemar = N'" + mtxt2.Text + "', name = N'" + txt3.Text + "', family = N'" + txt4.Text + "', " + "phon = N'" + txt5.Text + "', kosoorat = N'" + txt6.Text + "', shhesab = N'" + txt7.Text + "', address = N'" + txt8.Text + "' " + " WHERE (code = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')"; } con.connection(); if (con.exe_data(sql)) { dataGridViewX1.DataSource = con.show_data("select * from moshtary"); FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } clear(); if (flag == 2) { key27(); } else { mtxt1.Focus(); } con.Disconnect(); }
private void btn0_Click(object sender, EventArgs e) { if (flag == 0) { mtxt1.Focus(); return; } if (flag == 1) { sql = "INSERT INTO ranande(coderan, name, family, phon, shmashin, shhesab, address)" + "VALUES(N'" + mtxt1.Text + "', N'" + txt2.Text + "', N'" + txt3.Text + "', N'" + txt4.Text + "', N'" + txt5.Text + "', N'" + txt6.Text + "', N'" + txt7.Text + "')"; } else if (flag == 2) { sql = "UPDATE ranande SET " + "coderan = N'" + mtxt1.Text + "', name = N'" + txt2.Text + "', family = N'3', phon = N'4', shmashin = N'5', " + "shhesab = N'6', address = N'7' WHERE (coderan = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')"; } con.connection(); if (con.exe_data(sql)) { FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } clear(); dataGridViewX1.DataSource = con.show_data("select * from ranande"); if (flag == 2) { key27(); } else { mtxt1.Focus(); } con.Disconnect(); }
private void btn0_Click(object sender, EventArgs e) { if (flag == 0) { return; } if (flag == 1) { sql = "INSERT INTO markaz(codemar, name)VALUES(N'" + mtxt1.Text + "', N'" + txt2.Text + "')"; } else if (flag == 2) { sql = "UPDATE markaz SET codemar = N'" + mtxt1.Text + "', name = N'" + txt2.Text + "' WHERE(codemar = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "')"; } con.connection(); if (con.exe_data(sql)) { dataGridViewX1.DataSource = con.show_data("select * from markaz"); FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } con.Disconnect(); mtxt1.Text = txt2.Text = ""; if (flag == 2) { groupPanel1.Enabled = groupPanel3.Enabled = true; groupPanel2.Enabled = false; dataGridViewX1.Focus(); } else { mtxt1.Focus(); } }
private void buttonX3_Click(object sender, EventArgs e) { if (flag == 0) { mtxt1.Focus(); return; } if (flag == 1) { sql = "INSERT INTO karkhane (codekar, name, phon, ghimat, address)" + " VALUES (N'" + mtxt1.Text + "', N'" + txt2.Text + "', N'" + txt3.Text + "', N'" + txt4.Text + "', N'" + txt5.Text + "')"; } else if (flag == 2) { sql = "UPDATE karkhane SET codekar = N'" + mtxt1.Text + "', name = N'" + txt2.Text + "', phon = N'" + txt3.Text + "', ghimat = N'" + txt4.Text + "', address = N'" + txt5.Text + "' " + " WHERE (codekar = N'" + code + "')"; } con.connection(); if (con.exe_data(sql)) { dataGridViewX1.DataSource = con.show_data("select * from karkhane"); FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } clear(); if (flag == 2) { key27(); } else { mtxt1.Focus(); } con.Disconnect(); }
private void btn1_Click(object sender, EventArgs e) { //string date = PDtxt3.Value.Year.ToString() + "/" + (PDtxt3.Value.Month < 10 ? "0" + PDtxt3.Value.Month.ToString() : PDtxt3.Value.Month.ToString()) + "/" + (PDtxt3.Value.Day < 10 ? "0" + PDtxt3.Value.Day.ToString() : PDtxt3.Value.Day.ToString()) + " " + (PDtxt3.Value.Hour < 10 ? "0" + PDtxt3.Value.Hour.ToString() : PDtxt3.Value.Hour.ToString()) + ":" + (PDtxt3.Value.Minute < 10 ? "0" + PDtxt3.Value.Minute.ToString() : PDtxt3.Value.Minute.ToString()); string date = PDtxt3.Value.Year.ToString() + "/" + (PDtxt3.Value.Month < 10 ? "0" + PDtxt3.Value.Month.ToString() : PDtxt3.Value.Month.ToString()) + "/" + (PDtxt3.Value.Day < 10 ? "0" + PDtxt3.Value.Day.ToString() : PDtxt3.Value.Day.ToString()); if (typ == 1) { sql = "INSERT INTO vshir(codemar, namemar, date, nobat, tshir, charbi, dansite, proten, ab, asidite, alkol, enjemad, dama, mikrob, tozihat, barname) " + "VALUES(N'" + mtxt1.Text + "', N'" + txt2.Text + "', N'" + date + "', N'" + cbtxt4.Text + "', N'" + mtxt5.Text + "', N'" + mTxt6.Text + "', N'" + mtxt7.Text + "', N'" + mtxt8.Text + "', N'" + mtxt9.Text + "', N'" + mtxt10.Text + "', N'" + cbtxt11.Text + "', N'" + mtxt12.Text + "', N'" + mtxt13.Text + "', N'" + mtxt14.Text + "', N'" + txt15.Text + "', N'" + mtxt16.Text + "')"; } else if (typ == 2) { sql = "UPDATE vshir SET codemar = N'" + mtxt1.Text + "', namemar = N'" + txt2.Text + "', date = N'" + date + "', nobat = N'" + cbtxt4.Text + "', tshir = N'" + mtxt5.Text + "', charbi = N'" + mTxt6.Text + "', dansite = N'" + mtxt7.Text + "', proten = N'" + mtxt8.Text + "', ab = N'" + mtxt9.Text + "', asidite = N'" + mtxt10.Text + "', alkol = N'" + cbtxt11.Text + "',enjemad = N'" + mtxt12.Text + "', dama = N'" + mtxt13.Text + "', mikrob = N'" + mtxt14.Text + "', tozihat = N'" + txt15.Text + "', barname = N'" + mtxt16.Text + "' " + " WHERE (codemar = N'" + codemar + "') AND (date = N'" + day + "') AND (nobat = N'" + nobat + "')"; } con.connection(); if (con.exe_data(sql)) { FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } con.Disconnect(); if (typ == 2) { this.Close(); } cleartxt(); mtxt1.Focus(); }
private void buttonX2_Click(object sender, EventArgs e) { if (dataGridViewX1.RowCount == 0) { return; } if (FMessegeBox.FarsiMessegeBox.Show("آیا برای حذف مطمئن هستید؟", "", FMessegeBox.FMessegeBoxButtons.YesNo, FMessegeBox.FMessegeBoxIcons.Question) == DialogResult.No) { return; } sql = "DELETE FROM analizeshir WHERE (codemosh = N'" + dataGridViewX1.CurrentRow.Cells[0].Value.ToString() + "' and date = N'" + dataGridViewX1.CurrentRow.Cells[2].Value.ToString() + "' and nobat = N'" + dataGridViewX1.CurrentRow.Cells[3].Value.ToString() + "')"; con.connection(); if (con.exe_data(sql)) { dataGridViewX1.DataSource = con.show_data("select * from analizeshir"); FMessegeBox.FarsiMessegeBox.Show("اطلاعات با موفقیت ثبت شد"); } else { FMessegeBox.FarsiMessegeBox.Show("مشکل در ذخیره اطلاعات", "اخطار", FMessegeBox.FMessegeBoxButtons.Ok, FMessegeBox.FMessegeBoxIcons.Error); } con.Disconnect(); }