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

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


            ghabz gh = new ghabz();

            gh.id        = txtid.Text;
            gh.stdno     = txtstdno.Text;
            gh.name      = txtname.Text.Trim();
            gh.artcourse = txtartcourse.Text.Trim();
            gh.date      = txtdate.Text;
            gh.lastcheck = txtlastcheck.Text;
            gh.lastdate  = txtlastdate.Text;
            gh.mablagh   = long.Parse(txtmablagh.Text);
            gh.sharh     = txtsharh.Text;
            gh.Update();


            MessageBox.Show("قبض با موفقیت ویرایش گردید");
            this.Close();
        }
Beispiel #2
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            std stdn = new std();

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


            ghabz gh = new ghabz();

            gh.id        = txtid.Text;
            gh.stdno     = txtstdno.Text;
            gh.name      = txtname.Text.Trim();
            gh.artcourse = txtartcourse.Text.Trim();
            gh.date      = txtdate.Text;
            gh.lastcheck = txtlastcheck.Text;
            gh.lastdate  = txtlastdate.Text;
            gh.mablagh   = long.Parse(txtmablagh.Text);
            gh.paid      = long.Parse(txtpaid.Text);
            gh.sharh     = txtsharh.Text;
            gh.Update();

            if (!stdno.Equals(txtstdno.Text))
            {
                std_history st = new std_history();
                st.ghabz_id = txtid.Text;
                st.stdno    = stdno; // old stdno
                st.Delete();

                pardakht();
                Daryaft();
            }
            else
            {
                std_history sh = new std_history();
                sh.ghabz_id   = txtid.Text;
                sh.stdno      = txtstdno.Text;;
                sh.sharh      = "شهریه " + txtlastcheck.Text + "-" + txtsharh.Text;
                sh.date       = txtdate.Text;
                sh.bedehkari  = long.Parse(txtmablagh.Text);
                sh.bestankari = long.Parse(txtmablagh.Text);
                sh.UpdateAfterEslahGhabz();
            }

            MessageBox.Show("قبض با موفقیت ویرایش گردید");

            this.Close();
        }
Beispiel #3
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();
            }
        }
Beispiel #4
0
        private void btnAdd_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;
            }

            // Inserting the Data to the DataBase
            hozoorclass si = new hozoorclass();

            si.stdno     = txtstdno.Text;
            si.stdname   = txtstdname.Text;
            si.classno   = long.Parse(dataGridView1.CurrentRow.Cells["classno"].Value.ToString());
            si.artcourse = txtartcourse.Text;
            si.date      = txtdate.Text;
            si.day       = txtday.Text;
            if (rdoHazer.Checked)
            {
                si.status = "حاضر";
            }
            else if (rdoGhayeb.Checked)
            {
                si.status = "غائب";
            }

            si.oldstdno   = long.Parse(OLD_STDNO);
            si.oldclassno = long.Parse(OLD_CLASSNO);
            si.olddate    = OLD_DATE;

            si.Update();

            //////////////////////////////////////////////////////////////////////////////////////////////////

            // Display a message that the record was added...
            MessageBox.Show("عملیات ویرایش حضور و غیاب هنرجو با موفقیت انجام شد");

            this.Close();
        }
Beispiel #5
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 = "عملیات ویرایش رکورد با موفقیت انجام شد";
            }
        }
Beispiel #6
0
        private void btnAdd_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;
            }

            // Inserting the Data to the DataBase
            hozoorclass si   = new hozoorclass();
            DataTable   temp = si.Search("select status from hozoor where (stdno=" + txtstdno.Text + " and classno=" + dataGridView1.CurrentRow.Cells["classno"].Value.ToString() + " and date=N'" + txtdate.Text + "')");

            if (temp.Rows.Count > 0)
            {
                DialogResult dr;
                dr = MessageBox.Show("برای این هنرجو در این روز " + temp.Rows[0]["status"].ToString() + "ثبت شده است، آیا مایل به جایگزینی وضعیت هستید؟ ", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2);

                if (dr == DialogResult.Yes)
                {
                    si.classno = long.Parse(dataGridView1.CurrentRow.Cells["classno"].Value.ToString());
                    si.stdno   = txtstdno.Text;
                    si.date    = txtdate.Text;
                    if (rdoHazer.Checked)
                    {
                        si.status = "حاضر";
                    }
                    else if (rdoGhayeb.Checked)
                    {
                        si.status = "غائب";
                    }
                    si.UpdateifExists();

                    //////////////////////////////////////////////////////////////////////////////////////////////////
                    hozoorclass hzc = new hozoorclass();
                    hzc.stdno = txtstdno.Text;
                    dataGridView2.DataSource = hzc.SelectSabegheh();

                    // Display a message that the record was added...
                    MessageBox.Show("عملیات جایگزینی حضور و غیاب هنرجو با موفقیت انجام شد");

                    newform();
                }
                else
                {
                    if (rdoHazer.Checked)
                    {
                        rdoHazer.Focus();
                    }
                    else if (rdoGhayeb.Checked)
                    {
                        rdoGhayeb.Focus();
                    }
                }
            }

            else
            {
                si.stdno     = txtstdno.Text;
                si.stdname   = txtstdname.Text;
                si.classno   = long.Parse(dataGridView1.CurrentRow.Cells["classno"].Value.ToString());
                si.artcourse = txtartcourse.Text;
                si.date      = txtdate.Text;
                si.day       = txtday.Text;
                if (rdoHazer.Checked)
                {
                    si.status = "حاضر";
                }
                else if (rdoGhayeb.Checked)
                {
                    si.status = "غائب";
                }

                si.Add();

                hozoorclass hzc = new hozoorclass();
                hzc.stdno = txtstdno.Text;
                dataGridView2.DataSource = hzc.SelectSabegheh();
                //////////////////////////////////////////////////////////////////////////////////////////////////

                // Display a message that the record was added...
                MessageBox.Show("عملیات ثبت حضور و غیاب هنرجو با موفقیت انجام شد");

                newform();
            }
        }