public void SaveUnitMeasurement()
        {
            try
            {
                if (ValidationFieldsRegisterUnit())
                {
                    string key_unit         = txtKey.Text;
                    string description_unit = txtName.Text;

                    var calcType     = (CalcType)cbxTypeCalc.SelectedItem;
                    int calc_type_id = calcType.Id;

                    _unitMeasurementController = new UnitMeasurementController();
                    _unitMeasurementController.SaveUnitMeasurement(key_unit, description_unit, calc_type_id);

                    MessageBox.Show(Messages.MESSAGE_SAVE_SUCESS, Messages.MESSAGE_SUCESS);
                    ClearFields();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Messages.MESSAGE_FAIL, Messages.MESSAGE_ERROR);
                LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
                throw ex;
            }
        }
示例#2
0
 public IEnumerable <CalcType> GetCalcTypes()
 {
     try
     {
         return(calcTypeImpl.GetCalcTypes());
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
 /// <summary>
 /// Return user by id
 /// </summary>
 /// <param name="id"></param>
 /// <return></return>
 public async Task <User> GetUserById(int id)
 {
     try
     {
         return(await new UserService().GetUserById(id));
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
 /// <summary>
 /// Save new user
 /// </summary>
 /// <param name="user_name"></param>
 /// <param name="user_login"></param>
 /// <param name="user_password"></param>
 /// <param name="type_id"></param>
 /// <return></return>
 public User SaveUser(string user_name, string user_login, string user_password, int type_id)
 {
     try
     {
         return(new UserService().SaveUser(user_name, user_login, user_password, type_id));
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
 /// <summary>
 /// Return all users
 /// </summary>
 /// <return></return>
 public async Task <IEnumerable <User> > GetUsers()
 {
     try
     {
         return(await new UserService().GetAll());
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
 public User GetUserLogin(string login, string password)
 {
     try
     {
         return(_userImpl.GetUserLogin(login, password));
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
 public async Task <IEnumerable <User> > GetUsersByFilter(string name, string login, int?typeId)
 {
     try
     {
         return(await _userImpl.GetUserByFilter(name, login, typeId));
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
示例#8
0
 /// <summary>
 /// Save unit measurement
 /// </summary>
 /// <param name="key_unit"></param>
 /// <param name="description_unit"></param>
 /// <param name="calc_type_id"></param>
 /// <return></return>
 public UnitMeasurement SaveUnitMeasurement(string key_unit, string description_unit, int calc_type_id)
 {
     try
     {
         return(new UnitMeasurementService().SaveUnitMeasurement(key_unit, description_unit, calc_type_id));
     }
     catch (Exception ex)
     {
         LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
         throw ex;
     }
 }
        public UnitMeasurement SaveUnitMeasurement(string key_unit, string description_unit, int calc_type_id)
        {
            try {
                UnitMeasurement _entity = new UnitMeasurement()
                {
                    KeyUnit         = key_unit,
                    DescriptionUnit = description_unit,
                    CalcTypeId      = calc_type_id
                };

                return(_unitMeasurementImpl.Save(_entity));
            }
            catch (Exception ex)
            {
                LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
                throw ex;
            }
        }
        public User SaveUser(string user_name, string user_login, string user_password, int type_id)
        {
            try
            {
                var user = new User()
                {
                    UserName     = user_name,
                    UserLogin    = user_login,
                    UserPassword = user_password,
                    UserTypeId   = type_id
                };

                User _entity = _userImpl.Save(user);

                return(_entity);
            }
            catch (Exception ex)
            {
                LoogerApplication.LoogerError(this.GetType().Name, MethodInfo.GetCurrentMethod().Name, ex);
                throw ex;
            }
        }