Ejemplo n.º 1
0
        /// <summary>
        /// Insert new record
        /// </summary>
        private void saveRecord()
        {
            CommandResult opResult = null;

            Common.BLL.Logic.GasStation.Base__PlateType lPlateType = new Common.BLL.Logic.GasStation.Base__PlateType(Common.Enum.EDatabase.GasStation);


            // Set author data
            if (model.id == 0)
            {
                #region Insert
                model.insertedById = Common.GlobalData.UserManager.currentUser.id;
                model.insertDate   = DateTime.Now;

                opResult = lPlateType.create(model);
                #endregion
            }
            else
            {
                #region Modify
                model.updatedById = Common.GlobalData.UserManager.currentUser.id;
                model.updateDate  = DateTime.Now;

                opResult = lPlateType.update(model);
                #endregion
            }

            // Create/Modify data

            if (opResult.status == BaseDAL.Base.EnumCommandStatus.success)
            {
                CloseSuccess();
            }
            else
            {
                Logger.logger.log(opResult);
                MessageBox.Show(this, "خطا در ذخیره اطلاعات", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }