BL.Security.getCentroId C# (CSharp) Method

getCentroId() public method

public getCentroId ( string centro ) : long
centro string
return long
        public long getCentroId(string centro)
        {
            var QCId = from c in entidad.centros
                       where c.lugar == centro
                       select c.id;
            long CId = 0;
            foreach (long l in QCId)
                CId = l;
            return CId;
        }

Usage Example

示例#1
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                List<string> persAdded = new List<string>();

                foreach (ListItem it in permisos_CBList.Items)
                {
                    if (it.Selected == true)
                    {
                        persAdded.Add(it.Text);
                        it.Selected = false;
                    }
                }

                AdministradordeSistema admin = new AdministradordeSistema();//tmp-> deberia ser quien este logeado!
                Security sec = new Security();
                long centro = sec.getCentroId(centros.Text);
                admin.crearRol(descripcion_TB.Text, persAdded, centro);

                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Guardado')", true);
                LimpiarPage();
            }
        }
        catch (Exception err)
        {
            Session["Error_Msg"] = err.Message;
            Response.Redirect("~/Error.aspx", true);
        }
    }
All Usage Examples Of BL.Security::getCentroId