예제 #1
0
        private void cmddel_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                DialogResult dr;
                dr = MessageBox.Show("آیا از حذف کلاس اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.Yes)
                {
                    int    icol = 0;
                    int    irow = dataGridView1.CurrentRow.Index;
                    string val  = dataGridView1[icol, irow].Value.ToString();

                    classes cl = new classes();
                    cl.classno = long.Parse(val);
                    cl.Delete();

                    if (btnfilter.Enabled == true)
                    {
                        btnfilter.PerformClick();
                    }
                    else
                    {
                        DataTable dt = new DataTable();
                        dt = cl.Select();
                        dataGridView1.DataSource = dt;
                    }
                }
            }
        }
예제 #2
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            //DataGridViewComboBoxColumn class_hozoor_status = new DataGridViewComboBoxColumn();
            //class_hozoor_status.DisplayStyle = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox;
            //class_hozoor_status.DropDownWidth = 2;
            //class_hozoor_status.HeaderText = "تغییر وضعیت";
            //class_hozoor_status.Items.AddRange(new object[] {
            //"حاضر",
            //"غایب"});
            //class_hozoor_status.MaxDropDownItems = 2;
            //class_hozoor_status.Name = "class_hozoor_status";
            //class_hozoor_status.ReadOnly = false;
            //dataGridView4.Columns.Add(class_hozoor_status);



            classes cl = new classes();

            cl.clday = class_txtday.Text;
            if (class_txtartcourse.Text.Trim().Equals(""))
            {
                cl.artcourse = null;
            }
            else
            {
                cl.artcourse = class_txtartcourse.Text.Trim();
            }

            DataTable dt = new DataTable();

            dt = cl.SelectforHozoor(class_txtdate.Text);
            dataGridView4.DataSource = dt;

            //string[] col_headers = { "تغییر وضعیت", "ش هنرجویی", "نام و نام خانوادگی", "شماره کلاس", "رشته هنری", "نام استاد", "روز کلاس", "ساعت شروع", "ساعت پایان" };

            //int[] col_width = { 80, 70, 120, 80, 80, 90, 80, 80, 80 };

            //for (int i = 0; i < col_headers.Length; i++)
            //{
            //    dataGridView4.Columns[i].HeaderText = col_headers[i].ToString();
            //    dataGridView4.Columns[i].Width = col_width[i];
            //    if (i > 0)
            //        dataGridView4.Columns[i].ReadOnly = true;
            //}


            if (dataGridView4.RowCount > 0)
            {
                btnHozoorAll.Enabled       = true;
                btn_class_sabegheh.Enabled = true;
                btn_class_shahrieh.Enabled = true;
                colorize();
            }
            else
            {
                btnHozoorAll.Enabled       = false;
                btn_class_sabegheh.Enabled = false;
                btn_class_shahrieh.Enabled = false;
            }
        }
예제 #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                int    col = 0;
                int    row = dataGridView1.CurrentRow.Index;
                string val = dataGridView1[col, row].Value.ToString();

                classes   cl    = new classes();
                DataTable datat = new DataTable();
                cl.classno = long.Parse(val);
                datat      = cl.Selectforedit();

                CloseClass ec = new CloseClass();
                ec.txtclassno.Text = val;
                ec.cur_date        = this.cur_date;
                ec.Search_Click();
                ec.ShowDialog();

                if (btnfilter.Enabled == true)
                {
                    btnfilter.PerformClick();
                }
                else
                {
                    DataTable dt = new DataTable();
                    dt = cl.Select();
                    dataGridView1.DataSource = dt;
                }
            }
        }
예제 #4
0
        private void txtid_TextChanged(object sender, EventArgs e)
        {
            classes tk = new classes();

            tk.stdno = txtstdno.Text;
            DataTable cldt = tk.SelectbystdNo();

            dataGridView1.DataSource = cldt;;

            txtartcourse.DataSource    = cldt;
            txtartcourse.DisplayMember = "artcourse";
            txtartcourse.ValueMember   = "artcourse";

            hozoorclass hzc = new hozoorclass();

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

            if (txtstdno.Text == "" || txtday.Text.Trim() == "" || !txtdate.MaskCompleted || txtstdname.Text == "" || txtartcourse.Text == "" || dataGridView1.Rows.Count == 0)
            {
                btnUpdate.Enabled = false;
            }
            else
            {
                btnUpdate.Enabled = true;
            }
        }
예제 #5
0
        public void Search_Click()
        {
            Courses   co     = new Courses();
            DataTable dtname = new DataTable();

            dtname = co.Search("SELECT coursename FROM courses");
            txtartcourse.DataSource    = dtname;
            txtartcourse.DisplayMember = "coursename";
            txtartcourse.ValueMember   = "coursename";

            std       st        = new std();
            DataTable dtstdname = new DataTable();

            dtstdname                = st.Search("SELECT name, stdno FROM std order by name");
            txtstdname.DataSource    = dtstdname;
            txtstdname.DisplayMember = "name";
            txtstdname.ValueMember   = "name";

            txtstdno.DataBindings.Clear();
            txtstdno.DataBindings.Add("Text", dtstdname, "stdno");

            teachers  te       = new teachers();
            DataTable dttename = new DataTable();

            dttename = te.Search("SELECT name FROM teachers");
            txtteacher.DataSource    = dttename;
            txtteacher.DisplayMember = "name";
            txtteacher.ValueMember   = "name";

            DataTable dt = new DataTable();
            classes   cu = new classes();

            cu.classno = long.Parse(txtclassno.Text);
            dt         = cu.Selectforedit();
            if (dt.Rows.Count > 0)
            {
                btnUpdate.Enabled  = true;
                txtclassno.Enabled = false;
                //idsearch.Enabled = false;
                grpinfo_box.Enabled = true;

                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in grpinfo_box.Controls)
                {
                    if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox))
                    {
                        c.Text = dt.Rows[0][c.Name.Substring(3)].ToString();
                    }
                }
                // End of Clearing & Adding of Controls Binding

                txtartcourse.Focus();
            }
            else
            {
                MessageBox.Show("مشخصه کلاس در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #6
0
        private void txtartcourse_Enter(object sender, EventArgs e)
        {
            classes   cl  = new classes();
            DataTable tmp = cl.Search("select artcourse from classes where (stdname=N'" + txtname.Text + "' and (payan_date=N'' or payan_date is null))");

            if (tmp.Rows.Count > 0)
            {
                txtartcourse.Text = tmp.Rows[0][0].ToString();
            }
        }
예제 #7
0
        private void FillDataSetAndView()
        {
            // Initialize a new instance of the DataSet object...

            classes cl = new classes();

            datat = cl.Select();
            // Set our CurrencyManager object
            // to the DataView object...
            objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]);
        }
예제 #8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            classes cl = new classes();

            cl.classno    = long.Parse(txtclassno.Text.Trim());
            cl.payan_date = txtpayan_date.Text;
            cl.CloseClass();

            MessageBox.Show("عملیات بستن کلاس مورد نظر با موفقیت انجام شد");
            this.Close();
        }
예제 #9
0
        private void btnOpenClass_Click(object sender, EventArgs e)
        {
            classes cl = new classes();

            cl.classno = long.Parse(txtclassno.Text);
            cl.stdno   = txtstdno.Text;;
            cl.UnCloseClass();

            MessageBox.Show("عملیات بازسازی کلاس مورد نظر با موفقیت انجام شد");

            fillClassInfo();
        }
예제 #10
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (txtteacher.Text == "" && txtartcourse.Text == "" && txtstdname.Text == "" && txtday.Text == "" &&
                !txttimeFrom.MaskCompleted && !txttimeTo.MaskCompleted && !txtdateFrom.MaskCompleted && !txtdateTo.MaskCompleted && !checkBox1.Checked)
            {
                btnfilter.Enabled = false;

                classes   cl = new classes();
                DataTable dt = new DataTable();
                dt = cl.Select();
                dataGridView1.DataSource = dt;
            }
            else
            {
                btnfilter.Enabled = true;
            }
        }
예제 #11
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();
            }
        }
예제 #12
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            foreach (Control c in grpinfo_box.Controls)
            {
                if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox))
                {
                    if (c != txtstdno)
                    {
                        c.Enabled = true;
                        c.Text    = "";
                    }
                }
                else if (c.GetType() == typeof(NormalCombobox))
                {
                    c.Enabled = true;
                    if (((ComboBox)c).Items.Count > 0)
                    {
                        ((ComboBox)c).SelectedIndex = 0;
                    }
                }
            }


            txtopen_date.Text = cur_date;
            // Clear the book title and price fields...
            txtRecordPosition.Text = "رکورد جدید";

            classes cls = new classes();

            cls.open_date = txtopen_date.Text;
            long codeCounter = cls.Selectmaxid();

            txtclassno.Text = codeCounter.ToString();

            btnAdd.Enabled             = false;
            btnMoveFirst.Enabled       = false;
            btnMovePrevious.Enabled    = false;
            btnMoveNext.Enabled        = false;
            btnMoveLast.Enabled        = false;
            btnUpdate.Enabled          = false;
            btnNew.Visible             = false;
            btnCancel.Visible          = true;
            toolStripStatusLabel1.Text = "لطفا اطلاعات رکورد جدید را وارد نمایید";
            txtartcourse.Focus();
        }
예제 #13
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            addclass ac = new addclass();

//            ac.cur_date = this.cur_date;
            ac.ShowDialog();

            if (btnfilter.Enabled == true)
            {
                btnfilter.PerformClick();
            }
            else
            {
                classes   cl = new classes();
                DataTable dt = new DataTable();
                dt = cl.Select();
                dataGridView1.DataSource = dt;
            }
        }
예제 #14
0
        private void btnOpenClass_Click(object sender, EventArgs e)
        {
            classes cl = new classes();

            cl.classno = long.Parse(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString().Trim());
            cl.stdno   = dataGridView1["stdno", dataGridView1.CurrentRow.Index].Value.ToString().Trim();
            cl.UnCloseClass();

            MessageBox.Show("عملیات بازسازی کلاس مورد نظر با موفقیت انجام شد");

            if (btnfilter.Enabled == true)
            {
                btnfilter.PerformClick();
            }
            else
            {
                DataTable dt = new DataTable();
                dt = cl.Select();
                dataGridView1.DataSource = dt;
            }
        }
예제 #15
0
        public void Search_Click()
        {
            DataTable dt = new DataTable();
            classes   cu = new classes();

            cu.classno = long.Parse(txtclassno.Text);
            dt         = cu.Selectforedit();
            if (dt.Rows.Count > 0)
            {
                btnUpdate.Enabled  = false;
                txtclassno.Enabled = false;
                //idsearch.Enabled = false;
                //grpinfo_box.Enabled = true;

                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in grpinfo_box.Controls)
                {
                    if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox))
                    {
                        c.Text = dt.Rows[0][c.Name.Substring(3)].ToString();
                    }
                }
                txtpayan_date.Text = dt.Rows[0]["payan_date"].ToString();
                // End of Clearing & Adding of Controls Binding

                grpinfo_box.Enabled = false;
                if (!txtpayan_date.MaskCompleted)
                {
                    txtpayan_date.Text = cur_date;
                }
                txtpayan_date.Focus();
            }
            else
            {
                MessageBox.Show("مشخصه کلاس در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #16
0
        private void fillClassInfo()
        {
            DataTable dt = new DataTable();
            classes   cu = new classes();

            cu.stdno = txtstdno.Text;
            dt       = cu.SelectbystdNo();
            if (dt.Rows.Count > 0)
            {
                txtstdno.Enabled     = false;
                grpBasicInfo.Enabled = true;

                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in grpClassInfo.Controls)
                {
                    if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox))
                    {
                        c.Text = dt.Rows[0][c.Name.Substring(3)].ToString();
                    }
                }
                // End of Clearing & Adding of Controls Binding
            }
            else
            {
                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in grpClassInfo.Controls)
                {
                    if (c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(TimeMaskedTextbox) || c.GetType() == typeof(DateMaskedTextbox))
                    {
                        c.Text = "-";
                    }
                }
                btnOpenClass.Enabled  = false;
                btnCloseClass.Enabled = false;
                btnClassEdit.Enabled  = false;
            }
        }
예제 #17
0
        private void addbtnTextChanged(object sender, EventArgs e)
        {
            if (sender == txtopen_date && txtopen_date.MaskCompleted && btnNew.Visible == false)
            {
                try
                {
                    long.Parse(txtopen_date.Text.Substring(0, 4).Trim());

                    classes cls = new classes();
                    cls.open_date = txtopen_date.Text;
                    long codeCounter = cls.Selectmaxid();

                    txtclassno.Text = codeCounter.ToString();
                }
                catch
                {
                    txtclassno.Text = "";
                }
            }

            if (sender == txtclFromTime && txtclFromTime.MaskCompleted && btnNew.Visible == false)
            {
                try
                {
                    TimeSpan dtime = TimeSpan.Parse(txtclFromTime.Text);
                    TimeSpan add30 = TimeSpan.Parse("00:30");
                    txtclToTime.Text = dtime.Add(add30).ToString();
                }
                catch
                {
                    MessageBox.Show("لطفا ساعت کلاس را به صورت صحیح وارد نمایید");
                }
            }

            if (sender == txtartcourse && txtartcourse.Text != "" && btnNew.Visible == false)
            {
                teachers  te   = new teachers();
                DataTable tedt = new DataTable();
                tedt = te.Search("select name from teachers where artcourse=N'" + txtartcourse.Text + "'");
                if (tedt.Rows.Count > 0)
                {
                    txtteacher.Text = tedt.Rows[0][0].ToString();
                }
            }

            if (txtclassno.Text == "" || txtartcourse.Text == "" || txtteacher.Text == "" || txtstdname.Text == "" || txtclday.Text == "" || !txtclFromTime.MaskCompleted || !txtclToTime.MaskCompleted || !txtopen_date.MaskCompleted)
            {
                btnAdd.Enabled    = false;
                btnUpdate.Enabled = false;
            }

            else if (btnNew.Visible == false)
            {
                btnAdd.Enabled = true;
            }

            else if (btnNew.Visible == true)
            {
                btnUpdate.Enabled = true;
            }
        }
예제 #18
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 = "عملیات ویرایش رکورد با موفقیت انجام شد";
            }
        }
예제 #19
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            Boolean check = false;

            string SQL = "select * from classes where ";

            check = false;

            if (txtartcourse.Text != "")
            {
                SQL   = SQL + "artcourse = N'" + txtartcourse.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtteacher.Text != "")
            {
                SQL   = SQL + "teacher like N'%" + txtteacher.Text.Trim() + "%'AND ";
                check = true;
            }

            if (txtstdname.Text != "")
            {
                SQL   = SQL + "stdname = N'" + txtstdname.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtday.Text != "")
            {
                SQL   = SQL + "clday = N'" + txtday.Text.Trim() + "'AND ";
                check = true;
            }

            if (txttimeFrom.MaskCompleted)
            {
                SQL   = SQL + "clFromTime >= N'" + txttimeFrom.Text.Trim() + "'AND ";
                check = true;
            }

            if (txttimeTo.MaskCompleted)
            {
                SQL   = SQL + "clfromtime <=N'" + txttimeTo.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtdateFrom.MaskCompleted)
            {
                SQL   = SQL + "open_date >= N'" + txtdateFrom.Text.Trim() + "'AND ";
                check = true;
            }

            if (txtdateTo.MaskCompleted)
            {
                SQL   = SQL + "open_date <=N'" + txtdateTo.Text.Trim() + "'AND ";
                check = true;
            }

            if (checkBox1.Checked)
            {
                SQL   = SQL + "(payan_date is null OR payan_date=N'')AND ";
                check = true;
            }


            if (check == true)
            {
                SQL = SQL.Remove(SQL.Length - 4) + " order by payan_date, artcourse";
            }

            classes   cl = new classes();
            DataTable dt = new DataTable();

            dt = cl.Search(SQL);
            dataGridView1.DataSource = dt;
        }