예제 #1
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");
        }