public SimpleContainer(ConfigurationRegistry configurationRegistry, ContainerContext containerContext,
     LogError errorLogger)
 {
     Configuration = configurationRegistry;
     implementationSelectors = configurationRegistry.GetImplementationSelectors();
     dependenciesInjector = new DependenciesInjector(this);
     this.containerContext = containerContext;
     this.errorLogger = errorLogger;
 }
 public SimpleContainer(GenericsAutoCloser genericsAutoCloser, ConfigurationRegistry configurationRegistry,
     TypesList typesList, LogError errorLogger, LogInfo infoLogger,
     Dictionary<Type, Func<object, string>> valueFormatters)
 {
     Configuration = configurationRegistry;
     implementationSelectors = configurationRegistry.GetImplementationSelectors();
     this.genericsAutoCloser = genericsAutoCloser;
     this.typesList = typesList;
     dependenciesInjector = new DependenciesInjector(this);
     this.errorLogger = errorLogger;
     containerContext = new ContainerContext
     {
         infoLogger = infoLogger,
         typesList = typesList,
         valueFormatters = valueFormatters
     };
 }
Example #3
0
        public ExplorerHeader(Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser explorerBrowser)
        {
            // Initialize our logging delegates
            logInfo += delegate(string message) { };
            logError += delegate(string message) { };

            this.explorerBrowser = explorerBrowser;

            this.Paint += ExplorerHeader_Paint;

            InitializeComponent();

            this.height = this.Size.Height;
           
             // Optimize Painting.
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);

            // initialize known folder combo box
            List<string> knownFolderList = new List<string>();
            foreach (IKnownFolder folder in Microsoft.WindowsAPICodePack.Shell.KnownFolders.All)
            {
                knownFolderList.Add(folder.CanonicalName);
            }
            knownFolderList.Sort();
            KnownFolders = knownFolderList.ToArray();

            this.pathEdit.Items.AddRange(KnownFolders);

            // setup explorerBrowser navigation events
            this.explorerBrowser.NavigationFailed += new EventHandler<NavigationFailedEventArgs>(this.explorerBrowser_NavigationFailed);
            this.explorerBrowser.NavigationComplete += new EventHandler<NavigationCompleteEventArgs>(this.explorerBrowser_NavigationComplete);

            // set up Navigation log event and button state
            this.explorerBrowser.NavigationLog.NavigationLogChanged += new EventHandler<NavigationLogEventArgs>(this.NavigationLog_NavigationLogChanged);

            this.explorerNavigationButtons1.HasLeftHistroy = false;
            this.explorerNavigationButtons1.HasRightHistroy = false;
            this.explorerNavigationButtons1.LeftButtonClick += LeftButtonClick;
            this.explorerNavigationButtons1.RightButtonClick += RightButtonClick;
            this.explorerNavigationButtons1.DropDownClick += DropDownClick;

            this.pathEdit.Click += navigateButton_Click;

            picDeleteHistory.BackgroundImage = Resources.DeleteHistory;
        }
Example #4
0
        public JsonResult GetValidSapId(string SAPID)
        {
            string userkey   = ConfigurationManager.AppSettings["userkey"];
            string uid       = ConfigurationManager.AppSettings["uid"];
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                string ipaddress   = Request.UserHostAddress;
                string BrowserUsed = Request.UserAgent;

                Employer.Employer employer = new Employer.Employer();
                var validDetails           = employer.ADAuth(SAPID, BrowserUsed, ipaddress, "", userkey, uid);
                var sapDetails             = validDetails.Split('~');
                return(Json(new { data = sapDetails }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/GetValidSapId", "Admin", "GetValidSapId", "ADAuth Error", ex.Message.ToString(), 0);
                throw new Exception(ex.Message.ToString());
            }
        }
Example #5
0
        public void Delete(int ta210_iddocupreventa)
        {
            BLL.DocumentacionPreventa cDP = new BLL.DocumentacionPreventa();

            try
            {
                cDP.Delete(ta210_iddocupreventa);
            }
            catch (ValidationException vex)
            {
                throw new ValidationException(System.Uri.EscapeDataString(vex.Message));
            }
            catch (Exception ex)
            {
                LogError.LogearError("Ocurrió un error eliminando el documento", ex);
                throw new Exception(System.Uri.EscapeDataString("Ocurrió un error eliminando el documento"));
            }

            finally
            {
                cDP.Dispose();
            }
        }
Example #6
0
        protected void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                if (IsValid)
                {
                    // if txtbox not empty check if value exist
                    int count = Category.getByName(txt_categoryName.Text).Rows.Count;
                    if (count == 0)
                    {
                        //if not exist add to db and bind gv
                        Category.add(txt_categoryName.Text);
                        gv_category.DataSource = Category.getAll();
                        gv_category.DataBind();

                        //to crate img folder for this category
                        var folder = Server.MapPath("~/prodimg/" + txt_categoryName.Text);
                        if (!Directory.Exists(folder))
                        {
                            Directory.CreateDirectory(folder);
                        }
                        txt_categoryName.Text = "";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "show", "showDialog();", true);
                    }
                    else
                    {
                        //if category exist
                        lbl_error.Text        = "This Category already exist";
                        txt_categoryName.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.Error(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
        }
Example #7
0
        private static void ConvertFiles()
        {
            try
            {
                Console.WriteLine("LOOKING FOR DELTA EEG FILES TO CONVERT...");
                string[] files = System.IO.Directory.GetFiles(System.Configuration.ConfigurationSettings.AppSettings["DeltaEEGFileFolder"]);
                Console.WriteLine(string.Format("{0} {1}", files.Length, "FILES"));

                foreach (string path in files)
                {
                    Uri uri = new Uri(path);

                    Console.WriteLine(string.Format("{0} {1}", path, "processed..."));

                    FileData fileData = Coherence5LE.OpenFile(path);
                    Coherence5LE.SaveFile(fileData);

                    string destPath = string.Format(@"{0}{1}", System.Configuration.ConfigurationSettings.AppSettings["BACKUPDeltaEEGFileFolder"], uri.Segments[uri.Segments.Length - 1]);

                    if (File.Exists(destPath))
                    {
                        File.Delete(destPath);
                    }

                    File.Move(path, destPath);
                }

                if (files.Length > 0)
                {
                    LogError.Write(string.Format("{0} : {1} {2}", DateTime.Now.ToShortTimeString(), files.Length, "files processed"));
                }
            }
            catch (Exception ex)
            {
                LogError.Write(ex);
            }
        }
Example #8
0
        public ActionResult AddItemContract(item_Contract itmCont)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var ff = db.item_Contract.FirstOrDefault(a => a.Cont_No == itmCont.Cont_No && a.Code == itmCont.Code);
                    if (ff != null)
                    {
                        ff.Quantity += 1;
                        db.SaveChanges();
                        int Cust_Id = int.Parse(TempData["Cust_Id"].ToString());
                        return(RedirectToAction("viewCont", "Customers", new { Cont_No = itmCont.Cont_No, Cust_Id }));
                    }

                    else if (ff == null)
                    {
                        var gg = db.item_Contract.FirstOrDefault(a => a.Cont_No == itmCont.Cont_No);
                        itmCont.Quantity = 1;
                        db.item_Contract.Add(itmCont);
                        db.SaveChanges();
                        int Cust_Id = int.Parse(TempData["Cust_Id"].ToString());
                        return(RedirectToAction("viewCont", "Customers", new { Cont_No = itmCont.Cont_No, Cust_Id }));
                    }
                }

                List <Item> itms   = db.Items.ToList <Item>();
                SelectList  itemsl = new SelectList(itms, "Code", "name");
                ViewBag.Code = itemsl;
                return(View(itmCont));
            }
            catch (Exception ex)
            {
                LogError.Error(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(RedirectToAction("ErrorPage", "Home"));
            }
        }
Example #9
0
        public Xe GetChiTietXe(string SoHieuXe)
        {
            try
            {
                DataTable dt = new DataTable();


                dt = new Data.DM.Xe().GetChiTietMotXe(SoHieuXe);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    Xe objXe = new Xe();
                    objXe.SoHieuXe     = dr["PK_SoHieuXe"] == DBNull.Value ? string.Empty : dr["PK_SoHieuXe"].ToString();
                    objXe.BienKiemSoat = dr["BienKiemSoat"] == DBNull.Value ? string.Empty : dr["BienKiemSoat"].ToString();
                    objXe.SoMay        = dr["SoMay"] == DBNull.Value ? string.Empty : dr["SoMay"].ToString();
                    objXe.SoKhung      = dr["SoKhung"] == DBNull.Value ? string.Empty : dr["SoKhung"].ToString();
                    objXe.LoaiXeID     = dr["FK_LoaiXeID"] == DBNull.Value ? 0 : int.Parse(dr["FK_LoaiXeID"].ToString());
                    objXe.TenLoaiXe    = dr["TenLoaiXe"].ToString();
                    objXe.GaraID       = dr["FK_GaraID"] == DBNull.Value ? 0 : int.Parse(dr["FK_GaraID"].ToString());
                    objXe.GaraName     = dr["GaraName"].ToString();
                    objXe.SoCho        = dr["SoCho"] == DBNull.Value ?  4 :   int.Parse(dr["SoCho"].ToString());
                    objXe.TenNhanVien  = dr["TenNhanVien"] == DBNull.Value ? string.Empty : dr["TenNhanVien"].ToString();
                    objXe.DienThoai    = dr["DienThoai"] == DBNull.Value ? string.Empty : dr["DienThoai"].ToString();
                    return(objXe);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetChiTietXe", ex);
                return(null);
            }
        }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             Subrubro         Datos = this.ObtenerDatos();
             Catalogo_Negocio cn    = new Catalogo_Negocio();
             cn.ABCGastosSubRubros(Datos);
             if (Datos.Completado)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this._DatosSubRubro = Datos;
                 this.DialogResult   = DialogResult.OK;
             }
             else
             {
                 List <Error> LstError = new List <Error>();
                 LstError.Add(new Error {
                     Numero = 1, Descripcion = "El número de tarjeta ingresado ya existe. ", ControlSender = this.txtSubRubro
                 });
                 this.MostrarMensajeError(LstError);
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevaTarjeta ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public bool validateUserApi(string user, string password)
        {
            try
            {
                object           objresponse = new object();
                bool             response    = false;
                DataAdminUserApi datUserApi  = new DataAdminUserApi();

                objresponse = datUserApi.validateUserApi(user, password);

                if (objresponse != null)
                {
                    if (objresponse.ToString() == "ok")
                    {
                        response = true;
                    }
                }

                return(response);
            }
            catch (Exception ex) {
                // Registrar el error real
                DataLogError datError = new DataLogError();
                LogError     error    = new LogError();

                error.module       = "ADMIN";
                error.method       = "validateUserApi";
                error.errorMessage = ex.Message;
                error.moreInfo     = null;

                datError.newError(error);

                // Modificar la excepción
                Exception exResult = new Exception("Error validando usuario API");
                throw exResult;
            }
        }
 private void btnElegir_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(this.IDProveedor))
         {
             frmSeleccionarMobiliario ElegirMobiliario = new frmSeleccionarMobiliario();
             ElegirMobiliario.Datos.IDProveedor = this.IDProveedor;
             ElegirMobiliario.Location          = this.txtMobiliario.PointToScreen(new Point());
             ElegirMobiliario.Location          = new Point(ElegirMobiliario.Location.X - 1, ElegirMobiliario.Location.Y - 2);
             ElegirMobiliario.ShowDialog();
             ElegirMobiliario.Dispose();
             if (ElegirMobiliario.DialogResult == DialogResult.OK)
             {
                 Mobiliario Aux = ElegirMobiliario.Datos;
                 this.txtMobiliario.Text   = Aux.Descripcion;
                 this.txtMarca.Text        = Aux.Marca;
                 this.txtModelo.Text       = Aux.Modelo;
                 this.txtPrecio.Text       = string.Format("{0:c}", 0);
                 this.txtPrecioUSD.Text    = string.Format("{0:c}", 0);
                 this.txtIva.Text          = string.Format("{0:c}", 0);
                 this.numericUpDown1.Value = 1;
                 this.Actual = Aux;
                 this.txtPrecio.Focus();
             }
         }
         else
         {
             MessageBox.Show("Debe elegir un proveedor.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevaCompraMobiliario ~ btnElegirProducto_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             CategoriaCheckList         Datos = this.ObtenerDatos();
             CategoriaCheckList_Negocio cn    = new CategoriaCheckList_Negocio();
             cn.ABCCategoriaChecKList(Datos);
             if (Datos.Completado)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this._DatosCategoria = Datos;
                 this.DialogResult    = DialogResult.OK;
             }
             else if (Datos.Resultado == -2)
             {
                 MessageBox.Show("El orden ya existe para una categoria", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 MessageBox.Show("Ocurrió un error al guardar los datos.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoCategoriaCheklist ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void LoadPendingPayments()
        {
            try
            {
                Payment _obj       = new Payment();
                DataSet dstPayment = _obj.GetPendingPayments(Convert.ToInt32(txtNumber.Text.Trim()), (strFormName.Equals("MONTHLY AND LOAN EMI PAYMENT") ? 0 : 1));
                dstPayment.Tables[0].Columns.Add("TOTAL", typeof(string));
                decimal dcmlTotal = 0;
                foreach (DataRow row in dstPayment.Tables[0].Rows)
                {
                    dcmlTotal   += Convert.ToDecimal(row["PAYMENT_AMOUNT"].ToString()) + Convert.ToDecimal(row["PANELTY"].ToString());
                    row["TOTAL"] = (Convert.ToDecimal(row["PAYMENT_AMOUNT"].ToString()) + Convert.ToDecimal(row["PANELTY"].ToString())).ToString();
                }

                dgvPayment.DataSource = dstPayment.Tables[0];
                SetDataGridProperties();
                lblAmount.Text         = dcmlTotal.ToString() + "/-";
                btnSearch.Enabled      = false;
                lblAmountLabel.Visible = true;
                lblAmount.Visible      = true;
                btnClear.Enabled       = true;
                if (dgvPayment.Rows.Count > 0)
                {
                    btnSave.Enabled    = true;
                    lblPayment.Visible = true;
                    dtpPayment.Visible = true;
                }
                else
                {
                    MessageBox.Show("No amount due for selected member", "No amount due", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                LogError.LogEvent("Get Pending Payments", ex.Message, "Get Pending Payments");
            }
        }
 private void btnElegirProducto_Click(object sender, EventArgs e)
 {
     try
     {
         Usuario Empl     = this.ObtenerEmpleado();
         int     TipoForm = 0;
         if (string.IsNullOrEmpty(Empl.IDEmpleado))
         {
             TipoForm = 7;
         }
         else
         {
             TipoForm = 6;
         }
         frmSeleccionarProducto ElegirProducto = new frmSeleccionarProducto(TipoForm);
         ElegirProducto.Location = this.txtProducto.PointToScreen(new Point());
         ElegirProducto.Location = new Point(ElegirProducto.Location.X - 1, ElegirProducto.Location.Y - 2);
         ElegirProducto.ShowDialog();
         ElegirProducto.Dispose();
         if (ElegirProducto.DialogResult == DialogResult.OK)
         {
             Producto Aux = ElegirProducto.Datos;
             Actual = Aux;
             this.txtProducto.Text = Aux.NombreProducto;
             this.txtCantidad.Focus();
         }
         else
         {
             this.Actual           = new Producto();
             this.txtProducto.Text = string.Empty;
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoPedidoProducto ~ btnElegirProducto_Click");
     }
 }
 private void btnActivar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvPromociones.SelectedRows.Count == 1)
         {
             Promocion         Datos   = this.ObtenerDatosPromocion();
             Promocion_Negocio PromNeg = new Promocion_Negocio();
             bool Complete             = PromNeg.CambiarEstatusPromocion(Comun.Conexion, Datos.IDPromocion, Comun.IDUsuario);
             if (Complete)
             {
                 if (Datos.IDEstatus == 1)
                 {
                     MessageBox.Show("Promoción desactivada.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else if (Datos.IDEstatus == 2)
                 {
                     MessageBox.Show("Promoción activada.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 LlenarGrid();
             }
             else
             {
                 MessageBox.Show("Ocurrió un error al eliminar el registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmPromociones ~ btnActivar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void SetDataToForm()
        {
            try
            {
                if (gridView.FocusedRowHandle > 0)
                {
                    G_POI = (POICommon)gridView.GetFocusedRow();

                    //string kinhDo = objPOICommon.Lng;
                    //string viDo = objPOICommon.Lat;
                    txtKinhDo.Text  = G_POI.Lng.ToString();
                    txtViDo.Text    = G_POI.Lat.ToString();
                    txtDiaChi.Text  = G_POI.DiaChi;
                    lblInfo.Text    = G_POI.NameVN;
                    txtVietTat.Text = G_POI.VietTat;
                    txtNameVN.Text  = G_POI.NameVN;
                    G_ID            = G_POI.ID;
                    if (G_POI.Lat > 0 && G_POI.Lng > 0)
                    {
                        MainMap.AddMarkerBlueCircle(Convert.ToDouble(G_POI.Lng), Convert.ToDouble(G_POI.Lat), lblInfo.Text, true);
                        //currentMarker = MainMap.marker;
                        //currentMarker == MainMap.ma
                    }
                    else
                    {
                        if (MainMap.Overlays[1] != null && MainMap.Overlays[1].Markers != null && MainMap.Overlays[1].Markers.Count > 0)
                        {
                            MainMap.Overlays[1].Markers.Clear();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("CapNhatToaDo SetDataToForm", ex);
            }
        }
Example #18
0
        protected void gvViewSPD_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                lblMessage.Visible = false;
                string[] command = e.CommandArgument.ToString().Split(';');
                ViewState["NoSPD"] = command[0];
                //split parameter nospd, nrpapproval, index
                switch (e.CommandName)
                {
                case "Detail":
                    string URL = "~/newFormRequestDetail.aspx?encrypt=" + Encrypto.Encrypt(e.CommandArgument.ToString());
                    URL = Page.ResolveClientUrl(URL);
                    ScriptManager.RegisterStartupScript(this, GetType(), "openDetail", "openDetail('" + URL + "');", true);
                    break;

                case "Approve":
                    lblMessage.Text = approvalSPDUrl.ChangeStatus(command[0], e.CommandName, command[1], command[2]);
                    break;

                case "Reject":
                    lblMessage.Text = approvalSPDUrl.ChangeStatus(command[0], e.CommandName, command[1], command[2]);

                    break;

                default:
                    break;
                }

                lblMessage.Visible = true;
                bindFind();
            }
            catch (Exception ex)
            {
                LogError.Log_Error(ex, "copy file request", ViewState["NoSPD"].ToString());
            }
        }
Example #19
0
 private void btnCortesia_Click(object sender, EventArgs e)
 {
     try
     {
         frmAutorizacion Autorizar = new frmAutorizacion(1);
         Autorizar.ShowDialog();
         if (Autorizar.DialogResult == DialogResult.OK)
         {
             string        _IDUsuarioAutoriza = Autorizar.IDUsuario;
             Venta_Negocio VenNeg             = new Venta_Negocio();
             Cobro         DatosAux           = new Cobro {
                 Conexion    = Comun.Conexion, IDVenta = DatosCobro.IDVenta, IDCaja = Comun.IDCaja,
                 IDCajero    = Comun.IDUsuario, TotalAPagar = DatosCobro.TotalAPagar,
                 Comision    = DatosCobro.Comision, Pago = 0, Cambio = 0, RequiereFactura = false,
                 PuntosVenta = 0, IDUsuarioAutoriza = _IDUsuarioAutoriza, IDUsuario = Comun.IDUsuario
             };
             VenNeg.CobroVentaServiciosCortesia(DatosAux);
             if (DatosAux.Completado)
             {
                 Ticket Imprimir = new Ticket(2, 1, DatosAux.IDVenta);
                 Imprimir.ImprimirTicket();
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("Ocurrió un error al guardar los datos. Código el error: " + DatosAux.Resultado, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Exception AuxEx = new Exception("Ocurrió un error al guardar los datos. código del Error: " + DatosAux.Resultado);
                 LogError.AddExcFileTxt(AuxEx, "frmConcluirCobro ~ btnCobrar_Click");
             }
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmResumenVenta ~ btnCortesia_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #20
0
 private void btnBuscarCliente_Click(object sender, EventArgs e)
 {
     try
     {
         string IDAnterior = this.DatosCliente.IDCliente;
         frmSeleccionarCliente ElegirCliente = new frmSeleccionarCliente();
         ElegirCliente.Location = this.txtNombreCliente.PointToScreen(new Point());
         ElegirCliente.Location = new Point(ElegirCliente.Location.X - 1, ElegirCliente.Location.Y - 2);
         ElegirCliente.ShowDialog();
         ElegirCliente.Dispose();
         if (ElegirCliente.DialogResult == DialogResult.OK)
         {
             Cliente Aux = ElegirCliente.Datos;
             DatosCliente = Aux;
             this.txtNombreCliente.Text = Aux.Nombre;
             this.txtNumTarjeta.Text    = Aux.FolioTarjeta;
             this.txtMonedero.Text      = string.Format("{0:c}", Aux.SaldoMonedero);
         }
         else
         {
             this.txtPromociones.Visible = false;
             this.DatosCliente           = new Cliente();
             this.txtNombreCliente.Text  = string.Empty;
             this.txtNumTarjeta.Text     = string.Empty;
             this.txtMonedero.Text       = string.Format("{0:c}", 0);
         }
         if (!string.IsNullOrEmpty(this.IDVale) && !string.IsNullOrEmpty(IDAnterior))
         {
             this.btnRemoverVale_Click(this.btnRemoverVale, new EventArgs());
         }
         this.DibujarTotales(this.CalcularTotales());
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmVentaDirecta ~ btnBuscarCliente_Click");
     }
 }
Example #21
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             Usuario         Datos = this.ObtenerDatos();
             Usuario_Negocio CN    = new Usuario_Negocio();
             CN.ABCCuentaUsuario(Datos);
             if (Datos.Completado)
             {
                 MessageBox.Show("Datos guardados correctamente.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this._DatosUsuario = Datos;
                 this.DialogResult  = DialogResult.OK;
             }
             else
             {
                 List <Error> LstError = new List <Error>();
                 LstError.Add(new Error {
                     Numero = 1, Descripcion = "La cuenta de usuario ya existe.", ControlSender = this
                 });
                 this.MostrarMensajeError(LstError);
             }
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmCuentaEmpleado ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #22
0
        public ActionResult CreateRole(UserRoles role)
        {
            string LoginUser = (string)Session["LoginSAPID"];

            try
            {
                string userkey = ConfigurationManager.AppSettings["userkey"];
                string uid     = ConfigurationManager.AppSettings["uid"];

                Employer.Employer employer = new Employer.Employer();

                var createRole = employer.CreateRole(role.Name, LoginUser, userkey, uid);

                var createStatus = createRole.Split('~');
                if (createStatus[0] != "01")
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    //return RedirectToAction("Roles");
                    return(View());
                }
                else
                {
                    TempData["error"] = createStatus[1];
                    ViewBag.Error     = TempData["error"];
                    return(View());
                }
            }
            catch (Exception ex)
            {
                LogError logerror = new LogError();
                logerror.ErrorLog("", LoginUser, "", "Admin/CreateRole", "Admin", "CreateRole", "CreateRole Error", ex.Message.ToString(), 0);
                TempData["error"] = ex.Message.ToString();
                ViewBag.Error     = TempData["error"];
                return(View());
            }
        }
Example #23
0
        public ResponseAdminRole adminRole(RequestAdminRole request)
        {
            ResponseAdminRole response = new ResponseAdminRole();

            try
            {
                LogicAdminRole logicRole = new LogicAdminRole();
                request.dateRegister = System.DateTime.Now;
                request.dateUpdate   = System.DateTime.Now;

                response = logicRole.adminRole(request);
            }
            catch (System.Data.SqlClient.SqlException exSql)
            {
                // Cuando sea una excepción por SQL ya vendrá el mensaje de error controlado
                response.code    = exSql.ErrorCode;
                response.message = exSql.Message;
                response.status  = exSql.State;
            }
            catch (Exception ex) {
                // Registrar el error real
                LogicLogError logicError = new LogicLogError();
                LogError      error      = new LogError();

                error.module       = "ADMIN";
                error.method       = "adminRole";
                error.errorMessage = ex.Message;
                error.moreInfo     = request.id.ToString();

                logicError.newError(error);

                response.code    = -1;
                response.message = "Error no controlado, favor consultar con el administrador del sistema.";
            }

            return(response);
        }
 private void NhapDuLieuVaoTruyenDi(bool isAddnew)
 {
     try
     {
         if (isAddnew)
         {
             frmSuaVietTat frmSuaVietTat = new frmSuaVietTat();
             frmSuaVietTat.ShowDialog(this);
             G_NameVN = frmSuaVietTat.G_NameVN;
             if (G_NameVN != "")
             {
                 LoadAllRoad("", 0);
             }
         }
         else
         {
             gridVietTatTenDuong.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
             if (gridVietTatTenDuong.SelectedItems.Count > 0 && gridVietTatTenDuong.CurrentRow.RowIndex >= 0)
             {
                 RoadEntity objRoad = (RoadEntity)(gridVietTatTenDuong.SelectedItems[0]).GetRow().DataRow;
                 using (frmSuaVietTat frmSuaVietTat = new frmSuaVietTat(objRoad))
                 {
                     if (frmSuaVietTat.ShowDialog(this) == DialogResult.OK)
                     {
                         G_NameVN = frmSuaVietTat.G_NameVN;
                         frmSuaVietTat.Close();
                     }
                 }
                 LoadAllRoad("", 0);
             }
         }
     }
     catch (Exception ex)
     {
         LogError.WriteLogError("NhapDuLieuVaoTruyenDi: ", ex);
     }
 }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         this.txtMensajeError.Visible = false;
         List <Error> Errores = this.ValidarDatos();
         if (Errores.Count == 0)
         {
             this.Visible = false;
             ReporteComprasPorProveedor         Datos = this.ObtenerDatos();
             ReporteComprasPorProveedor_Negocio Neg   = new ReporteComprasPorProveedor_Negocio();
             int IDReporte = Neg.GenerarReporteComprasPorProveedor(Comun.Conexion, Datos.FechaInicio, Datos.FechaFin, Comun.IDUsuario);
             if (IDReporte > 0)
             {
                 //Generar el reporte
                 frmVerReporteComprasPorProveedor VerReporte = new frmVerReporteComprasPorProveedor(IDReporte);
                 VerReporte.ShowDialog();
                 VerReporte.Dispose();
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("Ocurrió un error al generar el reporte.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             this.Visible = true;
         }
         else
         {
             this.MostrarMensajeError(Errores);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmNuevoReporteComprasPorProveedor ~ btnGuardar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #26
0
        public JsonResult GetCiudadesCMB(int?country)
        {
            try
            {
                //var lstCMB = new List<CatCityTodosCMB_Result>();
                var lstCMB = new List <CatCityByCountryCMB_Result>();

                using (ASNContext ctx = new ASNContext())
                {
                    ctx.Database.CommandTimeout = int.Parse(ConfigurationManager.AppSettings["TimeOutMinutes"]);
                    //lstCMB = ctx.CatCityTodosCMB().ToList();
                    lstCMB = ctx.CatCityByCountryCMB(country).ToList();
                }

                return(Json(lstCMB, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                MyCustomIdentity usuario = (MyCustomIdentity)User.Identity;
                LogError         log     = new LogError();
                log.RecordError(ex, usuario.UserInfo.Ident.Value);
                return(Json(""));
            }
        }
 private void btnImprimir_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvProductos.Rows.Count > 0)
         {
             PrintDialog Aux = new PrintDialog();
             if (Aux.ShowDialog(this) == DialogResult.OK)
             {
                 ImpresionReporte ImpRep = new ImpresionReporte();
                 ImpRep.Run(@"..\..\Informes\ExistenciaProductos.rdlc", this.GenerarLista(), Aux.PrinterSettings);
             }
         }
         else
         {
             MessageBox.Show("No hay registros para impresión.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmInventario ~ btnImprimir_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #28
0
        public async Task <IActionResult> Create([FromBody] ContaAReceberResource contaAReceberResource)
        {
            if (contaAReceberResource == null)
            {
                return(NotFound());
            }
            try
            {
                var contaAReceber = new ContaAReceber();
                if (ModelState.IsValid)
                {
                    contaAReceber = ContaAReceberMapper.ResourceToModel(contaAReceberResource, contaAReceber);
                }
                _unitOfWork.ContasAReceber.Add(contaAReceber);
                await _unitOfWork.CompleteAsync();

                return(Ok(contaAReceber));
            }
            catch (Exception exception)
            {
                LogError.LogErrorWithSentry(exception);
                return(BadRequest());
            }
        }
Example #29
0
 private void loginAsync()
 {
     IsValidUser = false;
     if (ServerUtils.send("/validateUser", "user="******"&pwd=" + FileUtils.getActualUserpwd()))
     {
         try
         {
             System.IO.StreamReader reader = new System.IO.StreamReader(ServerUtils.getStream());
             string returnValue            = reader.ReadToEnd();
             IsValidUser = (returnValue != null && returnValue.Equals("true"));
             if (!IsValidUser)
             {
                 if (returnValue != null && returnValue.Equals("block"))
                 {
                     MessageDialogError.ImprimirAsync("El usuario esta bloqueado consulte al Administrador del Sistema para que pueda restablecer la contraseña.");
                 }
                 else
                 {
                     MessageDialogError.ImprimirAsync("Usuario y / o Clave Incorrecta");
                 }
             }
         }
         catch (System.Exception e)
         {
             MessageDialogError.ImprimirAsync(e.Message);
             LogError.CustomErrorLog(e);
             IsValidUser = false;
         }
     }
     else
     {
         MessageDialogError.ImprimirAsync("Falló la conexión con el servidor.");
         IsValidUser = false;
     }
     ServerUtils.close();
 }
 private void btnAsignarCategoria_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvUsuario.SelectedRows.Count == 1)
         {
             Usuario DatosAux = this.ObtenerDatosUsuario();
             if (!string.IsNullOrEmpty(DatosAux.IDEmpleado))
             {
                 if (DatosAux.AltaNominal)
                 {
                     frmCateEmpleadoAsignarCategoria CambiarCategoria = new frmCateEmpleadoAsignarCategoria(DatosAux);
                     CambiarCategoria.ShowDialog();
                     CambiarCategoria.Dispose();
                     if (CambiarCategoria.DialogResult == DialogResult.OK)
                     {
                         this.LlenarGridUsuario(false);
                     }
                 }
                 else
                 {
                     MessageBox.Show("El empleado tiene que estar dado de alta nominal.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
         else
         {
             MessageBox.Show("Seleccione un registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmCatEmpleado ~ btnAsignarCategoria_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #31
0
        private void txt_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                TextBox Aux = (TextBox)sender;
                if (e.KeyChar == 13)
                {
                    switch (Aux.Name)
                    {
                    case "txtUsuario":
                        this.txtContraseña.Focus();
                        break;

                    case "txtContraseña":
                        this.btnLogin_Click(sender, e);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmLogin ~ txtContraseña_KeyPress");
            }
        }
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvUsuario.SelectedRows.Count == 1)
         {
             Usuario DatosAux = this.ObtenerDatosUsuario();
             if (!string.IsNullOrEmpty(DatosAux.IDEmpleado))
             {
                 this.Visible = false;
                 frmNuevoEmpleado Empleado = new frmNuevoEmpleado(DatosAux);
                 Empleado.ShowDialog();
                 Empleado.Dispose();
                 if (Empleado.DialogResult == DialogResult.OK)
                 {
                     if (Empleado.DatosUsuario.Completado)
                     {
                         this.ModificarDatos(Empleado.DatosUsuario);
                     }
                 }
                 this.Visible = true;
                 this.LlenarGridUsuario(false);
             }
         }
         else
         {
             MessageBox.Show("Seleccione un registro.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmCatEmpleado ~ btnModificar_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.Visible = true;
     }
 }
        /// <summary>
        /// Khởi tạo thông tin bắt số cuộc gọi đến từ hệ thống Open Space Siemens
        /// </summary>
        /// <param name="serverNameAddress"></param>
        /// <param name="userNameWindowsLogin"></param>
        /// <param name="userNamePBXPMĐHExtensionID"></param>
        /// <param name="fullName"></param>
        /// <param name="password"></param>
        public CallCapture_OpenSpaceSiemens(string strLine, string serverNameAddress, string userNameWindowsLogin, string userNamePBXPMĐHExtensionID, string fullName, string password = "")
        {
            try
            {
                G_GlobalContacts = new GlobalContacts();
                G_GlobalContacts.LoadGlobalContacts();
                Line = int.Parse(strLine.Split(';')[0]);
                int status = ProfileOpenSpaceSiemens.UpdateFileProfileOpenSpaceSiemens(userNameWindowsLogin, userNamePBXPMĐHExtensionID, fullName, password);

                callCapture = new CallCaptureOpenSpaceSiemens(serverNameAddress, userNamePBXPMĐHExtensionID);

                callCapture.Connect();

                if (callCapture.IsConnected)
                {
                    StatusConnect = string.Format("{0} Đã kết nối tổng đài.{1}:{2}", userNamePBXPMĐHExtensionID, userNameWindowsLogin, status);
                    callCapture.StartListening();

                    callCapture.NewCall += callCapture_NewCall;
                }
                else
                {
                    StatusConnect = string.Format(" Kết nối tổng đài thất bại:{0}", status);
                }
                if (Global.IsDebug)
                {
                    LogError.WriteLogInfo("StatusConnect :" + StatusConnect);
                }
                //new Taxi.MessageBox.MessageBox().Show(StatusConnect);
            }
            catch (Exception ex)
            {
                StatusConnect = "Lỗi đã kết nối tổng đài";
                Taxi.Business.LogError.WriteLogError("CallCapture_OpenSpaceSiemens:", ex);
            }
        }
Example #34
0
 private static void LogErrors(EasyTest easyTest, Exception e)
 {
     lock (_locker) {
         var directoryName = Path.GetDirectoryName(easyTest.FileName) + "";
         string fileName = Path.Combine(directoryName, "config.xml");
         using (var optionsStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) {
             Options options = Options.LoadOptions(optionsStream, null, null, directoryName);
             var logTests = new LogTests();
             foreach (var application in options.Applications.Cast<TestApplication>()) {
                 var logTest = new LogTest { ApplicationName = application.Name, Result = "Failed" };
                 var logError = new LogError { Message = { Text = e.ToString() } };
                 logTest.Errors.Add(logError);
                 logTests.Tests.Add(logTest);
             }
             logTests.Save(Path.Combine(directoryName, "TestsLog.xml"));
         }
     }
     Trace.TraceError(e.ToString());
 }
Example #35
0
        /// <summary>
        /// Creates an ITask instance and returns it.  
        /// </summary>
        internal static ITask CreateTask(LoadedType loadedType, string taskName, string taskLocation, int taskLine, int taskColumn, LogError logError, AppDomainSetup appDomainSetup, bool isOutOfProc, out AppDomain taskAppDomain)
        {
            bool separateAppDomain = loadedType.HasLoadInSeparateAppDomainAttribute();
            s_resolverLoadedType = null;
            taskAppDomain = null;
            ITask taskInstanceInOtherAppDomain = null;

            try
            {
                if (separateAppDomain)
                {
                    if (!loadedType.Type.IsMarshalByRef)
                    {
                        logError
                        (
                            taskLocation,
                            taskLine,
                            taskColumn,
                            "TaskNotMarshalByRef",
                            taskName
                         );

                        return null;
                    }
                    else
                    {
                        // Our task depend on this name to be precisely that, so if you change it make sure
                        // you also change the checks in the tasks run in separate AppDomains. Better yet, just don't change it.

                        // Make sure we copy the appdomain configuration and send it to the appdomain we create so that if the creator of the current appdomain
                        // has done the binding redirection in code, that we will get those settings as well.
                        AppDomainSetup appDomainInfo = new AppDomainSetup();

                        // Get the current app domain setup settings
                        byte[] currentAppdomainBytes = appDomainSetup.GetConfigurationBytes();

                        // Apply the appdomain settings to the new appdomain before creating it
                        appDomainInfo.SetConfigurationBytes(currentAppdomainBytes);

                        AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver;
                        s_resolverLoadedType = loadedType;

                        taskAppDomain = AppDomain.CreateDomain(isOutOfProc ? "taskAppDomain (out-of-proc)" : "taskAppDomain (in-proc)", null, appDomainInfo);

                        if (loadedType.LoadedAssembly != null)
                        {
                            taskAppDomain.Load(loadedType.LoadedAssembly.GetName());
                        }

                        // Hook up last minute dumping of any exceptions 
                        taskAppDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandling.UnhandledExceptionHandler);
                    }
                }
                else
                {
                    // perf improvement for the same appdomain case - we already have the type object
                    // and don't want to go through reflection to recreate it from the name.
                    return (ITask)Activator.CreateInstance(loadedType.Type);
                }

                if (loadedType.Assembly.AssemblyFile != null)
                {
                    taskInstanceInOtherAppDomain = (ITask)taskAppDomain.CreateInstanceFromAndUnwrap(loadedType.Assembly.AssemblyFile, loadedType.Type.FullName);

                    // this will force evaluation of the task class type and try to load the task assembly
                    Type taskType = taskInstanceInOtherAppDomain.GetType();

                    // If the types don't match, we have a problem. It means that our AppDomain was able to load
                    // a task assembly using Load, and loaded a different one. I don't see any other choice than
                    // to fail here.
                    if (taskType != loadedType.Type)
                    {
                        logError
                        (
                        taskLocation,
                        taskLine,
                        taskColumn,
                        "ConflictingTaskAssembly",
                        loadedType.Assembly.AssemblyFile,
                        loadedType.Type.Assembly.Location
                        );

                        taskInstanceInOtherAppDomain = null;
                    }
                }
                else
                {
                    taskInstanceInOtherAppDomain = (ITask)taskAppDomain.CreateInstanceAndUnwrap(loadedType.Type.Assembly.FullName, loadedType.Type.FullName);
                }

                return taskInstanceInOtherAppDomain;
            }
            finally
            {
                // Don't leave appdomains open
                if (taskAppDomain != null && taskInstanceInOtherAppDomain == null)
                {
                    AppDomain.Unload(taskAppDomain);
                    RemoveAssemblyResolver();
                }
            }
        }
Example #36
0
 public LogError SaveLogError(LogError data)
 {
     try {
     SetService();  return SerClient.SaveLogError(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }
Example #37
0
 public void DeleteLogError(LogError data)
 {
     try {
     SetService();  SerClient.DeleteLogError(data); }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
         SerClient.Abort(); 
     }
 }