コード例 #1
0
ファイル: CarLevelForm.cs プロジェクト: afzarofogh/GasStation
        /// <summary>
        /// Delete menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void deleteMenu_Click(object sender, EventArgs e)
        {
            if ((null != resultGrid.CurrentRow) &&
                (MessageBox.Show(this, "آیا برای حذف اطمینان دارید؟", "حذف رکورد", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes))
            {
                int id;

                // Get id
                id = Convert.ToInt32(resultGrid.CurrentRow.Cells["id"].Value);

                Common.BLL.Entity.GasStation.Base__CarLevel model = new Common.BLL.Entity.GasStation.Base__CarLevel()
                {
                    id = id
                };

                Common.BLL.Logic.GasStation.Base__CarLevel lCarLevel = new Common.BLL.Logic.GasStation.Base__CarLevel(Common.Enum.EDatabase.GasStation);
                CommandResult opResult = lCarLevel.delete(model);

                if (opResult.status == BaseDAL.Base.EnumCommandStatus.success)
                {
                    reload();
                }
            }
            else
            {
                MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
ファイル: CarLevelForm.cs プロジェクト: afzarofogh/GasStation
        /// <summary>
        /// Modify menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void modifyMenu_Click(object sender, EventArgs e)
        {
            if (null != resultGrid.CurrentRow)
            {
                int id;

                // Get id
                id = Convert.ToInt32(resultGrid.CurrentRow.Cells["id"].Value);

                Common.BLL.Entity.GasStation.Base__CarLevel model = new Common.BLL.Entity.GasStation.Base__CarLevel()
                {
                    id = id
                };

                CarLevelEntryForm form = new CarLevelEntryForm(model);
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    reload();
                }
            }
            else
            {
                MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public CarLevelEntryForm(Common.BLL.Entity.GasStation.Base__CarLevel model = null)
        {
            InitializeComponent();

            // Set data
            this.model = model;

            init();
        }
コード例 #4
0
        /// <summary>
        /// Prepare
        /// </summary>
        private void prepare()
        {
            if (null == model)
            {
                model = new Common.BLL.Entity.GasStation.Base__CarLevel();
            }
            else
            {
                // Load model data from db
                Common.BLL.Logic.GasStation.Base__CarLevel lCarLevel = new Common.BLL.Logic.GasStation.Base__CarLevel(Common.Enum.EDatabase.GasStation);
                CommandResult opResult = lCarLevel.read(model);

                ///TODO: CHECK ERRORS
            }

            // Fill Controls
            BaseBLL.General.FormModelHelper <Common.BLL.Entity.GasStation.Base__CarLevel> .fillControl(dataGroupBox, model);
        }