Exemplo n.º 1
0
        private void btnfilter_Click(object sender, EventArgs e)
        {
            Boolean check = false;

            string SQL = "select teacherno, name, artcourse, tel, resume from teachers where ";

            check = false;


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


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

            if (check == true)
            {
                SQL = SQL.Remove(SQL.Length - 4);
            }

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

            dt = te.Search(SQL);
            dataGridView1.DataSource = dt;
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        private void teacherview_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();

            Courses   co     = new Courses();
            DataTable dtname = new DataTable();

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

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

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

            DataTable dt = new DataTable();

            dt              = te.SelectforView();
            cmddel.Enabled  = true;
            cmdedit.Enabled = true;

            txtteacher.Text   = "";
            txtartcourse.Text = "";

            dataGridView1.DataSource          = dt;
            dataGridView1.AutoGenerateColumns = true;

            if (dataGridView1.RowCount == 0)
            {
                cmddel.Enabled  = false;
                cmdedit.Enabled = false;
            }

            string[] col_headers = { "ردیف", "نام و نام خانوادگی", "رشته هنری", "تلفن", "سوابق هنری" };
            int[]    col_width   = { 67, 130, 110, 100, 200 };

            for (int i = 0; i < col_headers.Length; i++)
            {
                dataGridView1.Columns[i].HeaderText = col_headers[i].ToString();
                dataGridView1.Columns[i].Width      = col_width[i];
            }


            DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();

            objAlternatingCellStyle.BackColor             = Color.Khaki;
            dataGridView1.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;
        }
Exemplo n.º 4
0
        private void frmGhabzPardakht_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();
            newform();

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

            dttename              = te.Search("SELECT name FROM teachers order by name");
            txtname.DataSource    = dttename;
            txtname.DisplayMember = "name";
            txtname.ValueMember   = "name";
        }
Exemplo n.º 5
0
        private void btnteacher_Click(object sender, EventArgs e)
        {
            int        cmbPos = txtteacher.SelectedIndex;
            addteacher ac     = new addteacher();

            ac.ShowDialog();

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

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

            txtteacher.SelectedIndex = cmbPos;
        }
Exemplo n.º 6
0
        private void classview_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();


            Courses   co     = new Courses();
            DataTable dtname = new DataTable();

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

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

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

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

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

            txtartcourse.Text = "";
            txtteacher.Text   = "";
            txtstdname.Text   = "";
            txtday.Text       = "";



            cmddel.Enabled  = true;
            cmdedit.Enabled = true;

            checkBox1.Checked = true;
        }
Exemplo n.º 7
0
        private void frmPaymentsView_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();

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

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

            txtname.Text = "";



            checkBox1.Checked = true;
            btnfilter.PerformClick();

            grdDataViewer.AutoGenerateColumns = true;

            string[] col_headers = { "شماره قبض", "نام و نام خانوادگی", "تاریخ صدور", "ماه تسویه", "مبلغ", "شرح قبض" };
            int[]    col_width   = { 100, 120, 90, 100, 90, 150 };

            for (int i = 0; i < col_headers.Length; i++)
            {
                grdDataViewer.Columns[i].HeaderText = col_headers[i].ToString();
                grdDataViewer.Columns[i].Width      = col_width[i];
            }

            DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();

            objAlternatingCellStyle.BackColor             = Color.Khaki;
            grdDataViewer.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;

            DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();

            dataGridViewCellStyle1.Format    = "N0";
            dataGridViewCellStyle1.NullValue = null;
            grdDataViewer.Columns["mablagh"].DefaultCellStyle = dataGridViewCellStyle1;
        }
Exemplo n.º 8
0
        private void frmHozoorByTeacherview_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();


            teachers  st            = new teachers();
            DataTable dtteachername = new DataTable();

            dtteachername            = st.Search("SELECT name FROM teachers order by name");
            txtteacher.DataSource    = dtteachername;
            txtteacher.DisplayMember = "name";
            txtteacher.ValueMember   = "name";

            txtteacher.Text = "";

            DataGridViewCellStyle objAlternatingCellStyle = new DataGridViewCellStyle();

            objAlternatingCellStyle.BackColor             = Color.Khaki;
            grdDataViewer.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle;
        }
Exemplo n.º 9
0
        public void idsearch_Click()
        {
            teachers  te       = new teachers();
            DataTable dttename = new DataTable();

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


            payments pa = new payments();

            pa.id = txtid.Text;
            DataTable dt = pa.Selectforedit();

            if (dt.Rows.Count > 0)
            {
                btnUpdate.Enabled = true;
                txtid.Enabled     = false;
                groupBox1.Enabled = true;
                // Clear any previous bindings & Add new bindings to the DataView object...
                foreach (Control c in groupBox1.Controls)
                {
                    if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CurrencyTextBox))
                    {
                        c.Text = dt.Rows[0][c.Name.Substring(3)].ToString();
                    }
                }
                // End of Clearing & Adding of Controls Binding

                txtdate.Focus();
            }
            else
            {
                MessageBox.Show("شماره قبض در سیستم موجود نمی باشد", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 10
0
        private void addclass_Load(object sender, EventArgs e)
        {
            System.Globalization.CultureInfo inp = new System.Globalization.CultureInfo("fa-IR");
            InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(inp);
            cur_date = Date.currentDate_Getter();


            Courses   co     = new Courses();
            DataTable dtname = new DataTable();

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


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

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

            FillDataSetAndView();

            if (objCurrencyManager.Count == 0)
            {
                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.Enabled = false;
                    }
                }
                txtopen_date.Text = cur_date;

                btnAdd.Enabled             = false;
                btnMoveFirst.Enabled       = false;
                btnMovePrevious.Enabled    = false;
                btnMoveNext.Enabled        = false;
                btnMoveLast.Enabled        = false;
                btnUpdate.Enabled          = false;
                btnNew.Visible             = true;
                txtRecordPosition.Text     = "No Record";
                toolStripStatusLabel1.Text = "آماده ایجاد رکورد جدید";
            }
            else
            {
                BindFields();
                objCurrencyManager.Position = objCurrencyManager.Count - 1;
                ShowPosition();
                btnAdd.Enabled = false;
            }

            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");
        }
Exemplo n.º 11
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;
            }
        }