Esempio n. 1
0
        private void FillDataSetAndView()
        {
            acc ac = new acc();

            datat = ac.checkpass();
            // Set our CurrencyManager object
            // to the DataView object...
            objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]);
        }
Esempio n. 2
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            DialogResult dr;

            dr = MessageBox.Show("آیا از حذف کاربر اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                acc ac = new acc();
                ac.user_code = txtuser.Text.Trim();
                ac.Delete();
                FillDataSetAndView();
                BindFields();
                ShowPosition();
                // Display a message that the record was updated...
                toolStripStatusLabel1.Text = "عملیات حذف کاربر با موفقیت انجام شد";
            }
        }
Esempio n. 3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            acc       acnt = new acc();
            DataTable dt   = new DataTable();

            acnt.user_code = txtuser.Text.Trim();
            acnt.pass      = txtpass.Text;
            dt             = acnt.Select();

            if (dt.Rows.Count > 0)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("کلمه عبور نادرست است! دوباره سعی کنید!", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtpass.Focus();
                txtpass.SelectAll();
            }
        }
Esempio n. 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            fc.MdiParent = this;
            Point p = new Point(20, this.Height - 320);

            fc.Location = p;
            fc.Show();

            //Tag = 0;

            timeDispaly.Text = DateTime.Now.ToLongTimeString();
            dateDisplay.Text = Date.currentDate_Getter();

            Amoozeshgah sh = new Amoozeshgah();

            toolStripStatusLabel3.Text += sh.Select().Rows[0]["name"].ToString();
            this.Text = toolStripStatusLabel3.Text;

            acc acnt = new acc();

            if (acnt.checkpass().Rows.Count > 0)
            {
                frmLogin frl = new frmLogin();
                frl.ShowDialog();
            }

            InputLanguage lang = GetFarsiLanguage();

            if (lang == null)
            {
                MessageBox.Show("تنظیمات صفجه کلید ویندوز فاقد کیبورد فارسی می باشد، برای کسب اطالاعات بیشتر با پشتیبانی تماس بگیرید");
            }

            InputLanguage.CurrentInputLanguage = lang;
            Timer1.Start();
            backgroundWorker1.RunWorkerAsync();
        }
Esempio n. 5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string position;

            if (txtconfirmpass.Text.CompareTo(txtnewpass.Text) == 0)
            {
                acc ac = new acc();
                ac.user_code = txtuser.Text.Trim();
                ac.pass      = txtnewpass.Text;
                ac.fname     = txtfname.Text;
                ac.lname     = txtlname.Text;
                ac.tel       = txttel.Text;
                ac.address   = txtaddress.Text;
                ac.semat     = txtsemat.Text.Trim();
                ac.Add();

                FillDataSetAndView();
                BindFields();
                // Set the record position
                // to the one that you saved...
                objCurrencyManager.Position = objCurrencyManager.Count - 1;
                // Show the current record position...
                ShowPosition();
                // Display a message that the record was added...
                toolStripStatusLabel1.Text = "عملیات ثبت کاربر با موفقیت انجام شد";

                // Save the current record position...
                position = objCurrencyManager.Position.ToString();

                btnNew_Click(null, null);
            }
            else
            {
                MessageBox.Show("کلمه های عبور جدید با هم مطابقت ندارد", "خطا");
            }
        }
Esempio n. 6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            // Declare local variables and objects...
            int intPosition;

            // Save the current record position...
            intPosition = objCurrencyManager.Position;

            if (rdobtnaccess.Checked)
            {
                acc acnt = new acc();
                acnt.user_code = txtuser.Text.Trim();
                acnt.fname     = txtfname.Text;
                acnt.lname     = txtlname.Text;
                acnt.tel       = txttel.Text;
                acnt.address   = txtaddress.Text;
                acnt.semat     = txtsemat.Text.Trim();
                acnt.UpdateAccess();

                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 if (rdobtnpass.Checked)
            {
                if (txtconfirmpass.Text.CompareTo(txtnewpass.Text) == 0)
                {
                    acc       acnt = new acc();
                    DataTable dt   = new DataTable();

                    acnt.user_code = txtuser.Text.Trim();
                    acnt.pass      = txtnowpass.Text;
                    dt             = acnt.Select();

                    if (dt.Rows.Count > 0)// password dorost bashad
                    {
                        acnt.user_code = txtuser.Text.Trim();
                        acnt.pass      = txtnewpass.Text;
                        acnt.UpdatePassword();
                        MessageBox.Show("کلمه عبور تغییر یافت", "توجه    ", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                        // 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
                    {
                        MessageBox.Show("کلمه عبور فعلی را درست وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                else
                {
                    MessageBox.Show("کلمه های عبور جدید با هم مطابقت ندارد", "خطا");
                }
            }
        }