예제 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            std stdn = new std();

            stdn.stdno = txtstdno.Text;
            if (!stdn.SelectfornameCheck().Equals(txtstdname.Text))
            {
                MessageBox.Show("نام هنرجو  با شماره پرونده مطابقت ندارد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtstdname.Focus();
                return;
            }

            classes cl = new classes();

            cl.classno    = long.Parse(txtclassno.Text.Trim());
            cl.teacher    = txtteacher.Text;
            cl.stdname    = txtstdname.Text;
            cl.stdno      = txtstdno.Text;
            cl.artcourse  = txtartcourse.Text;
            cl.clday      = txtclday.Text.Trim();
            cl.clFromTime = txtclFromTime.Text;
            cl.clToTime   = txtclToTime.Text;
            cl.method     = txtmethod.Text.Trim();
            cl.open_date  = txtopen_date.Text;

            if (cl.CheckExists())
            {
                DialogResult dr;
                dr = MessageBox.Show("کلاسی با این مشخصات پایه در سیستم موجود می باشد، آیا از ایجاد این کلاس و تداخل آنها اطمینان دارید؟", "خطای تداخل", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                if (dr == DialogResult.Yes)
                {
                    cl.Update();
                    this.Close();
                }
                else
                {
                    txtartcourse.Focus();
                }
            }
            else
            {
                cl.Update();
                this.Close();
            }
        }
예제 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            std stdn = new std();

            stdn.stdno = txtstdno.Text;
            if (!stdn.SelectfornameCheck().Equals(txtstdname.Text))
            {
                MessageBox.Show("نام هنرجو  با شماره پرونده مطابقت ندارد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtstdname.Focus();
                return;
            }

            // Declare local variables and objects...
            int intPosition;

            // Save the current record position...
            intPosition = objCurrencyManager.Position;
            // Set the SqlCommand object properties...


            classes cl = new classes();

            cl.classno    = long.Parse(txtclassno.Text.Trim());
            cl.teacher    = txtteacher.Text;
            cl.stdname    = txtstdname.Text;
            cl.stdno      = txtstdno.Text;
            cl.artcourse  = txtartcourse.Text;
            cl.clday      = txtclday.Text.Trim();
            cl.clFromTime = txtclFromTime.Text;
            cl.clToTime   = txtclToTime.Text;
            cl.method     = txtmethod.Text.Trim();
            cl.open_date  = txtopen_date.Text;

            if (cl.CheckExists())
            {
                DialogResult dr;
                dr = MessageBox.Show("کلاسی با این مشخصات پایه در سیستم موجود می باشد، آیا از ایجاد این کلاس و تداخل آنها اطمینان دارید؟", "خطای تداخل", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                if (dr == DialogResult.Yes)
                {
                    cl.Update();

                    // Fill the DataSet and bind the fields...
                    FillDataSetAndView();
                    BindFields();
                    // Set the record position
                    // to the one that you saved...
                    objCurrencyManager.Position = intPosition;
                    // Show the current record position...
                    ShowPosition();
                    // Display a message that the record was updated...
                    toolStripStatusLabel1.Text = "عملیات ویرایش رکورد با موفقیت انجام شد";
                }
                else
                {
                    txtartcourse.Focus();
                }
            }
            else
            {
                cl.Update();

                // Fill the DataSet and bind the fields...
                FillDataSetAndView();
                BindFields();
                // Set the record position
                // to the one that you saved...
                objCurrencyManager.Position = intPosition;
                // Show the current record position...
                ShowPosition();
                // Display a message that the record was updated...
                toolStripStatusLabel1.Text = "عملیات ویرایش رکورد با موفقیت انجام شد";
            }
        }