示例#1
0
        //  Save changes of object
        protected void btnSave_click(Object sender, EventArgs e)
        {
            SecondaryAntibody temp = new SecondaryAntibody();

            temp.id            = int.Parse(txtid.Value);
            temp.antibodyName  = txtantibodyName.Text;
            temp.antigen       = txtantigen.Text;
            temp.applications  = txtapplications.Text;
            temp.concentration = txtconcentration.Text;
            temp.excitation    = txtexcitation.Text;
            if (ddlfluorophore.SelectedValue != "Other")
            {
                temp.fluorophore = ddlfluorophore.SelectedValue;
            }
            else
            {
                temp.fluorophore = txtfluorophore.Text;
            }
            if (ddlhostSpecies.SelectedValue != "Other")
            {
                temp.hostSpecies = ddlhostSpecies.SelectedValue;
            }
            else
            {
                temp.hostSpecies = txthostSpecies.Text;
            }
            temp.labID     = int.Parse(ddllabID.SelectedValue);
            temp.lotNumber = txtlotNumber.Text;
            String reactiveSpecies = "";
            int    i = 0;

            foreach (ListItem li in ddlreactiveSpecies.Items)
            {
                if (li.Selected == true)
                {
                    if (i > 0)
                    {
                        reactiveSpecies += ",";
                    }
                    reactiveSpecies += li.Value;
                    i++;
                }
            }
            temp.reactiveSpecies = reactiveSpecies;
            temp.workingDilution = txtworkingDilution.Text;
            myConn.updateSecondaryAntibody(temp);
            gvSecondaryAntibodies.DataBind();
        }
示例#2
0
        /// <summary>
        /// Gets every SecondaryAntibody record in the database, saves each one in a new SecondaryAntibody object, and puts it in an ArrayList.
        /// </summary>
        /// <returns>ArrayList of Secondary Antibody objects</returns>
        public ArrayList getAllSecondaryAntibodies()
        {
            conn.Open();
            ArrayList  temp = new ArrayList();
            SqlCommand cmd  = new SqlCommand("dbo.getSecondaryAntibodyRecords", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                SecondaryAntibody tempSecondaryAntibody = new SecondaryAntibody(Convert.ToInt32(rdr.GetValue(0)), Convert.ToInt32(rdr.GetValue(1)), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetValue(10).ToString(), rdr.GetValue(11).ToString(), rdr.GetValue(13).ToString());
                temp.Add(tempSecondaryAntibody);
            }
            conn.Close();
            return(temp);
        }
 //  Save changes of object
 protected void btnSave_click(Object sender, EventArgs e)
 {
     SecondaryAntibody temp = new SecondaryAntibody();
     temp.id = int.Parse(txtid.Value);
     temp.antibodyName = txtantibodyName.Text;
     temp.antigen = txtantigen.Text;
     temp.applications = txtapplications.Text;
     temp.concentration = txtconcentration.Text;
     temp.excitation = txtexcitation.Text;
     if (ddlfluorophore.SelectedValue != "Other")
     {
         temp.fluorophore = ddlfluorophore.SelectedValue;
     }
     else
     {
         temp.fluorophore = txtfluorophore.Text;
     }
     if (ddlhostSpecies.SelectedValue != "Other")
     {
         temp.hostSpecies = ddlhostSpecies.SelectedValue;
     }
     else
     {
         temp.hostSpecies = txthostSpecies.Text;
     }
     temp.labID = int.Parse(ddllabID.SelectedValue);
     temp.lotNumber = txtlotNumber.Text;
     String reactiveSpecies = "";
     int i = 0;
     foreach (ListItem li in ddlreactiveSpecies.Items)
     {
         if (li.Selected == true)
         {
             if (i > 0)
             {
                 reactiveSpecies += ",";
             }
             reactiveSpecies += li.Value;
             i++;
         }
     }
     temp.reactiveSpecies = reactiveSpecies;
     temp.workingDilution = txtworkingDilution.Text;
     myConn.updateSecondaryAntibody(temp);
     gvSecondaryAntibodies.DataBind();
 }
示例#4
0
        /// <summary>
        /// Updates the secondary antibody record with the matching ID
        /// </summary>
        /// <param name="temp">SecondaryAntibody object to be written to the database</param>
        public Boolean updateSecondaryAntibody(SecondaryAntibody temp)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("UPDATE dbo.SecondaryAntibody SET LabID='" + temp.labID + "', Concentration='" + temp.concentration + "', Excitation='" + temp.excitation + "', AntibodyName='" + temp.antibodyName + "', HostSpecies='" + temp.hostSpecies + "', ReactiveSpecies='" + temp.reactiveSpecies + "', Fluorophore='" + temp.fluorophore + "', WorkingDilution='" + temp.workingDilution + "', LotNumber='" + temp.lotNumber + "', Antigen='" + temp.antigen + "', Applications='" + temp.applications + "' WHERE ID=" + temp.id + ";", conn);

            cmd.CommandType = CommandType.Text;
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        /// <summary>
        /// Gets the SecondaryAntibody denoted by the provided ID
        /// </summary>
        /// <param name="id">ID of the SecondaryAntibody to be located</param>
        /// <returns>SecondaryAntibody object if found, null if not</returns>
        public SecondaryAntibody getSecondaryAntibodyByID(int id)
        {
            conn.Open();
            SqlCommand        cmd = new SqlCommand("SELECT * FROM SecondaryAntibody WHERE ID=" + id + ";", conn);
            SqlDataReader     rdr = cmd.ExecuteReader();
            SecondaryAntibody temp;

            if (rdr.Read())
            {
                temp = new SecondaryAntibody(Convert.ToInt32(rdr.GetValue(0)), Convert.ToInt32(rdr.GetValue(1)), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetValue(10).ToString(), rdr.GetValue(11).ToString(), null);
            }
            else
            {
                temp = null;
            }
            conn.Close();
            return(temp);
        }
示例#6
0
        /// <summary>
        /// Inserts the provided SecondaryAntibody object as a new record into the database
        /// </summary>
        /// <param name="temp">SecondaryAntibody object to be added to the database</param>
        /// <returns>True if add is successful, false otherwise</returns>
        public Boolean addSecondaryAntibody(SecondaryAntibody temp)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("INSERT INTO dbo.SecondaryAntibody VALUES(" + temp.labID + ",'" + temp.concentration + "','" + temp.excitation + "','" + temp.antibodyName + "','" + temp.hostSpecies + "','" + temp.reactiveSpecies + "','" + temp.fluorophore + "','" + temp.workingDilution + "','" + temp.lotNumber + "','" + temp.antigen + "','" + temp.applications + "');", conn);

            cmd.CommandType = CommandType.Text;
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        //  submit
        protected void btnSubmit_click(Object sender, EventArgs e)
        {
            SecondaryAntibody antibody = new SecondaryAntibody();

            antibody.labID         = int.Parse(ddlLabID.SelectedValue);
            antibody.antibodyName  = txtName.Text;
            antibody.antigen       = txtAntigen.Text;
            antibody.applications  = txtApplications.Text;
            antibody.concentration = txtConcentration.Text;
            antibody.excitation    = txtExcitation.Text;
            antibody.fluorophore   = ddlFluorophore.SelectedValue;
            if (ddlHostSpecies.SelectedValue != "Other")
            {
                antibody.hostSpecies = ddlHostSpecies.SelectedValue;
            }
            else
            {
                antibody.hostSpecies = txthostSpecies.Text;
            }
            antibody.lotNumber = txtLotNumber.Text;
            String reactiveSpecies = "";
            int    i = 0;

            foreach (ListItem li in ddlReactiveSpecies.Items)
            {
                if (li.Selected == true)
                {
                    if (i > 0)
                    {
                        reactiveSpecies += ",";
                    }
                    reactiveSpecies += li.Value;
                    i++;
                }
            }
            antibody.reactiveSpecies = reactiveSpecies;
            antibody.workingDilution = txtWorkingDilution.Text;
            if (myConn.addSecondaryAntibody(antibody))
            {
                Response.Redirect("SecondaryAntibodies.aspx");
            }
        }
 //  submit
 protected void btnSubmit_click(Object sender, EventArgs e)
 {
     SecondaryAntibody antibody = new SecondaryAntibody();
     antibody.labID = int.Parse(ddlLabID.SelectedValue);
     antibody.antibodyName = txtName.Text;
     antibody.antigen = txtAntigen.Text;
     antibody.applications = txtApplications.Text;
     antibody.concentration = txtConcentration.Text;
     antibody.excitation = txtExcitation.Text;
     antibody.fluorophore = ddlFluorophore.SelectedValue;
     if (ddlHostSpecies.SelectedValue != "Other")
     {
         antibody.hostSpecies = ddlHostSpecies.SelectedValue;
     }
     else
     {
         antibody.hostSpecies = txthostSpecies.Text;
     }
     antibody.lotNumber = txtLotNumber.Text;
     String reactiveSpecies = "";
     int i = 0;
     foreach (ListItem li in ddlReactiveSpecies.Items)
     {
         if (li.Selected == true)
         {
             if (i > 0)
             {
                 reactiveSpecies += ",";
             }
             reactiveSpecies += li.Value;
             i++;
         }
     }
     antibody.reactiveSpecies = reactiveSpecies;
     antibody.workingDilution = txtWorkingDilution.Text;
     if (myConn.addSecondaryAntibody(antibody))
     {
         Response.Redirect("SecondaryAntibodies.aspx");
     }
 }
示例#9
0
 /// <summary>
 /// Updates the secondary antibody record with the matching ID
 /// </summary>
 /// <param name="temp">SecondaryAntibody object to be written to the database</param>
 public Boolean updateSecondaryAntibody(SecondaryAntibody temp)
 {
     conn.Open();
     SqlCommand cmd = new SqlCommand("UPDATE dbo.SecondaryAntibody SET LabID='" + temp.labID + "', Concentration='" + temp.concentration + "', Excitation='" + temp.excitation + "', AntibodyName='" + temp.antibodyName + "', HostSpecies='" + temp.hostSpecies + "', ReactiveSpecies='" + temp.reactiveSpecies + "', Fluorophore='" + temp.fluorophore + "', WorkingDilution='" + temp.workingDilution + "', LotNumber='" + temp.lotNumber + "', Antigen='" + temp.antigen + "', Applications='" + temp.applications + "' WHERE ID=" + temp.id + ";", conn);
     cmd.CommandType = CommandType.Text;
     int i = cmd.ExecuteNonQuery();
     conn.Close();
     if (i > 0)
         return true;
     else
         return false;
 }
示例#10
0
 /// <summary>
 /// Gets the SecondaryAntibody denoted by the provided ID
 /// </summary>
 /// <param name="id">ID of the SecondaryAntibody to be located</param>
 /// <returns>SecondaryAntibody object if found, null if not</returns>
 public SecondaryAntibody getSecondaryAntibodyByID(int id)
 {
     conn.Open();
     SqlCommand cmd = new SqlCommand("SELECT * FROM SecondaryAntibody WHERE ID=" + id + ";", conn);
     SqlDataReader rdr = cmd.ExecuteReader();
     SecondaryAntibody temp;
     if (rdr.Read())
         temp = new SecondaryAntibody(Convert.ToInt32(rdr.GetValue(0)), Convert.ToInt32(rdr.GetValue(1)), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetValue(10).ToString(), rdr.GetValue(11).ToString(), null);
     else
         temp = null;
     conn.Close();
     return temp;
 }
示例#11
0
 /// <summary>
 /// Gets every SecondaryAntibody record in the database, saves each one in a new SecondaryAntibody object, and puts it in an ArrayList.
 /// </summary>
 /// <returns>ArrayList of Secondary Antibody objects</returns>
 public ArrayList getAllSecondaryAntibodies()
 {
     conn.Open();
     ArrayList temp = new ArrayList();
     SqlCommand cmd = new SqlCommand("dbo.getSecondaryAntibodyRecords", conn);
     cmd.CommandType = CommandType.StoredProcedure;
     SqlDataReader rdr = cmd.ExecuteReader();
     while (rdr.Read())
     {
         SecondaryAntibody tempSecondaryAntibody = new SecondaryAntibody(Convert.ToInt32(rdr.GetValue(0)), Convert.ToInt32(rdr.GetValue(1)), rdr.GetValue(2).ToString(), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetValue(6).ToString(), rdr.GetValue(7).ToString(), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetValue(10).ToString(), rdr.GetValue(11).ToString(), rdr.GetValue(13).ToString());
         temp.Add(tempSecondaryAntibody);
     }
     conn.Close();
     return temp;
 }
示例#12
0
 /// <summary>
 /// Inserts the provided SecondaryAntibody object as a new record into the database
 /// </summary>
 /// <param name="temp">SecondaryAntibody object to be added to the database</param>
 /// <returns>True if add is successful, false otherwise</returns>
 public Boolean addSecondaryAntibody(SecondaryAntibody temp)
 {
     conn.Open();
     SqlCommand cmd = new SqlCommand("INSERT INTO dbo.SecondaryAntibody VALUES(" + temp.labID + ",'" + temp.concentration + "','" + temp.excitation + "','" + temp.antibodyName + "','" + temp.hostSpecies + "','" + temp.reactiveSpecies + "','" + temp.fluorophore + "','" + temp.workingDilution + "','" + temp.lotNumber + "','" + temp.antigen + "','" + temp.applications + "');", conn);
     cmd.CommandType = CommandType.Text;
     int i = cmd.ExecuteNonQuery();
     conn.Close();
     if (i > 0)
         return true;
     else
         return false;
 }
示例#13
0
        protected void createPDF(Stream output)
        {
            //SecondaryAntibody tempAntibody = myConn.getSecondaryAntibodyByID(Convert.ToInt16(Request.QueryString["id"]));
            SecondaryAntibody tempAntibody = myConn.getSecondaryAntibodyByID(2);

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=secondary_antibody_" + tempAntibody.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);

            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Secondary Antibody Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Antibody Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk     tempLabel     = new iTextSharp.text.Chunk("Antibody Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk     tempValue     = new iTextSharp.text.Chunk(tempAntibody.antibodyName, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Concentration
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Concentration: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.concentration, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Excitation
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Excitation: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.excitation, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Host Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Host Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.hostSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Reactive Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Reactive Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.reactiveSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Fluorophore
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Fluorophore: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.fluorophore, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Working Dilution
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Working Dilution: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.workingDilution, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Lot Number
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Lot Number: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.lotNumber, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antigen
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Antigen: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.antigen, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Applications
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Applications: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.applications, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
示例#14
0
 /// <summary>
 /// Compares the ID of the current SecondaryAntibody object to that of a provided SecondaryAntibody
 /// </summary>
 /// <param name="temp">SecondaryAntibody object to be compared to.</param>
 /// <returns>True if the ID's are equal (meaning the antibodies are the same), false otherwise.</returns>
 public Boolean Equals(SecondaryAntibody temp)
 {
     return(this.id == temp.id);
 }
示例#15
0
 /// <summary>
 /// Compares the ID of the current SecondaryAntibody object to that of a provided SecondaryAntibody
 /// </summary>
 /// <param name="temp">SecondaryAntibody object to be compared to.</param>
 /// <returns>True if the ID's are equal (meaning the antibodies are the same), false otherwise.</returns>
 public Boolean Equals(SecondaryAntibody temp)
 {
     return this.id == temp.id;
 }