コード例 #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...


            Amoozeshgah st = new Amoozeshgah();

            st.address = txtaddress.Text;
            st.name    = txtname.Text;
            st.tel     = txttel.Text;
            st.flag    = flag;
            st.photo   = photo;
            st.Update();


            // 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
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Amoozeshgah SH = new Amoozeshgah();
            DataTable   dt = new DataTable();

            try
            {
                mydataaccess da = new mydataaccess();
                da.Connect();
                da.disconnect();
            }
            catch
            {
                mydataaccess da = new mydataaccess();

                byte ChDbExist = da.CheckDatabseExists();

                if (ChDbExist == 1)
                {
                    da.Attach();
                }
                else if (ChDbExist == 2)
                {
                    try
                    {
                        da.detach_action();
                        da.Attach();
                    }
                    catch
                    {
                        MessageBox.Show("لطفا با پشتیبان تماس بگیرید");
                        Application.Exit();
                    }
                }
            }
            finally
            {
                dt = SH.Select();

                Date.currentDate_Setter();
            }

            if (dt.Rows.Count == 0)
            {
                frmaddAmoozeshgah fad = new frmaddAmoozeshgah();

                if (fad.ShowDialog() != DialogResult.Abort)
                {
                    Application.Run(new frmMain());
                }
            }
            else
            {
                Application.Run(new frmMain());
            }
        }
コード例 #3
0
        private void FillDataSetAndView()
        {
            Amoozeshgah st = new Amoozeshgah();

            datat = st.Select();

            // Set our CurrencyManager object
            // to the DataView object...
            objCurrencyManager = (CurrencyManager)(this.BindingContext[datat]);
        }
コード例 #4
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            DialogResult m;

            m = MessageBox.Show("آیا از حذف تصویر آموزشگاه اطمینان دارید ؟ ", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (m == DialogResult.Yes)
            {
                Amoozeshgah st = new Amoozeshgah();

                st.name = txtname.Text;
                st.Updateforpic();
                ShowPosition();
            }
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: ppourali/Rohab_new
        private void بازگردانیاطلاعاتخامنرمافزارToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr;

            dr = MessageBox.Show("آیا از حذف  تمامی اطلاعات پایگاه داده اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.RightAlign);

            if (dr == DialogResult.Yes)
            {
                Cursor.Current = Cursors.WaitCursor;

                Amoozeshgah darm = new Amoozeshgah();
                darm.RESET();

                MessageBox.Show("انجام عملیات با موفقیت به پایان رسید. لطفا نرم افزار را مجددا راه اندازی نمایید");
                Application.Exit();
            }
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            Amoozeshgah dar = new Amoozeshgah();

            if (dar.Select().Rows.Count == 0)
            {
                if (MessageBox.Show("برای اجرای صحیح نرم افزار، ثبت اطلاعات مرکز الزامیست! مجددا سعی می کنید؟", "خطا", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    this.DialogResult = DialogResult.Abort;
                    this.Close();
                }
            }
            else if (dar.Select().Rows.Count > 0)
            {
                this.Close();
            }
        }
コード例 #7
0
        private void ShowPosition()
        {
            // Display the current position
            // and the number of records
            //txtRecordPosition.Text = (objCurrencyManager.Position + 1) + " of " + objCurrencyManager.Count;
            toolStripStatusLabel1.Text = "آماده عملیات";
            txtname.Enabled            = false;

            Amoozeshgah st = new Amoozeshgah();

            st.name = txtname.Text;

            SqlDataReader dstdr;

            try
            {
                dstdr = st.Selectimg();

                while (dstdr.Read())
                {
                    if (!dstdr.IsDBNull(0))
                    {
                        byte[] photo1 = (byte[])dstdr[0];

                        MemoryStream ms = new MemoryStream(photo1);
                        img_axbox.Image     = Image.FromStream(ms);
                        pictureBox1.Enabled = true;
                    }
                    else
                    {
                        img_axbox.Image     = null;
                        pictureBox1.Enabled = false;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("در اطلاعات این آموزشگاه عکس موجود نیست", "توجه    ", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }


            flag = false;
        }
コード例 #8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string position;

            Amoozeshgah st = new Amoozeshgah();

            st.Delete();

            st.address = txtaddress.Text;
            st.name    = txtname.Text;
            st.tel     = txttel.Text;
            st.flag    = flag;
            st.photo   = photo;

            st.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();

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

            btnCancel_Click(null, null);
        }
コード例 #9
0
ファイル: frmMain.cs プロジェクト: ppourali/Rohab_new
        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();
        }