示例#1
0
        protected void selectAttrs_Btn_Click(object sender, EventArgs e)
        {
            var selectedKeys = attributeList.GetSelectedDataKeys("selectedChkBx");

            using (VirusDescriptionActions usersVirus = new VirusDescriptionActions())
            {
                foreach (var X in selectedKeys)
                {
                    usersVirus.AddToVirus(int.Parse(X.Value.ToString()));
                }
            }
            Response.Redirect("VirusDescription.aspx");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string rawId = Request.QueryString["AttributeID"];
            int    AttributeId;

            if (!String.IsNullOrEmpty(rawId) && int.TryParse(rawId, out AttributeId))
            {
                using (VirusDescriptionActions usersVirusDescription = new VirusDescriptionActions())
                {
                    usersVirusDescription.AddToVirus(Convert.ToInt16(rawId));
                }
            }
            else
            {
                Debug.Fail("ERROR : We should never get to AddToDescription.aspx without an AttributeId.");
                throw new Exception("ERROR : It is illegal to load AddToDescription.aspx without setting a AttributeId.");
            }
            Response.Redirect("VirusDescription.aspx");
        }