Exemplo n.º 1
0
        public async Task <CambioVenta> UpdateCambioWithIdSucursalAsync(CambioVenta element, object IdSucursal, object IdEmpleado, object IdTurnoEmpleado)
        {
            try
            {
                using (IDbConnection conexion = new SqlConnection(WebConnectionString))
                {
                    conexion.Open();
                    var dynamicParameters = new DynamicParameters();

                    dynamicParameters.Add("@IdSucursal", element.IdSucursal);
                    dynamicParameters.Add("@IdEmpleado", element.IdEmpleado);
                    dynamicParameters.Add("@IdTurnoEmpleado", element.IdTurnoEmpleado);
                    dynamicParameters.Add("@CambioTurno", element.CambioTurno);

                    var result = await conexion.ExecuteScalarAsync <int>("[Venta].[SPCID_A_CambioVenta]", param : dynamicParameters, commandType : CommandType.StoredProcedure);

                    element.Resultado = result;
                    return(element);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public async Task <CambioVenta> GuardarCambios(Guid IdUsuario, int IdSucursal, Guid IdEmpleado, int IdTurnoEmpleado)
 {
     try
     {
         CambioVenta model = new CambioVenta
         {
             IdSucursal      = IdSucursal,
             IdEmpleado      = IdEmpleado,
             IdTurnoEmpleado = IdTurnoEmpleado,
             CambioTurno     = CambioTurno
         };
         if (State == EntityState.Create)
         {
             return(await Repository.AddAsync(model, IdUsuario));
         }
         else if (State == EntityState.Update)
         {
             return(await Repository.UpdateCambioWithIdSucursalAsync(model, IdSucursal, IdEmpleado, IdTurnoEmpleado));
         }
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        private async void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                btnGuardar.Enabled = false;
                this.CleanErrors(errorProviderCambio, typeof(CambioVentaViewModel));
                var validationResults = Model.Validate();
                validationResults.ToString();
                if (validationResults.IsValid)
                {
                    Model.State = EntityState.Update;
                    CambioVenta Resultado = await Model.GuardarCambios(CurrentSession.IdCuentaUsuario, CurrentSession.IdSucursal, CurrentSession.IdEmpleado, CurrentSession.IdTurnoEmpleado);

                    if (Resultado.Resultado == 1)
                    {
                        CIDMessageBox.ShowAlert(Messages.SystemName, Messages.SuccessMessage, TypeMessage.correcto);
                        LimpiarPropiedades();
                        this.Close();
                        btnGuardar.Enabled = false;
                    }
                    else
                    {
                        CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
                    }
                }
                else
                {
                    this.ShowErrors(errorProviderCambio, typeof(CambioVentaViewModel), validationResults);
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmCambioVenta ~ btnGuardar_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
            }

            finally
            {
                btnGuardar.Enabled = true;
            }
        }
Exemplo n.º 4
0
 public Task <CambioVenta> UpdateAsync(CambioVenta element, object IdUsuario)
 {
     throw new NotImplementedException();
 }