Exemplo n.º 1
0
 protected void ClearBtn_Click(object sender, EventArgs e)
 {
     Built = false;
     using (VirusDescriptionActions curVirus = new VirusDescriptionActions())
     {
         curVirus.EmptyVirus();
         DescriptionList.DataSource = null;
         DescriptionList.DataBind();
         VirusDescriptionTitle.Visible = false;
         NoSelected.Visible            = true;
         LabelTotalText.Text           = "";
         lblTotal.Text           = "";
         LabelTotalF_in.Text     = "";
         lblTotalF_in.Text       = "";
         LabelTotalF_out.Text    = "";
         lblTotalF_out.Text      = "";
         UpdateBtn.Visible       = false;
         BuildCombo.Visible      = false;
         BuildRow.Visible        = false;
         BuildCol.Visible        = false;
         ClearBtn.Visible        = false;
         abstractionNone.Visible = abstractionNone.Visible = abstractionResults.Visible = abstractionGrid.Visible = false;
         directNone.Visible      = direct.Visible = directGrid.Visible = false;
         indirectNone.Visible    = indirectGrid.Visible = indirect.Visible = false;
         RowResults.Visible      = RowGrid.Visible = false;
         ColumnResults.Visible   = ColumnGrid.Visible = false;
     }
 }
Exemplo n.º 2
0
        public List <Virus_Item> UpdateCartItems()
        {
            using (VirusDescriptionActions usersShoppingCart = new VirusDescriptionActions())
            {
                String virusId = usersShoppingCart.GetVirusId();
                VirusDescriptionActions.VirusDescriptionUpdates[] cartUpdates = new VirusDescriptionActions.VirusDescriptionUpdates[DescriptionList.Rows.Count];
                for (int i = 0; i < DescriptionList.Rows.Count; i++)
                {
                    IOrderedDictionary rowValues = new OrderedDictionary();
                    rowValues = GetValues(DescriptionList.Rows[i]);
                    cartUpdates[i].AttributeId = Convert.ToInt32(rowValues["AttributeID"]);

                    CheckBox cbRemove = new CheckBox();
                    cbRemove = (CheckBox)DescriptionList.Rows[i].FindControl("Remove");
                    cartUpdates[i].RemoveItem = cbRemove.Checked;

                    CheckBox cbOnOff = new CheckBox();
                    cbOnOff = (CheckBox)DescriptionList.Rows[i].FindControl("On_Off_CheckBox");
                    if (cbOnOff.Checked == true)                                                      //Check to see if On/off is checked
                    {
                        if (usersShoppingCart.Get_OnOff(virusId, cartUpdates[i].AttributeId) == true) //If checked and currently on, turn off
                        {
                            cartUpdates[i].OnOff = false;
                        }
                        else //If checked and currently off, turn on
                        {
                            cartUpdates[i].OnOff = true;
                        }
                        //cartUpdates[i].OnOff = cbOnOff.Checked;
                    }
                    else //if not checked, query DB for previous state
                    {
                        cartUpdates[i].OnOff = usersShoppingCart.Get_OnOff(virusId, cartUpdates[i].AttributeId);
                    }
                    //cartUpdates[i].OnOff = cbOnOff.Checked;
                }
                usersShoppingCart.UpdateVirusDescriptionDatabase(virusId, cartUpdates);
                DescriptionList.DataBind();
                lblTotal.Text      = String.Format("{0:d}", usersShoppingCart.GetCount());
                lblTotalF_in.Text  = String.Format("{0:d}", usersShoppingCart.getTotalF_in());
                lblTotalF_out.Text = String.Format("{0:d}", usersShoppingCart.getTotalF_out());
                return(usersShoppingCart.GetDescriptionItems());
            }
        }