Esempio n. 1
0
        private void addbtnTextChanged(object sender, EventArgs e)
        {
            if (sender == txtreg_date && txtreg_date.MaskCompleted && btnNew.Visible == false)
            {
                try
                {
                    std st = new std();
                    st.reg_date = txtreg_date.Text;

                    txtstdno.Text = st.Selectmaxid();
                }
                catch
                {
                    txtstdno.Text = "";
                }
            }

            if (txtstdno.Text == "" || txtname.Text == "" || !txtreg_date.MaskCompleted)
            {
                btnAdd.Enabled = false;
                //btnUpdate.Enabled = false;
            }
            else if (btnNew.Visible == false)
            {
                btnAdd.Enabled = true;
            }
            else if (btnNew.Visible == true)
            {
                // btnUpdate.Enabled = true;
            }
        }
Esempio n. 2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            foreach (Control c in grpinfo_box.Controls)
            {
                if (c.GetType() == typeof(FiveCharTextBox) || c.GetType() == typeof(NormalTextbox) || c.GetType() == typeof(NormalCombobox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CellPhoneTextBox) || c.GetType() == typeof(CurrencyTextBox))
                {
                    c.Enabled = true;
                    c.Text    = "";
                }
            }
            img_axbox.Image         = null;
            txtreg_date.Text        = cur_date;
            txtstatus.SelectedIndex = 0;

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

            std st = new std();

            st.reg_date   = txtreg_date.Text;
            txtstdno.Text = st.Selectmaxid();

            btnAdd.Enabled             = false;
            btnMoveFirst.Enabled       = false;
            btnMovePrevious.Enabled    = false;
            btnMoveNext.Enabled        = false;
            btnMoveLast.Enabled        = false;
            btnNew.Visible             = false;
            btnCancel.Visible          = true;
            toolStripStatusLabel1.Text = "لطفا اطلاعات رکورد جدید را وارد نمایید";
            txtreg_date.Focus();
        }