Esempio n. 1
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();
        }
Esempio n. 2
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();
        }
Esempio n. 4
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();
        }
Esempio n. 5
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();
     }
 }
Esempio n. 6
0
 private void mtxt1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == 27)
     {
         this.Close();
     }
     if (e.KeyValue == 13)
     {
         con.connection();
         DataTable dt = con.show_data("select codemar'کد مرکز',name'نام مرکز' from markaz where code = N'" + mtxt1.Text + "' ");
         con.Disconnect();
         if (dt.Rows.Count == 0)
         {
             txt2.Text  = "";
             mtxt1.Text = "";
         }
         else
         {
             mtxt1.Text = dt.Rows[0].ItemArray.GetValue(0).ToString();
             txt2.Text  = dt.Rows[0].ItemArray.GetValue(1).ToString();
         }
         PDtxt3.Focus();
     }
     if (e.KeyCode == Keys.Down)
     {
         dataGridViewX1.Visible = true;
         dataGridViewX1.Focus();
         con.connection();
         if (mtxt1.Text == "")
         {
             sql = "select codemar'کد مرکز',name'نام مرکز' from markaz";
         }
         else
         {
             sql = "select codemar'کد مرکز',name'نام مرکز' from markaz where (codemar LIKE N'" + mtxt1.Text + "'%)";
         }
         dataGridViewX1.DataSource = con.show_data(sql);
         con.Disconnect();
     }
 }
Esempio n. 7
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();
 }
Esempio n. 8
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();
            }
        }
Esempio n. 9
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();
 }
Esempio n. 10
0
        private void mtxt1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyValue)
            {
            case 27:
                this.Close();
                break;

            case 13:
                con.connection();
                DataTable dt = con.show_data("select * from foroosheshir where (codemah = N'" + mtxt1.Text + "')");
                con.Disconnect();
                if (dt.Rows.Count != 0)
                {
                    txt2.Text    = dt.Rows[0].ItemArray.GetValue(1).ToString();
                    txt3.Text    = dt.Rows[0].ItemArray.GetValue(2).ToString();
                    txt4.Text    = dt.Rows[0].ItemArray.GetValue(3).ToString();
                    txt5.Text    = dt.Rows[0].ItemArray.GetValue(4).ToString();
                    txt6.Text    = dt.Rows[0].ItemArray.GetValue(5).ToString();
                    txt7.Text    = dt.Rows[0].ItemArray.GetValue(6).ToString();
                    txt8.Text    = dt.Rows[0].ItemArray.GetValue(7).ToString();
                    txt9.Text    = dt.Rows[0].ItemArray.GetValue(8).ToString();
                    txt10.Text   = dt.Rows[0].ItemArray.GetValue(9).ToString();
                    txt11.Text   = dt.Rows[0].ItemArray.GetValue(10).ToString();
                    txt12.Text   = dt.Rows[0].ItemArray.GetValue(11).ToString();
                    txt13.Text   = dt.Rows[0].ItemArray.GetValue(12).ToString();
                    ptxt14.Value = FreeControls.PersianDate.Parsewh(dt.Rows[0].ItemArray.GetValue(13).ToString());
                    txt15.Text   = dt.Rows[0].ItemArray.GetValue(14).ToString();
                    txt16.Text   = dt.Rows[0].ItemArray.GetValue(15).ToString();
                    txt17.Text   = dt.Rows[0].ItemArray.GetValue(16).ToString();
                    txt18.Text   = dt.Rows[0].ItemArray.GetValue(17).ToString();
                    type         = 2;
                }
                txt2.Focus();
                break;
            }
        }