Beispiel #1
0
 public static void Activate(String codigos)
 {
     try
     {
         foreach (var item in codigos.Split('|'))
         {
             if (!item.Equals(""))
             {
                 GeneralTipoController.Activate(new GeneralTipoBean {
                     IdGeneral = int.Parse(item)
                 });
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.LogException(ex, "Error :Usuario_Activate : ");
         throw new Exception("ERROR: " + ex.Message);
     }
 }
Beispiel #2
0
 public static String Update(string IdGeneral, string IdTipo, string Codigo, string Nombre)
 {
     try
     {
         var item = new GeneralTipoBean
         {
             IdGeneral = int.Parse(IdGeneral),
             IdTipo    = int.Parse(IdTipo),
             Codigo    = Codigo,
             Nombre    = Nombre,
         };
         GeneralTipoController.Update(item);
         return("OK");
     }
     catch (Exception ex)
     {
         LogHelper.LogException(ex, "Error :Usuario_Update : ");
         throw new Exception("ERROR: " + ex.Message);
     }
 }
Beispiel #3
0
        private void CargaCombo()
        {
            try
            {
                var zona = ZonaController.GetAll(new ZonaBean {
                    Flag = "T"
                });
                Utility.ComboNuevo(MddlIdZona, zona, "IdZona", "Nombre");
                var codigo  = HttpContext.Current.Session["lgn_id"].ToString();
                var negocio = NegocioController.GetAll(new NegocioBean {
                    Nombre = ""
                }, codigo);
                Utility.ComboNuevo(MddlIdNegocio, negocio, "IdNegocio", "Nombre");


                var rubro = GeneralTipoController.GetAll(new GeneralTipoBean {
                    IdTipo = 1
                });
                Utility.ComboNuevo(MddlIdRubro, rubro, "IdGeneral", "Nombre");
                var region = GeneralTipoController.GetAll(new GeneralTipoBean {
                    IdTipo = 2
                });
                Utility.ComboNuevo(MddlIdRegion, region, "IdGeneral", "Nombre");
                var organVenta = GeneralTipoController.GetAll(new GeneralTipoBean {
                    IdTipo = 3
                });
                Utility.ComboNuevo(MddlIdOrganizacionVenta, organVenta, "IdGeneral", "Nombre");
                var canal = GeneralTipoController.GetAll(new GeneralTipoBean {
                    IdTipo = 4
                });
                Utility.ComboNuevo(MddlIdCanal, canal, "IdGeneral", "Nombre");
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex, "Error :" + this);
                throw new Exception("ERROR: " + ex.Message);
            }
        }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["lgn_id"] == null)
        {
            Session.Clear();
            string myScript = ConfigurationManager.AppSettings["URL_LOGIN"];
            String lsScript = "parent.document.location.href = '" + myScript + "/default.aspx?acc=SES';";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", lsScript, true);
        }
        else
        {
            if (!IsPostBack)
            {
                string json = new System.IO.StreamReader(Request.InputStream).ReadToEnd();

                Dictionary <string, string> dataJSON = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);

                if (dataJSON != null)
                {
                    GeneralTipoBean obj = GeneralTipoController.Get(new GeneralTipoBean {
                        IdGeneral = int.Parse(dataJSON["codigo"].ToString()), Codigo = dataJSON["codigo"].ToString()
                    });
                    myModalLabel.InnerText = "Editar General";

                    MtxtIdGeneral.Value      = obj.IdGeneral.ToString();
                    MddlIdTipo.SelectedValue = obj.IdTipo.ToString();
                    MtxtCodigo.Value         = obj.Codigo;
                    MtxtNombre.Value         = obj.Nombre;
                    MtxtCodigo.Disabled      = true;
                }
                else
                {
                    myModalLabel.InnerText = "Crear General";
                }
            }
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["lgn_id"] == null)
        {
            Session.Clear();
            string myScript = ConfigurationManager.AppSettings["URL_LOGIN"];
            String lsScript = "parent.document.location.href = '" + myScript + "/default.aspx?acc=SES';";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", lsScript, true);
        }
        else
        {
            try
            {
                string json = new System.IO.StreamReader(Request.InputStream).ReadToEnd();

                Dictionary <string, string> dataJSON = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
                String idTipo        = dataJSON["IdTipo"].ToString();
                String codigo        = dataJSON["Codigo"].ToString();
                String nombres       = dataJSON["Nombre"].ToString();
                String chkHabilitado = dataJSON["chkFlgHabilitado"].ToString();

                //PAG
                String pagina = dataJSON["pagina"].ToString();
                String filas  = dataJSON["filas"].ToString();

                var item = new GeneralTipoBean
                {
                    IdTipo = int.Parse(idTipo),
                    Codigo = codigo,
                    Flag   = chkHabilitado,
                    Nombre = nombres,
                    page   = int.Parse(pagina),
                    rows   = int.Parse(filas)
                };

                PaginateGeneralTipoBean paginate = GeneralTipoController.GetAllPaginate(item);

                if ((Int32.Parse(pagina) > 0) && (Int32.Parse(pagina) <= paginate.totalPages))
                {
                    Utility.ConfiguraPaginacion(this.lbTpaginaTop, this.linkPaginaTop,
                                                this.lblTFilasTop, this.linkPaginaAnteriorTop, this.linkPaginaSiguienteTop,
                                                paginate.totalPages.ToString(), pagina, paginate.totalrows.ToString(),
                                                ddlMostrarTop, filas);

                    Utility.ConfiguraPaginacion(this.lbTpaginaBooton, this.linkPaginaBooton,
                                                this.lblTFilasBooton, this.linkPaginaAnteriorBooton, this.linkPaginaSiguienteBooton, paginate.totalPages.ToString(), pagina, paginate.totalrows.ToString(),
                                                ddlMostrarBooton, filas);

                    lst = paginate.lstResultados;
                    grdMant.DataSource = lst;
                    grdMant.DataBind();
                    grdMant.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
                else
                {
                    String htmlNoData = "<div class='gridNoData'><div class='col-sm-12 form-group'>" +
                                        "<img src='../../images/alert/ico_alert.png' style='float: left;height: 32px;'>" +
                                        "<p style='float: left;line-height: 32px;margin-left: 10px!important;'>No se encontraron datos para mostrar</p>" +
                                        "</p></div>";

                    this.divGridView.InnerHtml               = htmlNoData;
                    this.divGridViewPagintatorTop.Visible    = false;
                    this.divGridViewPagintatorBooton.Visible = false;
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex, "Error :" + this);

                String htmlNoData = "<div class='gridNoData'><div class='col-sm-12 form-group'>" +
                                    "<img src='../../images/alert/ico_alert.png' style='float: left;height: 32px;'>" +
                                    "<p style='float: left;line-height: 32px;margin-left: 10px!important;'>No se encontraron datos para mostrar</p>" +
                                    "</p></div>";

                this.divGridView.InnerHtml               = htmlNoData;
                this.divGridViewPagintatorTop.Visible    = false;
                this.divGridViewPagintatorBooton.Visible = false;

                string myScript = "addnotify('notify', \"" + ex.Message + "\", 'registeruser');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", myScript, true);
            }
        }
    }