Esempio n. 1
0
        private void GuardarDatos()
        {
            var  validation = new Helps.DataValidations(stock).Validate();
            bool valid      = validation.Item1;

            if (valid == true)
            {
                try
                {
                    bllStock.Update(stock);
                    bllMov.Insert(movProd);

                    InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Insert, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Stock Producto: " + producto.codigo + ' ' + stock.cantidad, "", ""));
                    InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Insert, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Movimiento Producto: " + producto.codigo + ' ' + movProd.movimiento, "", ""));

                    Notifications.FrmSuccess.SuccessForm(Helps.Language.SearchValue("guardadoOK"));

                    this.Close();
                }
                catch (Exception ex)
                {
                    if (ex.Message == EValidaciones.existe)
                    {
                        Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("errorExiste"));
                    }
                    else
                    {
                        InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.InsertError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Stock Producto: " + producto.codigo + ' ' + stock.cantidad, ex.StackTrace, ex.Message));
                        InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.InsertError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Movimiento Producto: " + producto.codigo + ' ' + movProd.movimiento, ex.StackTrace, ex.Message));
                        Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("guardadoError") + "\n" + ex.Message);
                    }
                }
            }
            else
            {
                string messageValid = validation.Item2;
                Notifications.FrmInformation.InformationForm(messageValid);
            }
        }