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();
        }
Example #2
0
        private void btn1_Click(object sender, EventArgs e)
        {
            vshir vs = new vshir();

            vs.typ = 1;
            vs.ShowDialog(this);
            con.connection();
            dataGridViewX1.DataSource = con.show_data("select * from vshir");
            con.Disconnect();
        }
Example #3
0
        private void btn1_Click(object sender, EventArgs e)
        {
            gharardad gh = new gharardad();

            gh.type = 1;
            gh.ShowDialog(this);
            con.connection();
            dataGridViewX1.DataSource = con.show_data("select * from gharardademosh");
            con.Disconnect();
        }
        private void btn1_Click(object sender, EventArgs e)
        {
            analizeshir ash = new analizeshir();

            ash.type = 1;
            ash.ShowDialog(this);

            con.connection();
            dataGridViewX1.DataSource = con.show_data("select * from analizeshir");
            con.Disconnect();
        }
Example #5
0
        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();
        }
Example #6
0
        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();
        }
Example #7
0
 private void maskedTextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 27)
     {
         this.Close();
     }
     if (e.KeyValue == 13)
     {
         con.connection();
         DataTable dt = con.show_data("select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary where code = N'" + txt1.Text + "' AND codemar = N'" + function.Code_markaz + "' ");
         con.Disconnect();
         if (dt.Rows.Count == 0)
         {
             txt2.Text = "";
             txt1.Text = "";
         }
         else
         {
             txt1.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
             txt2.Text = dt.Rows[0].ItemArray.GetValue(1).ToString();
         }
         Ptxt3.Focus();
     }
     if (e.KeyCode == Keys.Down)
     {
         dataGridViewX1.Visible = true;
         dataGridViewX1.Focus();
         con.connection();
         if (txt1.Text == "")
         {
             sql = "select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary";
         }
         else
         {
             sql = "select code'کد مشتری',name+N' '+family'نام و نام خانوادگی' from moshtary where (code LIKE N'" + txt1.Text + "%') AND (codemar = N'" + function.Code_markaz + "')";
         }
         dataGridViewX1.DataSource = con.show_data(sql);
         con.Disconnect();
     }
 }
Example #8
0
 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();
 }
Example #9
0
        private void mtxt1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)
            {
                con.connection();
                DataTable dt = con.show_data("select * from markaz where (codemar = N'" + mtxt1.Text + "') ");
                con.Disconnect();
                if (dt.Rows.Count != 0)
                {
                    txt2.Text = dt.Rows[0].ItemArray.GetValue(1).ToString();
                    flag      = 2;
                }
                txt2.Focus();
            }

            if (e.KeyValue == 27)
            {
                groupPanel1.Enabled = groupPanel3.Enabled = true;
                groupPanel2.Enabled = false;
                btn1.Focus();
            }
        }
Example #10
0
 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();
 }
Example #11
0
        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();
        }