示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["IdUsuario"] != null)
                {
                    if (Session["IdEmpresaUpdate"] != null)
                    {
                        Empresa empresa = new Empresa();

                        DataTable  dt         = new DataTable();
                        EmpresaBLL empresaBLL = new EmpresaBLL();
                        dt = empresaBLL.ListaEmpresaPorId(Convert.ToInt32(Session["IdEmpresaUpdate"].ToString()));

                        if (dt.Rows.Count > 0)
                        {
                            empresa           = PreencherEmpresaUpdate(dt);
                            empresa.IdEmpresa = Convert.ToInt32(Session["IdEmpresaUpdate"].ToString());

                            Session["objEmpresa"] = empresa;
                            PreencherCampos(empresa);
                        }

                        //Remove a session que contém o código da empresa
                        Session.Remove("IdEmpresaUpdate");
                    }
                }

                else
                {
                    Session.RemoveAll();
                    Response.Redirect("~/Conta");
                }
            }
        }
示例#2
0
        protected void DrpFilial_EventClick(object sender, EventArgs e)
        {
            if (DrpFilial.SelectedValue == "Sim")
            {
                DataTable  dt      = new DataTable();
                EmpresaBLL empresa = new EmpresaBLL();
                dt = empresa.ListaEmpresaPorId(Convert.ToInt32(Session["EmpresaUsuario"].ToString()));

                DrpEmpresaMatriz.Enabled    = true;
                DrpEmpresaMatriz.DataSource = dt;
                DrpEmpresaMatriz.DataBind();

                DrpEmpresaMatriz.Items.Insert(0, "Selecione");
                DrpEmpresaMatriz.Items[0].Value = "";
            }
        }