Exemplo n.º 1
0
        /// <summary>
        /// Delete Menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private 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__CarFuel model = new Common.BLL.Entity.GasStation.Base__CarFuel()
                {
                    id = id
                };

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

                if (opResult.status == BaseDAL.Base.EnumCommandStatus.success)
                {
                    reload();
                }
            }
            else
            {
                MessageBox.Show("رکوردی انتخاب نشده است", "اخطار", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Modify Menu
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private 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__CarFuel model = new Common.BLL.Entity.GasStation.Base__CarFuel()
                {
                    id = id
                };

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

            //Set Data
            this.model = model;

            Init();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Prepare
        /// </summary>
        private void prepare()
        {
            if (null == model)
            {
                model = new Common.BLL.Entity.GasStation.Base__CarFuel();
            }
            else
            {
                //Load model data from db
                Common.BLL.Logic.GasStation.Base__CarFuel lCarFuel = new Common.BLL.Logic.GasStation.Base__CarFuel(Common.Enum.EDatabase.GasStation);
                CommandResult opResult = lCarFuel.read(model);

                //TODO: Check errors
                //if(opResult .status ==  BaseDAL.Base.EnumCommandStatus.success)
            }
            //Fill Controls
            BaseBLL.General.FormModelHelper <Common.BLL.Entity.GasStation.Base__CarFuel> .fillControl(dataGroupBox, model);
        }