Exemplo n.º 1
0
        private void Btndelete_Click(object sender, EventArgs e)
        {
            if (Txt_co_name.Text == "")
            {
                MessageBox.Show("نام شرکتی که می خواهید حذف شود را وارد نمایید");
                Txt_co_name.Focus();
                return;
            }
            if (MessageBox.Show("آیا از حذف این رکورد مطمئن هستید؟", "دقت کنید", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)

            {
                SqlConnection cn = new SqlConnection();
                cn.ConnectionString = @"Data Source=.;Initial Catalog=arsyserp;Integrated Security=True";
                cn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandText = "delete from [dbo].[Table_presentedco] where [corporation_name]='" + Txt_co_name.Text + "'";
                cmd.ExecuteNonQuery();
                Txt_co_name.Text       = "";
                combo_work.Text        = "";
                Txt_contact.Text       = "";
                datepickerpresent.Text = "";
                combo_res.Text         = "";
                Txt_coadress.Text      = "";
                Txt_description.Text   = "";
                Txt_co_name.Focus();
                Namayesh();
            }
            else
            {
                Txt_co_name.Focus();
            }
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     Namayesh();
     Txt_co_name.Text       = "";
     combo_work.Text        = "";
     Txt_contact.Text       = "";
     datepickerpresent.Text = "";
     combo_res.Text         = "";
     Txt_coadress.Text      = "";
     Txt_description.Text   = "";
     Txt_co_name.Focus();
 }
Exemplo n.º 3
0
        private void Btnedith_Click(object sender, EventArgs e)
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = @"Data Source=.;Initial Catalog=arsyserp;Integrated Security=True";
            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandText = "update  [dbo].[Table_presentedco] set [corporation_name]='" + Txt_co_name.Text + "',[field]='" + combo_work.Text + "',[contact_info]='" + Txt_contact.Text + "',[date]='" + datepickerpresent.Text + "',[result]='" + combo_res.Text + "',[adress]='" + Txt_coadress.Text + "',[description]='" + Txt_description.Text + "'where corporation_name='" + Txt_co_name.Text + "'";
            cmd.ExecuteNonQuery();
            Txt_co_name.Text       = "";
            combo_work.Text        = "";
            Txt_contact.Text       = "";
            datepickerpresent.Text = "";
            combo_res.Text         = "";
            Txt_coadress.Text      = "";
            Txt_description.Text   = "";
            Txt_co_name.Focus();
            Namayesh();
        }
Exemplo n.º 4
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            if (Txt_co_name.Text == "")
            {
                MessageBox.Show("لطفا نام شرکت را وارد نمایید");
                Txt_co_name.Focus();
                return;
            }
            if (combo_work.Text == "")
            {
                MessageBox.Show("لطفا زمینه فعالیت شرکت را وارد نمایید");
                combo_work.Focus();
                return;
            }
            if (Txt_contact.Text == "")
            {
                MessageBox.Show("لطفا شماره تماس شرکت را وارد نمایید");
                Txt_contact.Focus();
                return;
            }

            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = @"Data Source=.;Initial Catalog=arsyserp;Integrated Security=True";
            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandText = "INSERT INTO [dbo].[Table_presentedco]([corporation_name],[field],[contact_info],[date],[result],[adress],[description]) VALUES('" + Txt_co_name.Text + "','" + combo_work.Text + "','" + Txt_contact.Text + "','" + datepickerpresent.Text + "','" + combo_res.Text + "','" + Txt_coadress.Text + "','" + Txt_description.Text + "')";
            cmd.ExecuteNonQuery();
            Txt_co_name.Text       = "";
            combo_work.Text        = "";
            Txt_contact.Text       = "";
            datepickerpresent.Text = "";
            combo_res.Text         = "";
            Txt_coadress.Text      = "";
            Txt_description.Text   = "";
            Txt_co_name.Focus();
            Namayesh();
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection cn = new SqlConnection();

            cn.ConnectionString = @"Data Source=.;Initial Catalog=arsyserp;Integrated Security=True";
            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandText = "select *  [dbo].[Table_presentedco] where [corporation_name]='" + Txt_co_name.Text + "'";
            SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText, cn);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            dataGridView1.DataSource = dt;
            if (Txt_co_name.Text == "")
            {
                MessageBox.Show("نام شرکتی که می خواهید جست و جو شود را وارد نمایید");
                Txt_co_name.Focus();
                return;
            }
        }