示例#1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            // Declare local variables and objects...
            int intPosition;

            // Save the current record position...
            intPosition = objCurrencyManager.Position;
            // Set the SqlCommand object properties...


            hazineh_types te = new hazineh_types();

            te.id    = long.Parse(txtid.Text);
            te.htype = txthtype.Text.Trim();
            te.Update();

            hazineh ha = new hazineh();


            // Close the connection...

            // 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 = "عملیات ویرایش رکورد با موفقیت انجام شد";
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string position;

            hazineh_types te = new hazineh_types();

            te.id    = long.Parse(txtid.Text);
            te.htype = txthtype.Text.Trim();
            te.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);
        }
示例#3
0
        private void FillDataSetAndView()
        {
            // Initialize a new instance of the DataSet object...

            hazineh_types te = new hazineh_types();

            datat = te.Select();
            // Set our CurrencyManager object
            // to the DataView object...
            objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]);
        }
示例#4
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            frmShortHazinehInp fbi = new frmShortHazinehInp();

            fbi.ShowDialog();

            hazineh_types ba = new hazineh_types();

            txttype.DataSource    = ba.SelectforComboBox();
            txttype.DisplayMember = "htype";

            txttype.Focus();
            txttype.SelectAll();
        }
示例#5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr;

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

            if (dr == DialogResult.Yes)
            {
                hazineh_types ac = new hazineh_types();
                ac.id = long.Parse(txtid.Text.Trim());
                ac.Delete();

                FillDataSetAndView();
                BindFields();

                ShowPosition();
                // Display a message that the record was updated...

                toolStripStatusLabel1.Text = "عملیات حذف نوع هزینه با موفقیت انجام شد";
            }
        }
示例#6
0
        public void idsearch_Click()
        {
            hazineh_types ba = new hazineh_types();

            txttype.DataSource    = ba.SelectforComboBox();
            txttype.DisplayMember = "htype";

            hazineh fac = new hazineh();

            fac.radif = long.Parse(txtradif.Text);
            dt        = fac.SelectForEslah();

            if (dt.Rows.Count > 0)
            {
                btnUpdate.Enabled   = true;
                txtradif.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(TextBox) || c.GetType() == typeof(ComboBox) || c.GetType() == typeof(DateMaskedTextbox) || c.GetType() == typeof(CurrencyTextBox))
                    {
                        if (c != txtradif)
                        {
                            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);
            }
        }
示例#7
0
        private void frmHazinehInp_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();

            hazineh_types ba = new hazineh_types();

            txttype.DataSource    = ba.SelectforComboBox();
            txttype.DisplayMember = "htype";

            FillDataSetAndView();
            if (objCurrencyManager.Count == 0)
            {
                grpinfo_box.Enabled = false;

                btnAdd.Enabled          = false;
                btnMoveFirst.Enabled    = false;
                btnMovePrevious.Enabled = false;
                btnMoveNext.Enabled     = false;
                btnMoveLast.Enabled     = false;
                btnNew.Visible          = true;

                txtRecordPosition.Text     = "No Records";
                toolStripStatusLabel1.Text = "آماده ایجاد رکورد جدید";

                txtdate.Text = cur_date;
            }
            else
            {
                BindFields();
                objCurrencyManager.Position = objCurrencyManager.Count - 1;
                ShowPosition();
                btnAdd.Enabled = false;
            }
        }