Example #1
0
 protected void UpdateBtn_Click(object sender, EventArgs e)
 {
     Built = false;
     abstractionGrid.Visible = abstractionResults.Visible = false;
     directNone.Visible      = direct.Visible = directGrid.Visible = false;
     indirectNone.Visible    = indirectGrid.Visible = indirect.Visible = false;
     ColumnGrid.Visible      = ColumnResults.Visible = false;
     RowGrid.Visible         = RowResults.Visible = false;
     UpdateCartItems();
     using (VirusDescriptionActions usersVirus = new VirusDescriptionActions())
     {
         if (usersVirus.GetCount() > 0)
         {
             VirusDescriptionTitle.InnerText = "Current Virus Total";
         }
         else
         {
             VirusDescriptionTitle.InnerText = "No Attributes Selected";
             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;
             abstractionGrid.Visible = abstractionResults.Visible = false;
             directNone.Visible      = direct.Visible = directGrid.Visible = false;
             indirectNone.Visible    = indirectGrid.Visible = indirect.Visible = false;
         }
     }
 }
Example #2
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     using (VirusDescriptionActions usersVirus = new VirusDescriptionActions())
     {
         string cartStr = string.Format("Description ({0})", usersVirus.GetCount());
         currentCount.InnerText = cartStr;
     }
 }
Example #3
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());
            }
        }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (VirusDescriptionActions usersVirus = new VirusDescriptionActions())
     {
         int totalNumberofAttributes = 0;
         int totalF_in  = 0;
         int totalF_out = 0;
         //Built = false;
         //Built = getBuiltStatus();
         totalNumberofAttributes = usersVirus.GetCount();
         totalF_in  = usersVirus.getTotalF_in();
         totalF_out = usersVirus.getTotalF_out();
         if (!Built)
         {
             abstractionNone.Visible = abstractionGrid.Visible = abstractionResults.Visible = false;
             directNone.Visible      = direct.Visible = directGrid.Visible = false;
             indirectNone.Visible    = indirectGrid.Visible = indirect.Visible = false;
             ColumnGrid.Visible      = ColumnResults.Visible = false;
             RowGrid.Visible         = RowResults.Visible = false;
         }
         if (totalNumberofAttributes > 0)
         {
             // Display Total.
             VirusDescriptionTitle.Visible = true;
             NoSelected.Visible            = false;
             UpdateBtn.Visible             = true;
             BuildCombo.Visible            = true;
             BuildRow.Visible = true;
             BuildCol.Visible = true;
             ClearBtn.Visible = true;
             lblTotal.Text    = String.Format("{0:d}", totalNumberofAttributes);
             VirusDescriptionTitle.InnerText = "Current Virus Total";
             if (totalF_in > 0)
             {
                 lblTotalF_in.Text = String.Format("{0:d}", totalF_in);
             }
             else
             {
                 lblTotalF_in.Text = "0";
             }
             if (totalF_out > 0)
             {
                 lblTotalF_out.Text = String.Format("{0:d}", totalF_out);
             }
             else
             {
                 lblTotalF_out.Text = "0";
             }
         }
         else
         {
             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 = 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;
         }
     }
 }