private void fillBtnPnl()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var SelectedPlant = Convert.ToInt32(Session["selectedPlant"]);
                var SelectedCategory = Convert.ToInt32(Session["selectedCategory"]);
                //create a list the holds the plants table
                var b = (from equip in conn.Equipments
                    where equip.Category_ID == SelectedCategory & equip.Plant_ID == SelectedPlant
                    select equip).ToList();

                    for (int i = 0; i < b.Count; i++)
                    {

                        HyperLink equipmentButton = new HyperLink();
                        equipmentButton.Text = b[i].Name;

                        equipmentButton.Attributes.Add("data-role", "button");
                        equipmentButton.Attributes.Add("data-inline","true");
                        equipmentButton.NavigateUrl = "survey.aspx?selectedEquipment=" + b[i].Unit_Number;

                        pnlButtons.Controls.Add(equipmentButton);

                    }

                //set the datasource to the created list and bind it to the dropdown

            }
        }
Example #2
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //instantiate a new deparment object in memory
                Category c = new Category();

                //decide if updating or adding, then save
                if (Request.QueryString.Count > 0)
                {
                    Int32 CategoryID = Convert.ToInt32(Request.QueryString["Category_ID"]);

                    c = (from category in conn.Categories
                         where category.Category_ID == CategoryID
                         select category).FirstOrDefault();

                }

                //fill the properties of our object from the form inputs

                c.Category1 = txtCategory.Text;

                if (Request.QueryString.Count == 0)
                {
                    conn.Categories.Add(c);
                }

                conn.SaveChanges();

                //redirect to updated departments page
                Response.Redirect("categories.aspx");
            }
        }
Example #3
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //instantiate a new deparment object in memory
                Heading c = new Heading();

                //decide if updating or adding, then save
                if (Request.QueryString.Count > 0)
                {
                    Int32 HeadingID = Convert.ToInt32(Request.QueryString["Heading_ID"]);

                    c = (from head in conn.Headings
                         where head.Heading_ID == HeadingID
                         select head).FirstOrDefault();
                }

                //fill the properties of our object from the form inputs

                c.Heading1 = txtHeading.Text;
                  // Create the list to store.
            string selectedCategoryValues = null;
            // Loop through each item.
            foreach (ListItem item in chklstCategories.Items)
            {
            if (item.Selected)
            {
                // If the item is selected, add the value to the list.
                selectedCategoryValues = selectedCategoryValues + item.Value;
            }
            else
            {
                // Item is not selected, do something else.
            }

            }
            try
            {
            c.Categories_Under = selectedCategoryValues.ToString();
            }
                catch(NullReferenceException)
            {
            c.Categories_Under = "";
            }
                if (Request.QueryString.Count == 0)
                {
                    conn.Headings.Add(c);
                }

                conn.SaveChanges();

                //redirect to updated departments page
                Response.Redirect("Headings.aspx");
            }
        }
Example #4
0
 public void loadImages(int hid,int eqid, DateTime dc)
 {
     using (DefaultConnectionEF conn = new DefaultConnectionEF())
     {
         var reqImageURLs = (from p in conn.Pictures
                             where p.equipment_ID == eqid && p.heading_ID == hid && p.DateSubmited == dc
                             select p).ToList();
         DLTempImage.DataSource = reqImageURLs;
         DLTempImage.DataBind();
     }
 }
Example #5
0
        protected void convertIDtoValue(int EquipmentID)
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var equipName = (from q in conn.Equipments
                                 where q.Unit_Number == EquipmentID
                                 select q).FirstOrDefault();
                txtEqID.Text = equipName.Name;

            }
        }
Example #6
0
 protected void fillDropDowns()
 {
     using (DefaultConnectionEF conn = new DefaultConnectionEF())
     {
         //create a list the holds the plants table
         var p = (from plnt in conn.Plants
                  select plnt).ToList();
         //set the datasource to the created list and bind it to the dropdown
         ddlPlant.DataSource = p;
         ddlPlant.DataBind();
     }
 }
Example #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //instantiate a new deparment object in memory
                Question q = new Question();

                //decide if updating or adding, then save
                if (Request.QueryString.Count > 0)
                {
                    Int32 QuestionID = Convert.ToInt32(Request.QueryString["Question_ID"]);

                    var c = (from head in conn.Questions
                             where head.Question_ID == QuestionID
                             select head).FirstOrDefault();

                }

                //fill the properties of our object from the form inputs

                // Create the list to store.
                string selectedHeadingValues = null;
                // Loop through each item.
                foreach (ListItem item in chklstHeadings.Items)
                {
                    if (item.Selected)
                    {
                        // If the item is selected, add the value to the list.
                        selectedHeadingValues = selectedHeadingValues + item.Value;
                    }
                    else
                    {

                    }

                }
                q.Question1 = txtQuestion.Text;
                q.Headings_Under = selectedHeadingValues.ToString();
                q.Category_ID = 1;

                if (Request.QueryString.Count == 0)
                {
                    conn.Questions.Add(q);
                }

                conn.SaveChanges();

                //redirect to updated departments page
                Response.Redirect("questionList.aspx");
            }
        }
Example #8
0
        protected void getQuestion()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var questions = from q in conn.Questions
                           select q;

                //bind the query result to the gridview
                grdQuestions.DataSource = questions.ToList();
                grdQuestions.DataBind();

            }
        }
Example #9
0
 protected void getReport(int EquipmentID, DateTime selectedDate)
 {
     using (DefaultConnectionEF conn = new DefaultConnectionEF())
     {
         //use link to query the Departments model
         var result = from r in conn.Results
                      where r.Equipment_ID == EquipmentID & r.Date_Completed == selectedDate
                      select r;
         //bind the query result to the gridview
         grdResults.DataSource = result.ToList();
         grdResults.DataBind();
     }
 }
Example #10
0
        protected void GetCategories()
        {
            //connect using our connection string from web.config and EF context class
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //use link to query the Departments model
                var cat = from c in conn.Categories
                            select c;

                //bind the query result to the gridview
                grdCategories.DataSource = cat.ToList();
                grdCategories.DataBind();
            }
        }
Example #11
0
        protected void GetHeading()
        {
            //connect using our connection string from web.config and EF context class
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //use link to query the Departments model
                var  head = from c in conn.Headings
                            select c;

                //bind the query result to the gridview
                grdHeadings.DataSource = head.ToList();
                grdHeadings.DataBind();
            }
        }
Example #12
0
        public void loadImages(int hid, int eqid, DateTime dc, int qid)
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var reqImageURLs = (from p in conn.Pictures
                                    where p.equipment_ID == eqid && p.heading_ID == hid && p.DateSubmited == dc && p.question_ID == qid
                                    select p).ToList();
                var count = reqImageURLs.Count();
                var url = "/admin/surveyImages/surveyPics/qid~"+ qid + "heading-"+ hid + "eqid&" + eqid + "dc_"+ dc.ToString("MM.dd.yyyy.hh.mm.ss") + "image1"  +".jpg";
                DLTempImage.DataSource = reqImageURLs;

                                    DLTempImage.DataBind();

            }
        }
Example #13
0
        protected void GetPlants()
        {
            //connect using our connection string from web.config and EF context class
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {

                //use link to query the Departments model
                var plnts = from d in conn.Plants
                           select d;

                //bind the query result to the gridview
                grdPlants.DataSource = plnts.ToList();
                grdPlants.DataBind();
            }
        }
Example #14
0
        protected void GetPlant()
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get id from url parameter and store in a variable
                Int32 categoryID = Convert.ToInt32(Request.QueryString["Category_ID"]);

                var c = (from category in conn.Categories
                         where category.Category_ID == categoryID
                         select category).FirstOrDefault();

                //populate the form from our department object
                txtCategory.Text = c.Category1;
                }
        }
Example #15
0
        protected void fillDropDown()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var c = (from cat in conn.Categories

                select cat).ToList();

               for (int t =0; t < c.Count; t++)
                {
                   ListItem a = new ListItem();
                   a.Text=  c[t].Category1;
                    a.Value = c[t].Category_ID + (",");
                    chklstCategories.Items.Add(a);
               }
            }
        }
        protected void convertIDtoValue()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var plantID = Convert.ToInt32(txtPlant.Text);
               var catID = Convert.ToInt32(txtCategory.Text);
                var plantName = (from p in conn.Plants
                                 where p.Plant_ID == plantID
                                 select p).FirstOrDefault();
                txtPlant.Text = plantName.Plant_Name;

                var catName = (from c in conn.Categories
                               where c.Category_ID == catID
                                 select c).FirstOrDefault();
                txtCategory.Text = catName.Category1;
            }
        }
Example #17
0
        protected void grdQuestions_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get the selected DepartmentID
                Int32 QuestionID = Convert.ToInt32(grdQuestions.DataKeys[e.RowIndex].Values["Question_ID"]);

                var c = (from head in conn.Questions
                         where head.Question_ID == QuestionID
                         select head).FirstOrDefault();

                //process the delete
                conn.Questions.Remove(c);
                conn.SaveChanges();

                //update the grid
                getQuestion();
            }
        }
Example #18
0
        protected void grdPlants_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //connect
              using (DefaultConnectionEF conn = new DefaultConnectionEF())
              {
                  //get the selected DepartmentID
                  Int32 PlantID = Convert.ToInt32(grdPlants.DataKeys[e.RowIndex].Values["Plant_ID"]);

                  var d = (from dep in conn.Plants
                           where dep.Plant_ID == PlantID
                           select dep).FirstOrDefault();

                  //process the delete
                  conn.Plants.Remove(d);
                  conn.SaveChanges();

                  //update the grid
                  GetPlants();
              }
        }
Example #19
0
        protected void GetPlant()
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get id from url parameter and store in a variable
                Int32 plantID = Convert.ToInt32(Request.QueryString["Plant_ID"]);

                var p = (from plnt in conn.Plants
                    where plnt.Plant_ID == plantID
                    select plnt).FirstOrDefault();

                //populate the form from our department object
                txtPlantName.Text = p.Plant_Name;
                txtAddress.Text = p.Address;
                txtCity.Text = p.City;
                txtPhoneNum.Text = p.Phone_Num;
                txtPostalCode.Text = p.Postal_Code;
            }
        }
Example #20
0
        protected void grdHeadings_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get the selected DepartmentID
                Int32 HeadingID = Convert.ToInt32(grdHeadings.DataKeys[e.RowIndex].Values["Heading_ID"]);

                var c = (from head in conn.Categories
                         where head.Category_ID == HeadingID
                         select head).FirstOrDefault();

                //process the delete
                conn.Categories.Remove(c);
                conn.SaveChanges();

                //update the grid
                GetHeading();
            }
        }
Example #21
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //instantiate a new deparment object in memory
                Equipment a = new Equipment();

                //decide if updating or adding, then save
                if (Request.QueryString.Count > 0)
                {
                    Int32 EquipmentID = Convert.ToInt32(Request.QueryString["Equipment_ID"]);

                    a = (from equip in conn.Equipments
                         where equip.Equipment_ID == EquipmentID
                         select equip).FirstOrDefault();
                }

                //fill the properties of our object from the form inputs

                a.Name = txtName.Text;
                a.Unit_Number = Convert.ToInt32(txtUnitNumber.Text);
                a.Belt_Type = txtBeltType.Text;
                a.Num_Of_Belts = Convert.ToInt32(txtNumOfBelts.Text);
                a.Description1 = txtDescription1.Text;
                a.Category_ID = Convert.ToInt32(ddlCategory.SelectedValue);
                a.Plant_ID = Convert.ToInt32(ddlPlant.SelectedValue);

                if (Request.QueryString.Count == 0)
                {
                    conn.Equipments.Add(a);
                }

                conn.SaveChanges();

                //redirect to updated departments page
                Response.Redirect("equipmentList.aspx");
            }
        }
Example #22
0
        protected void getEquipmentList()
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get id from url parameter and store in a variable
                Int32 EquipmentID = Convert.ToInt32(Request.QueryString["Equipment_ID"]);

                var e = (from equip in conn.Equipments
                         where equip.Equipment_ID == EquipmentID
                         select equip).FirstOrDefault();

                //populate the form from our department object
                txtName.Text = e.Name;
                txtBeltType.Text = e.Belt_Type;
                txtNumOfBelts.Text = e.Num_Of_Belts.ToString();
                txtUnitNumber.Text = e.Unit_Number.ToString();
                txtDescription1.Text = e.Description1;
                ddlPlant.SelectedIndex = ((e.Plant_ID) - 1);
                ddlCategory.SelectedIndex = ((e.Category_ID)-1);

            }
        }
Example #23
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //connect
                using (DefaultConnectionEF conn = new DefaultConnectionEF())
                {
                    //instantiate a new deparment object in memory
                    Plant d = new Plant();

                    //decide if updating or adding, then save
                    if (Request.QueryString.Count > 0)
                    {
                        Int32 plantID = Convert.ToInt32(Request.QueryString["plant_ID"]);

                        d = (from dep in conn.Plants
                            where dep.Plant_ID == plantID
                            select dep).FirstOrDefault();
                    }

                    //fill the properties of our object from the form inputs

                    d.Plant_Name = txtPlantName.Text;
                    d.Address = txtAddress.Text;
                    d.City = txtCity.Text;
                    d.Phone_Num = txtPhoneNum.Text;
                    d.Postal_Code = txtPostalCode.Text;

                    if (Request.QueryString.Count == 0)
                    {
                        conn.Plants.Add(d);
                    }

                    conn.SaveChanges();

                    //redirect to updated departments page
                    Response.Redirect("plants.aspx");
                }
        }
Example #24
0
        private void fillBtnPnl()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var SelectedPlant = Convert.ToInt32(Session["selectedPlant"]);

                //create a list the holds the plants table
                var b = (from equip in conn.Equipments
                         where equip.Plant_ID == SelectedPlant
                         select equip).ToList();
                    for (int i = 0; i < b.Count; i++)
                    {
                        HyperLink equipmentButton = new HyperLink();
                        equipmentButton.Text = b[i].Name;
                        equipmentButton.ID = b[i].Unit_Number.ToString();
                        equipmentButton.Attributes.Add("data-role", "button");
                        equipmentButton.Attributes.Add("data-inline", "true");
                        equipmentButton.Attributes.Add("rel", "external");
                        equipmentButton.NavigateUrl = "report.aspx?selectedEquipment=" + b[i].Unit_Number;
                        pnlButtons.Controls.Add(equipmentButton);
                    }

                var r = (from result in conn.Results
                         select result).ToList();
                var reid = (from result in conn.Results
                            select result.Equipment_ID).ToList();
                foreach (HyperLink hl in pnlButtons.Controls)
                {

                    if(!reid.Contains (Convert.ToInt32(hl.ID)))
                    {
                        HyperLink buttonToHide = pnlButtons.FindControl(hl.ID) as HyperLink;
                        buttonToHide.Visible = false;
                    }
                }
            }
        }
Example #25
0
        protected void btnUpload_Click1(object sender, EventArgs e)
        {
            var date = DateTime.Now.AddMinutes(-240).ToString();

            Session["surveySubmitTime"] = date;
            if (fuMain.HasFile)
            {
                using (DefaultConnectionEF conn = new DefaultConnectionEF())
                {
                    IList<HttpPostedFile> collection = fuMain.PostedFiles;

                    foreach (HttpPostedFile ia in collection)
                    {
                        Picture p = new Picture();

                        string imgName = ia.FileName.ToString();
                        int imageLength = ia.ContentLength;
                        string imageType = ia.ContentType;

                        var binaryImagedata = new byte[imageLength];
                        ia.InputStream.Read(binaryImagedata, 0, imageLength);

                        var date1 = Convert.ToDateTime(Session["surveySubmitTime"]);
                        var date1String = date1.ToString("MM.dd.yyyy.HH.mm.ss");

                        string imgPath = ("surveyImages/mainPics/" +
                            "eqid&" + Convert.ToInt32(Request.QueryString["selectedEquipment"].ToString()) + "dc_" + date1String + "image" +  ".jpg");

                       ia.SaveAs(Server.MapPath(("/admin/surveyImages/mainPics/" +
                             "eqid&" + Convert.ToInt32(Request.QueryString["selectedEquipment"].ToString()) + "dc_" + date1String + "image" + ".jpg")));

                        p.URL= imgPath;
                        p.DateSubmited = date1;
                        p.equipment_ID = Convert.ToInt32(Request.QueryString["selectedEquipment"].ToString());

                        p.name = imgName;

                        imgMain.ImageUrl = imgPath;
                        conn.Pictures.Add(p);

                    }

                    imgMain.Visible = true;
                    btnUpload.Visible = false;
                    fuMain.Visible = false;

                    tblSurvey.Visible = true;

                    input2.Visible = true;
                    hidenPic.Visible = true;
                    conn.SaveChanges();

                }
            }
        }
Example #26
0
        protected void grdResults_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                GridViewRow dr = e.Row as GridViewRow;

                using (DefaultConnectionEF conn = new DefaultConnectionEF())
                {
                    Int32 qID = Convert.ToInt32(dr.Cells[0].Text);

                    var tempQuestion = (from q in conn.Questions
                                        where q.Question_ID == qID
                                        select q).FirstOrDefault();

                    dr.Cells[0].Text = tempQuestion.Question1;

                    var hID = Convert.ToInt32(dr.Cells[4].Text);
                    var tempDate = currentlySelectedDate;
                    var tempHeading = (from h in conn.Headings
                                       where h.Heading_ID == hID
                                       select h).FirstOrDefault();
                    //Button tempButton = new Button();
                    //tempButton.ID = "btnQid=" + qID + "Hid:" + hID;
                    //tempButton.Text = tempHeading.Heading1;
                    //tempButton.Attributes.Add("data-hid", hID.ToString());
                    //tempButton.Attributes.Add("data-date", ddlDates.SelectedValue.ToString());
                    //tempButton.Attributes.Add("data-eqid", txtEqID.Text.ToString());
                    //tempButton.Attributes.Add("onclick", "document.getElementById('" + Button2.ClientID + "').click(); return false;");
                    //tempButton.Click += new EventHandler(header_click);

                    Button tempButton2 = new Button();
                    tempButton2.ID = "btnQid=" + qID + "Hid:" + hID;
                    tempButton2.Text = "View Heading Images";

                    HyperLink hyperlink1 = new HyperLink();
                    hyperlink1.Attributes.Add("data-role", "button");
                    hyperlink1.Attributes.Add("data-inline", "true");
                    hyperlink1.Attributes.Add("rel", "external");
                    hyperlink1.ID = "hlQid=" + qID + "Hid=" + hID + "2";
                    hyperlink1.Text = "View Images";
                    hyperlink1.NavigateUrl = "~/lafargeUser/tempImages.aspx?qid=" + qID + "&Hid=" + hID + "&dc=" + tempDate + "&eqid=" + Convert.ToInt32(Request.QueryString["selectedEquipment"]);

                    HyperLink hyperlink2 = new HyperLink();
                    hyperlink2.Attributes.Add("data-role", "button");
                    hyperlink2.Attributes.Add("data-inline", "true");
                    hyperlink2.Attributes.Add("rel", "external");
                    hyperlink2.ID = "hlQid=" + qID + "Hid=" + hID;
                    hyperlink2.Text = "View Heading Images";
                    hyperlink2.NavigateUrl = "~/lafargeUser/tempImages.aspx?Hid=" + hID + "&dc=" + tempDate + "&eqid=" + Convert.ToInt32(Request.QueryString["selectedEquipment"]);

                    //tempButton2.Attributes.Add("onclick", "document.getElementById('" + Button2.ClientID + "').click(); return false;");

                    dr.Cells[7].Controls.Add(hyperlink2);
                    dr.Cells[8].Controls.Add(hyperlink1);

                    var response = dr.Cells[1].Text;

                    if (response == "True")
                    {
                        dr.Cells[1].Text = "yes";

                    }
                    else if (response == "False")
                    {
                        dr.Cells[1].Text = "no";
                    }

                }
            }
        }
Example #27
0
        public void getHeadingsQuestions(int selectedID)
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var qList = (from questions in conn.Questions
                             where questions.Headings_Under.Contains(selectedID.ToString())
                             select questions.Question1).ToList();

                for (int i = 0; i < qList.Count; i++)
                {
                    TableRow r = new TableRow();
                    var question = qList[i];
                    //ADD THE QUESTION
                    TableCell cellQuestion = new TableCell();
                    cellQuestion.Text = question;
                    cellQuestion.BackColor = Color.Lime;
                    cellQuestion.ForeColor = Color.Black;

                    var allIDs = (from questions in conn.Questions
                                  where questions.Headings_Under.Contains(selectedID.ToString())
                                  select questions.Question_ID).ToList();
                    cellQuestion.ID = allIDs[i].ToString() + ("_Question_H=") + selectedID;

                    TableCell cellResponse = new TableCell();
                    cellResponse.ID = allIDs[i].ToString() + ("_response_H=") + selectedID;
                    RadioButtonList resp = new RadioButtonList();

                    resp.Attributes.Add("ID", allIDs[i].ToString() + "_response_H=" + selectedID + "rbl");
                    for (int w = 0; w < 2; w++)
                    {
                        ListItem answer = new ListItem();
                        if (w == 0)
                        {

                            answer.Text = ("Yes");
                            answer.Value = ("true");

                        }
                        else if (w == 1)
                        {
                            answer.Text = ("No");
                            answer.Value = ("false");

                        }
                        resp.Items.Add(answer);
                    }

                    cellResponse.Controls.Add(resp);

                    TableCell cellDeficency = new TableCell();
                    TextBox txtDeficency = new TextBox();

                    txtDeficency.Width = 195;
                    txtDeficency.ID = allIDs[i] + ("_Deficency_H=") + selectedID;
                    txtDeficency.TextMode = TextBoxMode.MultiLine;
                    cellDeficency.Controls.Add(txtDeficency);

                    TableCell cellAP = new TableCell();

                    TextBox txtAP = new TextBox();

                    txtAP.Width = 195;
                    txtAP.ID = allIDs[i] + ("_ActionPlan_H=") + selectedID;
                    txtAP.TextMode = TextBoxMode.MultiLine;
                    cellAP.Controls.Add(txtAP);

                    TableCell cellUpload = new TableCell();
                     FileUpload fu = new FileUpload();
                     fu.AllowMultiple = true;
                    fu.Attributes.Add("capture", "camera");
                    fu.Attributes.Add("type", "file");
                    fu.Attributes.Add("capture", "camera");
                    cellUpload.Controls.Add(fu);

                    r.Controls.Add(cellQuestion);
                    r.Controls.Add(cellResponse);
                    r.Controls.Add(cellDeficency);
                    r.Controls.Add(cellAP);
                    r.Controls.Add(cellUpload);

                    tblSurvey.Controls.Add(r);
                }
            }
        }
Example #28
0
        protected void buildTable()
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var SelectedCategory = Session["selectedCategory"].ToString();
                var neededHeadings = (from headings in conn.Headings
                                      where headings.Categories_Under.Contains(SelectedCategory)

                                      select headings.Heading1).ToList();

                for (int i = 0; i < neededHeadings.Count; i++)
                {
                    TableHeaderRow r = new TableHeaderRow();
                    var heading = neededHeadings[i];
                    TableHeaderCell c = new TableHeaderCell();
                    TableHeaderCell a1 = new TableHeaderCell();

                    TableHeaderCell cellUpload = new TableHeaderCell();
                    cellUpload.Width = 280;

                    FileUpload fu = new FileUpload();
                    fu.AllowMultiple = true;
                    fu.Attributes.Add("capture", "camera");
                    fu.Attributes.Add("type", "file");
                    fu.Attributes.Add("capture", "camera");
                    cellUpload.Controls.Add(fu);

                    cellUpload.ID = "upload" + i;

                    c.Text = heading;
                    c.ID = "heading" + i;

                    var allIDs = (from headings in conn.Headings
                                  where headings.Categories_Under.Contains(SelectedCategory)
                                  select headings.Heading_ID).ToList();
                    var selectedID = allIDs[i];
                    // c.ID = selectedID;
                    r.Controls.Add(c);
                    r.Controls.Add(a1);

                    r.Controls.Add(cellUpload);
                    tblSurvey.Controls.Add(r);
                    getHeadingsQuestions(selectedID);
                    if (i + 1 == neededHeadings.Count)
                    {
                        TableHeaderRow btnRow = new TableHeaderRow();
                        TableHeaderCell btnCell = new TableHeaderCell();
                        Button btnSubmit = new Button();
                        btnSubmit.Click += new EventHandler(btnSubmit_Click);
                        btnSubmit.Text = "submit";
                        btnCell.Controls.Add(btnSubmit);

                        btnRow.Controls.Add(btnCell);
                        tblSurvey.Controls.Add(btnRow);
                    }
                }

            }
        }
Example #29
0
        protected void selectDate(int EquipmentID, int index)
        {
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                var possibleDates = (from r in conn.Results
                                     where r.Equipment_ID == EquipmentID
                                     select r.Date_Completed).Distinct().ToList();
                currentlySelectedDate = possibleDates[index];
                getReport(EquipmentID, possibleDates[index]);

                ddlDates.SelectedIndex = index;

            }
        }
Example #30
0
        protected void getQuestion()
        {
            //connect
            using (DefaultConnectionEF conn = new DefaultConnectionEF())
            {
                //get id from url parameter and store in a variable
                Int32 QuestionID = Convert.ToInt32(Request.QueryString["Question_ID"]);

                var c = (from head in conn.Questions
                         where head.Question_ID == QuestionID
                         select head).FirstOrDefault();

                //populate the form from our department object
                txtQuestion.Text = c.Question1;

                var headingsUnder = c.Headings_Under.ToString();

                var allHeadings = (from cat in conn.Headings

                                     select cat.Heading_ID).ToList();
                var headLength = allHeadings.Count();
                int lastID = allHeadings[headLength - 1];

                for (int i = 0; i < lastID; i++)
                {
                   foreach(ListItem h in chklstHeadings.Items)
                   {
                       if (headingsUnder.Contains((i + 1).ToString()))
                       {
                           if( h.Value==((i+1)+","))
                           {
                               h.Selected=true;
                           }
                       }
                   }
                }
            }
        }