Ejemplo n.º 1
0
 private void BusquedaClaveCodigoControl_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         if (e.KeyChar == (char)Keys.Enter)
         {
             MetodoBuscar();
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmProductoCompra() ~ BusquedaClaveCodigoControl_KeyPress(object sender, KeyPressEventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorBusqueda, TypeMessage.error);
     }
 }
Ejemplo n.º 2
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         if (CIDMessageBox.ShowAlertRequest(Messages.SystemName, Messages.ConfirmCancelInput) == DialogResult.OK)
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmProveedor ~ btnCancelar_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
     }
 }
Ejemplo n.º 3
0
        protected void Application_Error(object sender, EventArgs e)
        {
            Exception err = HttpContext.Current.Error;

            ErrorLogHelper.WriteLog(new LogContent()
            {
                UserName      = User.Identity.Name,
                EventCategory = "ERROR",
                Description   = err.StackTrace,
                Source        = err.Message,
                SourceUrl     = Request.Url.AbsoluteUri,
                ComputerName  = UserHelper.GetUserIp(),
                Mac_Address   = Utility.OperateHelper.GetMacAddress()
            });
        }
Ejemplo n.º 4
0
        private void FrmSucursal_Shown(object sender, EventArgs e)
        {
            try
            {
                LimpiarPropiedades();
                if (Model.State == EntityState.Update)
                {
                    CIDWait.Show(async() =>
                    {
                        await Model.GetSucursal();
                        lblSubtitle.Text = Model.Nombre;
                    }, "Cargando sucursal");
                    if (Model.ListaHorario.Count == 0)
                    {
                        Model.ListHorario();
                    }
                    CargarHorarios();
                }
                else
                {
                    Model.IdPais   = 143;
                    Model.IdEstado = 7;
                    IdTipoSucursalControl.SelectedValue = 0;
                }

                CIDWait.Show(async() =>
                {
                    var ListaTipoSucursal = await Model.GetListaTipoSucursal();
                    Model.LlenarListaTipoSucursal(ListaTipoSucursal);

                    var ListaPais = await Model.GetListaPaises();
                    Model.LlenarListaPaises(ListaPais);

                    var ListaEstado = await Model.GetListaEstados();
                    Model.LlenarListaEstado(ListaEstado);

                    var ListaMunicipio = await Model.GetListaMunicipios();
                    Model.LlenarListaMunicipios(ListaMunicipio);
                }, "Espere");

                IniciarBinding();
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmSucursal ~ FrmSucursal_Shown(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorAlCancelarFrm, TypeMessage.error);
            }
        }
        public ActionResult Index()
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                _UserDetailsBusinessLogic = new UserDetailsBusinessLogic();
                // string LoginUserType = System.Web.HttpContext.Current.Session["LoginUserType"].ToString();
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
                if (authCookie != null)
                {
                    ticket = FormsAuthentication.Decrypt(authCookie.Value);

                    if (_UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim() == "administrator")
                    {
                        ViewBag.ProfilePicURL = _UserDetailsBusinessLogic.GetUserDetails(ticket.Name)
                                                .FirstOrDefault().ProfilePicURL;
                        ViewBag.Username         = ticket.Name;
                        ViewBag.UserType         = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim();
                        ViewBag.RedirectedUserId = "0";


                        return(View());
                    }
                    else
                    {
                        this.HttpContext.Session["ErrorMsg"] = "AccessDeniedError";
                        return(RedirectToAction("Index", "LoginError"));
                    }
                }
                else
                {
                    this.HttpContext.Session["ErrorMsg"] = "LoginErr";
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);

                this.HttpContext.Session["ErrorMsg"] = "PageLoadError";
                return(RedirectToAction("Index", "LoginError"));
            }
        }
Ejemplo n.º 6
0
 public void AgregarRegistro()
 {
     try
     {
         if (Model.ListaBusquedaProducto.Count == 1)
         {
             if (Model.CantidadProducto > 0)
             {
                 var item = Model.ListaBusquedaProducto.ElementAt(0);
                 item.IdTipo           = this.IDTipo = 1;
                 item.CantidadProducto = Model.CantidadProducto;
                 producto = item;
                 this.Close();
             }
             else
             {
                 errorProvider1.SetError(CantidadProductoControl, "LA CANTIDAD DE PRODUCTO TIENE QUE SER MAYOR A CERO.");
             }
         }
         else
         {
             var item = ObtenerSeleccionado();
             if (item != null)
             {
                 item.IdTipo           = this.IDTipo = 1;
                 item.CantidadProducto = Model.CantidadProducto;
                 if (Model.CantidadProducto > 0)
                 {
                     producto = item;
                     this.Close();
                 }
                 else
                 {
                     errorProvider1.SetError(CantidadProductoControl, "LA CANTIDAD DE PRODUCTO TIENE QUE SER MAYOR A CERO.");
                 }
             }
             else
             {
                 CIDMessageBox.ShowAlert(Messages.SystemName, Messages.GridSelectMessage, TypeMessage.informacion);
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, " FrmBusquedaProducto() ~ AgregarRegistro()");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorLoadMessage, TypeMessage.error);
     }
 }
 static void CurrentDomain_DomainUnload(object sender, EventArgs e)
 {
     try
     {
         if (_singleton != null)
         {
             _singleton.Dispose();
         }
         LogHelper.WriteLine(-1, "", "CurrentDomain_DomainUnload", "当前域域卸载时释放生产者完毕");
     }
     catch (Exception exp)
     {
         ErrorLogHelper.WriteLine(-1, "", "CurrentDomain_DomainUnload", "当前域域卸载释放生产者连接池出错", exp);
         throw exp;
     }
 }
Ejemplo n.º 8
0
        public static int DeleteRange <T>(IEnumerable <T> ts) where T : class
        {
            try
            {
                DB.Set <T>().RemoveRange(ts);
                int result = DB.SaveChanges();

                LogHelper.WriteLog("Delete" + ts.GetType(), result.ToString() + ts.ObjectToJson());
                return(result);
            }
            catch (Exception ex)
            {
                ErrorLogHelper.WriteLog(ex);
                return(0);
            }
        }
Ejemplo n.º 9
0
 //心跳循环
 private void HeartBeatRun()
 {
     try
     {
         while (!cancelSource.IsCancellationRequested)
         {
             HeartBeatTask();
             System.Threading.Thread.Sleep(SystemParamConfig.Consumer_HeatBeat_Every_Time * 1000);
             DebugHelper.WriteLine(Context.GetMQPathID(), Context.GetMQPath(), "ConsumerHeartbeatProtect-HeartBeatRun", "心跳循环一轮完毕");
         }
     }
     catch (Exception exp)
     {
         ErrorLogHelper.WriteLine(Context.ConsumerInfo.MQPathModel.id, Context.ConsumerInfo.MQPathModel.mqpath, "HeartBeatRun", "消费者心跳循环方法", exp);
     }
 }
Ejemplo n.º 10
0
 private void FrmCliente_Shown(object sender, EventArgs e)
 {
     try
     {
         VerticalScrollBar x = (VerticalScrollBar)sfDataGridCliente.TableControl.VerticalScroll.ScrollBar;
         x.ValueChanged += X_ValueChanged;
         CargarGrid();
         IniciarBinding();
         Model.Foto = Properties.Resources.imagen_subir;
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmCliente ~ FrmCliente_Shown(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Ejemplo n.º 11
0
        public void ReadErrorLogFile()
        {
            var errorLog = new ManagedErrorLog
            {
                Id        = Guid.NewGuid(),
                ProcessId = 123
            };
            var serializedErrorLog = LogSerializer.Serialize(errorLog);
            var mockFile           = Mock.Of <File>();

            Mock.Get(mockFile).Setup(file => file.ReadAllText()).Returns(serializedErrorLog);
            var actualContents = ErrorLogHelper.ReadErrorLogFile(mockFile);

            Assert.AreEqual(errorLog.Id, actualContents.Id);
            Assert.AreEqual(errorLog.ProcessId, actualContents.ProcessId);
        }
Ejemplo n.º 12
0
        public static int Add <T>(T t) where T : class
        {
            try
            {
                DB.Set <T>().Add(t);
                int result = DB.SaveChanges();

                LogHelper.WriteLog("Add:" + t.GetType(), "结果:" + result.ToString() + ";" + t.ObjectToJson());
                return(result);
            }
            catch (Exception ex)
            {
                ErrorLogHelper.WriteLog(ex);
                return(0);
            }
        }
Ejemplo n.º 13
0
        public async void NuevoProducto()
        {
            try
            {
                errorProvider1.SetError(TipoControl, string.Empty);
                if (Model.Tipo != 2)
                {
                    FrmBusquedaProducto FProducto = new FrmBusquedaProducto();
                    FProducto.ShowDialog();
                    if (FProducto.producto.IdProducto != 0)
                    {
                        var item = FProducto.producto;
                        if (Model.Tipo == 0)
                        {
                            LLenarGrid(FProducto.producto);
                        }
                        else if (Model.Tipo == 1)
                        {
                            decimal cantidadAnterior = BuscarCantidad(item);
                            int     cantidadActual   = 0;
                            int     cantidadBusqueda = 0;
                            cantidadActual   = Convert.ToInt32(cantidadAnterior);
                            cantidadBusqueda = cantidadActual + Convert.ToInt32(item.CantidadProducto);
                            var result = await Model.CheckCantidadProducto(item.IdProducto, cantidadBusqueda, CurrentSession.IdSucursal);

                            if (result == -1)
                            {
                                LLenarGrid(FProducto.producto);
                            }
                            else if (result != -1)
                            {
                                CIDMessageBox.ShowAlert(Messages.SystemName, "No hay suficiente productos. La cantidad existente es: " + result.ToString(), TypeMessage.error);
                            }
                        }
                    }
                }
                else if (Model.Tipo == 2)
                {
                    errorProvider1.SetError(TipoControl, "Debe seleccionar un tipo");
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmEntradaSalidaAlmacen ~ pcMas_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
            }
        }
Ejemplo n.º 14
0
        private static void LoadUpdates()
        {
            Exception exception;

            try
            {
                using (AvtoritetEntities entities = new AvtoritetEntities())
                {
                    //if (!(entities.Database.Connection.State == ConnectionState.Closed))
                    //{
                    int?    settingVersion = entities.SettingUpdate.FirstOrDefault().SettingVersion;
                    Version version        = new Version(entities.VersionLog.FirstOrDefault().Value)
                    , version2             = new Version(JsonConvert.DeserializeObject <VersionEntity>(FileHelper.OpenFile("Version.json")).Version);
                    if (version > version2)
                    {
                        try {
                        } catch (Exception exception1) {
                            exception = exception1;
                            ErrorLogHelper.AddErrorInLog("LoadUpdates()", exception.Message + " | " + exception.StackTrace);
                        }
                    }
                    if (!System.IO.File.Exists("settingver.txt"))
                    {
                        System.IO.File.WriteAllText("settingver.txt", "1");
                    }
                    int num       = int.Parse(System.IO.File.ReadAllText("settingver.txt"));
                    int?nullable2 = settingVersion;
                    int num2      = num;
                    if ((nullable2.GetValueOrDefault() > num2) &&
                        (nullable2.HasValue == true))
                    {
                        launcherSettings = new SettingsFactory(categoryEventHandler).DownloadSettings(true, true);
                        System.IO.File.WriteAllText("settingver.txt", settingVersion.ToString());
                        HaveNewUpdate = true;
                    }
                    //}
                    //else
                    //ErrorLogHelper.AddErrorInLog("Обновление приложения - LoadUpdates() - ...", string.Format("Состояние БД={0}", entities.Database.Connection.State.ToString()));
                }
            }
            catch (Exception exception2)
            {
                exception = exception2;
                ErrorLogHelper.AddErrorInLog("Обновление приложения - LoadUpdates()", exception.Message + " | " + exception.StackTrace);
                MessageBox.Show(exception.Message + " | " + exception.StackTrace);
            }
        }
Ejemplo n.º 15
0
        private async void btnElimiarLista_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.SetError(IdListaMedicionControl, string.Empty);
                errorProvider1.SetError(btnElimiarLista, string.Empty);
                if (Model.IdListaMedicion > 0)
                {
                    var ListaOcupada = Model.ListaMedicion.Where(m => m.IdListaMedicion == Model.IdListaMedicion).Select(u => u.IdListaMedicion).ToList();
                    if (ListaOcupada.Count == 0)
                    {
                        if (CIDMessageBox.ShowAlertRequest(Messages.SystemName, Messages.ConfirmDeleteMessage) == DialogResult.OK)
                        {
                            var result = await Model.DeleteListaMedicion(CurrentSession.IdCuentaUsuario);

                            if (result == 1)
                            {
                                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.SuccessDeleteMessage, TypeMessage.correcto);
                                var ListaMedicion = await Model.GetListaMedicionsAsync();

                                Model.LlenarListaMedicion(ListaMedicion);
                                IdListaMedicionControl.SelectedValue = 0;
                                LimpiarPropiedades();
                                await Model.GetAll();
                            }
                            else
                            {
                                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorDeleteMessage, TypeMessage.error);
                            }
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(btnElimiarLista, "No puede borrar la lista por que se esta usando");
                    }
                }
                else
                {
                    errorProvider1.SetError(IdListaMedicionControl, "Debe seleccionar un valor de la lista");
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmDireccionesCliente ~ btnEliminarLista_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorDeleteMessage, TypeMessage.error);
            }
        }
Ejemplo n.º 16
0
 private void btnProducto_Click(object sender, EventArgs e)
 {
     try
     {
         FrmBusquedaProducto buscar = new FrmBusquedaProducto();
         buscar.ShowDialog();
         if (buscar.producto.IdProducto != 0)
         {
             AgregarProducto(buscar.producto);
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmPromocionMxN ~ btnProducto_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
     }
 }
Ejemplo n.º 17
0
        private async void FrmBuscarCompras_Load(object sender, EventArgs e)
        {
            try
            {
                this.IniciarBinding();
                await Model.ObtenerComprasCreadas(CurrentSession.IdSucursal);

                this.ActiveControl = this.ClaveControl;
                this.ClaveControl.Focus();
                this.rbBusquedaClave.Checked = true;
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmBuscarCompras() ~ FrmBuscarCompras_Load(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
            }
        }
Ejemplo n.º 18
0
 private void btnNuevo_Click_1(object sender, EventArgs e)
 {
     try
     {
         btnNuevo.Enabled = false;
         NuevoProducto();
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmEntradaSalidaAlmacen ~ pcMas_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
     finally
     {
         btnNuevo.Enabled = true;
     }
 }
Ejemplo n.º 19
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     try
     {
         if (CIDMessageBox.ShowAlertRequest(Constants.Messages.SystemName, Constants.Messages.ConfirmCancelInput) == DialogResult.OK)
         {
             grpBoxFormaPago.Enabled = false;
             LimpiarPropiedades();
             this.CleanErrors(errorProvider1, typeof(FormaPagoViewModel));
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmFormaPago ~ btnCancelar_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorAlCancelarFrm, TypeMessage.error);
     }
 }
Ejemplo n.º 20
0
        public string GetCookies(string url)
        {
            string result;

            Uri uri = new Uri(url);

            ConsoleHelper.Debug(string.Format("GetCookies() - url={0} || �ץולא={1} || �מסע={2} || אבס.={3} || כמך.={4} || פאיכ?={5}"
                                              , url
                                              , uri.Scheme
                                              , uri.Host
                                              , uri.AbsolutePath
                                              , uri.LocalPath
                                              , uri.IsFile));

            try
            {
                if (url.Contains(CatalogApi.UrlConstants.CitroenRoot) == true)
                {
                    result = RequestProcessor.CitroenPortal.GetCookies(url);
                }
                else if (url.Contains(CatalogApi.UrlConstants.PeugeotRoot) == true)
                {
                    result = RequestProcessor.PeugeotPortal.GetCookies(url);
                }
                else if (url.Contains(CatalogApi.UrlConstants.Partslink24Root))
                {
                    result = RequestProcessor.PartslinkPortal.GetCookies(url);
                }
                else if (url.Contains(CatalogApi.UrlConstants.ChevroletOpelGroupRoot))
                {
                    result = RequestProcessor.ChevroletPortal.GetCookies(url);
                }
                else
                {
                    throw new System.Exception(string.Format("Getting cookies error (url={0}) - ..", url));
                }
            }
            catch (System.Exception ex)
            {
                ErrorLogHelper.AddErrorInLog("GetCookies()", ex.Message + "|" + ex.StackTrace);
                ConsoleHelper.Error(string.Format("{0} || {1} || {2}", ex.Message, ex.StackTrace, ex.Data));
                result = string.Empty;
            }

            return(result);
        }
Ejemplo n.º 21
0
        private async void btnNuevo_Click(object sender, EventArgs e)
        {
            try
            {
                //GetPanel(new FrmNuevaPromocion());
                FrmNuevaPromocion nuevo = new FrmNuevaPromocion();
                nuevo.ShowDialog();
                await Model.GetAllPromocionAsync();

                this.SfGridPromocion.Refresh();
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmPromocion ~ btnNuevo_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
            }
        }
Ejemplo n.º 22
0
 public void OpenAsset(string assetName)
 {
     this._assetName = assetName;
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(PathHelper.FileinAssetFolder(assetName));
         string link = xdoc.SelectSingleNode("Data/Link").InnerText;
         this._exeHelper.OpenWebPage(link, "CHROME.EXE");
         //this._exeHelper.OpenWebPage(link, "IEXPLORE.EXE");
         //this._exeHelper.OpenWebPage(link);
     }
     catch (Exception exception)
     {
         ErrorLogHelper.Log(string.Concat("获取网址失败:", exception.Message));
     }
 }
Ejemplo n.º 23
0
        private async void FrmBuscarVentas_Load(object sender, EventArgs e)
        {
            try
            {
                await Model.GetVentaFechaDiaIdSucursal();

                if (Model.Listaventa.Count == 0)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmBuscarVentas() ~ FrmBuscarVentas_Load(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorLoadMessage, TypeMessage.error);
            }
        }
Ejemplo n.º 24
0
 private static void FreeOccupiedAccount()
 {
     try {
         if (!((AccountManager.Account == null) ||
               (string.IsNullOrEmpty(AccountManager.Account.Name) == true)))
         {
             RequestHelper.Client.FreeOccupiedAccount(AccountManager.Account.Name);
         }
         else
         {
             ;
         }
     } catch (Exception e) {
         ErrorLogHelper.AddErrorInLog(string.Format(@"MainWindow::FreeOccupiedAccount () - ...")
                                      , string.Format("{0} | {1}", e.Message, e.StackTrace));
     }
 }
Ejemplo n.º 25
0
        public void SaveErrorLogFileDoesNotThrow(Type exceptionType)
        {
            // Use reflection to create an exception of the given C# type.
            var exception = exceptionType.GetConstructor(Type.EmptyTypes)?.Invoke(null) as System.Exception;
            var errorLog  = new ManagedErrorLog
            {
                Id        = Guid.NewGuid(),
                ProcessId = 123
            };
            var mockDirectory = Mock.Of <Directory>();

            ErrorLogHelper.Instance._crashesDirectory = mockDirectory;
            Mock.Get(mockDirectory).Setup(d => d.EnumerateFiles(It.IsAny <string>())).Throws(exception);
            ErrorLogHelper.SaveErrorLogFiles(null, errorLog);

            // No exception should be thrown.
        }
Ejemplo n.º 26
0
 private void btnProducto_Click(object sender, EventArgs e)
 {
     try
     {
         FrmBusquedaProducto Producto = new FrmBusquedaProducto("");
         Producto.ShowDialog();
         if (Producto.producto.IdProducto != 0)
         {
             LLenarGridCompra(Producto.producto);
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmBuscarVenta ~ btnProducto_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
Ejemplo n.º 27
0
 private void bntnAgregarProvedor_Click(object sender, EventArgs e)
 {
     try
     {
         FrmProveedorACompra proveedor = new FrmProveedorACompra();
         proveedor.ShowDialog();
         if (proveedor.proveedor.IdProveedor != Guid.Empty)
         {
             LlenarProveedor(proveedor.proveedor);
         }
     }
     catch (Exception ex)
     {
         ErrorLogHelper.AddExcFileTxt(ex, "FrmBuscarVenta ~ btnSeleccionar_Click(object sender, EventArgs e)");
         CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorFormulario, TypeMessage.error);
     }
 }
        //Definition to Initialize AWS Configurations=>Required for image uploads
        public void InitAWSS3Configurations()
        {
            FormsAuthenticationTicket ticket = null;

            try
            {
                HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
                ticket = FormsAuthentication.Decrypt(authCookie.Value);

                //Bucket configurations
                string AWSProfileName = System.Configuration.ConfigurationManager.AppSettings["AWSProfileName"];
                string AWSAccessKey   = System.Configuration.ConfigurationManager.AppSettings["AWSAccessKey"];
                string AWSSecretKey   = System.Configuration.ConfigurationManager.AppSettings["AWSSecretKey"];
                string BucketName     = System.Configuration.ConfigurationManager.AppSettings["BucketName"];
                string BucketRegion   = System.Configuration.ConfigurationManager.AppSettings["BucketRegion"];
                string BucketStartURL = System.Configuration.ConfigurationManager.AppSettings["BucketStartURL"];

                //File Upload Paths
                string ErrorImagePath        = System.Configuration.ConfigurationManager.AppSettings["ErrorImagePath"];
                string OtherErrorFilePath    = System.Configuration.ConfigurationManager.AppSettings["OtherErrorFilePath"];
                string SolutionImagePath     = System.Configuration.ConfigurationManager.AppSettings["SolutionImagePath"];
                string OtherSolutionFilePath = System.Configuration.ConfigurationManager.AppSettings["OtherSolutionFilePath"];


                ViewBag.AWSProfileName = AWSProfileName;
                ViewBag.AWSAccessKey   = AWSAccessKey;
                ViewBag.AWSSecretKey   = AWSSecretKey;
                ViewBag.BucketName     = BucketName;
                ViewBag.BucketRegion   = BucketRegion;
                ViewBag.BucketStartURL = BucketStartURL;

                ViewBag.ErrorImagePath        = ErrorImagePath;
                ViewBag.OtherErrorFilePath    = OtherErrorFilePath;
                ViewBag.SolutionImagePath     = SolutionImagePath;
                ViewBag.OtherSolutionFilePath = OtherSolutionFilePath;
            }
            catch (Exception ex)
            {
                currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                methodName = sf.GetMethod().Name;
                ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex);
            }
        }
Ejemplo n.º 29
0
        private async void btnGuarda_Click(object sender, EventArgs e)
        {
            try
            {
                errorProvider1.SetError(BtnAgregar, string.Empty);
                btnGuarda.Enabled = false;
                this.CleanErrors(errorProvider1, typeof(ListaMedicionViewModel));
                var ValidationsResult = Model.Validate();
                if (ValidationsResult.IsValid)
                {
                    if (Model.ListaValores.Count > 0)
                    {
                        DataTable tabla  = ObtenerTabla(Model.ListaValores.ToList());
                        var       result = await Model.GuardarCambios(CurrentSession.IdCuentaUsuario, tabla);

                        if (result.IdListaMedicion > 0)
                        {
                            CIDMessageBox.ShowAlert(Messages.SystemName, Messages.SuccessMessage, TypeMessage.correcto);
                            LimpiarPropiedades();
                            Close();
                        }
                        else
                        {
                            CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(BtnAgregar, "Debe agregar por lo menos un valor a la lista");
                    }
                }
                else
                {
                    this.ShowErrors(errorProvider1, typeof(ListaMedicionViewModel), ValidationsResult);
                }
            }
            catch (Exception ex)
            {
                ErrorLogHelper.AddExcFileTxt(ex, "FrmDireccionesCliente ~ btnGuarda_Click(object sender, EventArgs e)");
                CIDMessageBox.ShowAlert(Messages.SystemName, Messages.ErrorMessage, TypeMessage.error);
            }
            finally {
                btnGuarda.Enabled = true;
            }
        }
Ejemplo n.º 30
0
        public void GetStoredExceptionFile()
        {
            var id           = Guid.NewGuid();
            var expectedFile = Mock.Of <File>();
            var fileList     = new List <File> {
                expectedFile
            };
            var mockDirectory = Mock.Of <Directory>();

            ErrorLogHelper.Instance._crashesDirectory = mockDirectory;
            Mock.Get(mockDirectory).Setup(d => d.EnumerateFiles($"{id}.exception")).Returns(fileList);

            // Retrieve the error log by the ID.
            var exceptionLogFile = ErrorLogHelper.GetStoredExceptionFile(id);

            // Validate the contents.
            Assert.AreSame(expectedFile, exceptionLogFile);
        }