protected void rptPELTypes_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dRow = (DataRowView)e.Item.DataItem; DataView dvPELS = new DataView(_dtCampaignPELs, "TemplateTypeDescription = '" + dRow["TemplateTypeDescription"].ToString() + "'", "", DataViewRowState.CurrentRows); RadioButtonList rblList = (RadioButtonList)e.Item.FindControl("rblPELs"); rblList.BorderStyle = BorderStyle.Solid; rblList.BorderWidth = Unit.Pixel(1); rblList.DataTextField = "TemplateDescription"; rblList.DataValueField = "PELTemplateID"; rblList.DataSource = dvPELS; rblList.DataBind(); rblList.Items.Add(new ListItem("No Default", "")); DataView dvDefault = new DataView(_dtCampaignPELs, "TemplateTypeDescription = '" + dRow["TemplateTypeDescription"].ToString() + "' and IsCampaignDefault = 1", "", DataViewRowState.CurrentRows); string sDefaultValue = ""; if (dvDefault.Count > 0) { sDefaultValue = dvDefault[0]["PELTemplateID"].ToString(); } foreach (ListItem dItem in rblList.Items) { if (dItem.Value == sDefaultValue) { rblList.ClearSelection(); dItem.Selected = true; } } } }
protected void frm5_evalradio_SelectedIndexChanged(object sender, EventArgs e) { // frm5_evalradio.Visible = false; RadioButtonList blockcntrl = (RadioButtonList)sender; string evalcount = "Copy" + (Convert.ToInt32(blockcntrl.ID.ToString().Substring(5)) + 1).ToString(); frm5_hiddenvalue.Text = evalcount; //db check on existing value ClientAdmin.Utility.Check_copy(Convert.ToInt32(Session["Request_id"].ToString()), evalcount); if (blockcntrl.SelectedValue.ToString() == "False") { //transform int result = ClientAdmin.Utility.SaveSameAddress(Convert.ToInt32(Session["Request_id"].ToString()), Convert.ToInt32(Session["Customer_id"].ToString()), evalcount); if (result == 0) { ClientScript.RegisterStartupScript(GetType(), "dateSrpt", "<script>alert('Fill In the primary mailing address from the Edit Application')</script>"); blockcntrl.ClearSelection(); } else { ClientAdmin.Utility.Evaluationdisplay(officialgrid, Session["Request_id"].ToString()); } } else { dynamic_official.Visible = false; frm5_evalformheader.InnerText = "( Official Hard Copy Delivery - " + (Convert.ToInt32(blockcntrl.ID.ToString().Substring(5)) + 1).ToString() + " ) :"; frm5_evalform.Visible = true; } }
protected void rdoCDType_DataBound(object sender, EventArgs e) { try { RadioButtonList chk = (RadioButtonList)sender; FormView frmV = (FormView)((AjaxControlToolkit.TabContainer)((AjaxControlToolkit.TabPanel)chk.NamingContainer).NamingContainer).NamingContainer; if (frmV.DataItem != null) { string paymode = ((DataRowView)frmV.DataItem)["CDType"].ToString(); chk.ClearSelection(); ListItem li = chk.Items.FindByValue(paymode); if (li != null) { li.Selected = true; } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void chkPayToAdd_DataBound(object sender, EventArgs e) { try { RadioButtonList chk = (RadioButtonList)sender; FormView frmV = (FormView)chk.NamingContainer; if (frmV.DataItem != null) { string paymode = ((DataRowView)frmV.DataItem)["paymode"].ToString(); chk.ClearSelection(); ListItem li = chk.Items.FindByValue(paymode); if (li != null) { li.Selected = true; } } if (chk.SelectedItem != null) { if (chk.SelectedItem.Text == "Cheque") { //Panel test = (Panel)frmViewAdd.FindControl("PanelBank"); HtmlTable table = (HtmlTable)((Panel)frmV.FindControl("PanelBankAdd")).FindControl("tblBankAdd"); if (table != null) { table.Attributes.Add("class", "AdvancedSearch"); } } else { HtmlTable table = (HtmlTable)frmV.FindControl("PanelBankAdd").FindControl("tblBankAdd"); if (table != null) { table.Attributes.Add("class", "hidden"); } } } else { //Panel test = (Panel)frmViewAdd.FindControl("PanelBank"); //test.Visible = false; HtmlTable table = (HtmlTable)frmV.FindControl("PanelBankAdd").FindControl("tblBankAdd"); if (table != null) { table.Attributes.Add("class", "hidden"); } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
public void RadioButtonListSelect(RadioButtonList e, string id) { e.ClearSelection(); for (int i = 0; i < e.Items.Count; i++) { if (e.Items[i].Value == id) { e.Items[i].Selected = true; } } }
public static void FillRadioButtonList(RadioButtonList rbl, object inVal) { if (inVal == DBNull.Value) { rbl.ClearSelection(); } else { rbl.SelectedValue = inVal.ToString(); } }
protected void BtnClear_Click(object sender, EventArgs e) { foreach (GridViewRow row in gvMonthly.Rows) { RadioButtonList rbl = row.FindControl("rblAction") as RadioButtonList; rbl.ClearSelection(); } foreach (GridViewRow row in gvPending.Rows) { RadioButtonList rbl = row.FindControl("rblAction") as RadioButtonList; rbl.ClearSelection(); } }
public void searchButton(string search, RadioButtonList radiobuttonlist, PlaceHolder PlaceHolder1) // useThis as Clear Filter { con_URL.changeFind(search); // Success con_EDP.generateBrandList(); con_dis.SelectedMultipleDisplay(con_EDP.getAll_EDP(), PlaceHolder1); radiobuttonlist.ClearSelection(); radiobuttonlist.Controls.Clear(); radiobuttonlist.Items.Clear(); listBrand = con_EDP.getBrand(); for (int i = 0; i < listBrand.Count; i++) { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; }
public void radioButton_button(String findBrand, RadioButtonList radiobuttonlist, PlaceHolder PlaceHolder1) { con_EDP.BrandSelected_Generate_EDP(findBrand); con_dis.SelectedMultipleDisplay(con_EDP.getBranded_EDP(), PlaceHolder1); radiobuttonlist.ClearSelection(); radiobuttonlist.Controls.Clear(); radiobuttonlist.Items.Clear(); listBrand = con_EDP.getTempoBrand(); for (int i = 0; i < listBrand.Count; i++) { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; }
protected void grdUpdate_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { RadioButtonList rdUpGridActInac = e.Row.FindControl("rdUpGridActInac") as RadioButtonList; HiddenField hdnActivState = e.Row.FindControl("hdnActivState") as HiddenField; rdUpGridActInac.ClearSelection(); rdUpGridActInac.SelectedValue = (hdnActivState.Value == "True") ? "1" : "0"; } } catch (Exception) { } }
/// <summary> /// 按值设定单选按钮列表的选定项 /// </summary> /// <param name="radl"></param> /// <param name="objValue"></param> public static void RadlSetValue(RadioButtonList radl, object objValue) { string radlValue; radlValue = objValue.ToString(); radl.ClearSelection(); foreach (ListItem item in radl.Items) { if (item.Value == radlValue) { item.Selected = true; return; } } }
/// <summary> /// 按显示文本设定单选按钮列表的选定项 /// </summary> /// <param name="radl"></param> /// <param name="objText"></param> public static void RadlSetText(RadioButtonList radl, object objText) { string radlText; radlText = (string)objText; radl.ClearSelection(); foreach (ListItem item in radl.Items) { if (item.Text == radlText) { item.Selected = true; return; } } }
/// <summary> /// 选中某一项 /// </summary> /// <param name="radio">类型</param> /// <param name="value">值</param> public static void RadioButtonChecked(RadioButtonList radio, string value) { for (int i = 0; i < radio.Items.Count; i++) { if (radio.Items[i].Value != value) { radio.Items[i].Selected = false; // continue; } else { radio.ClearSelection(); radio.Items[i].Selected = true; } } }
/// <summary> /// The set selected on list. /// </summary> /// <param name="list">The list.</param> /// <param name="value">The value.</param> private static void SetSelectedOnList([NotNull] ref RadioButtonList list, [NotNull] string value) { var selItem = list.Items.FindByValue(value); list.ClearSelection(); if (selItem != null) { selItem.Selected = true; } else if (list.Items.Count > 0) { // select the first... list.SelectedIndex = 0; } }
public void searchButton(string search, RadioButtonList radiobuttonlist, PlaceHolder PlaceHolder1) // useThis as Clear Filter { listBrand.Clear(); Findproduct = search; getEDPfromSearchManager(); // SelectedMultipleDisplay(All_edp, PlaceHolder1); SelectedMultipleDisplay2(all_EDPString, PlaceHolder1); radiobuttonlist.ClearSelection(); radiobuttonlist.Controls.Clear(); radiobuttonlist.Items.Clear(); for (int i = 0; i < listBrand.Count; i++) { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; }
public void getGLOBALBrand(RadioButtonList radiobuttonlist) { con_site.Findproduct = "laptop"; con_EDP.AllBrand2(con_site.SearchManagerURL); //1st Create an edp using the search textbox this will generate a url for specified search radiobuttonlist.ClearSelection(); radiobuttonlist.Controls.Clear(); radiobuttonlist.Items.Clear(); for (int i = 0; i < con_EDP.FullBrand.Count; i++) // FullBrand is the Brandlist from Searchmanager,Brandcount is the # { listBrand.Add(con_EDP.FullBrand [i] + " (" + con_EDP.BrandCount[i] + ")"); } listBrand = listBrand.Distinct().ToList(); // DISTINCT listBrand = listBrand.OrderBy(i => i).ToList(); // MAKE brand alphabetical for (int i = 0; i < listBrand.Count; i++) { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; }
private void SelectRadioButton() { foreach (GridViewRow row in cgvObligationCWW.Rows) { RadioButtonList rblCompiledOrNot = row.FindControl("rblCompiledOrNot") as RadioButtonList; if (LbtnSelectAll.Text == "Select All") { for (int i = 0; i < cgvObligationCWW.Rows.Count; i++) { rblCompiledOrNot.SelectedIndex = 0; } } if (LbtnSelectAll.Text == "Unselect All") { for (int i = 0; i < cgvObligationCWW.Rows.Count; i++) { rblCompiledOrNot.ClearSelection(); } } } }
public void searchButton(string search, RadioButtonList radiobuttonlist, PlaceHolder PlaceHolder1, Label numfound, Label pageNumber, Label lbl_Min, Label lbl_MAX, DropDownList drop) // useThis as Clear Filter { #region DisplayProducts con_site.Findproduct = search; con_EDP.getEDPfromSearchManager2(con_site.SearchManagerURL); //1st Create an edp using the search textbox this will generate a url for specified search con_site.Alldetails_Use_EDP = con_EDP.EdpString; //2nd use the generated EdpString con_dis.getDetails2(con_site.Alldetails_Use_EDP); //3rd get allDetails and store it to the list con_dis.SelectedMultipleDisplay2(PlaceHolder1); //4th apply Display numfound.Text = con_EDP.NumfoundFromSearch.ToString(); #endregion #region DisplayBrand radiobuttonlist.ClearSelection(); radiobuttonlist.Controls.Clear(); radiobuttonlist.Items.Clear(); listBrand = con_dis.Manufacturer; listBrand = listBrand.Distinct().ToList(); listBrand = listBrand.OrderBy(i => i).ToList(); // MAKE brand alphabetical for (int i = 0; i < listBrand.Count; i++) { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; #endregion #region RESET int min = 1; // numbering start int max = 10; // numbering to end lbl_Min.Text = "" + min; lbl_MAX.Text = "" + max; numfound.Text = con_EDP.NumfoundFromSearch.ToString(); con_site.StartRead = 0; con_site.ProductLimitView = 10; drop.Text = con_site.ProductLimitView.ToString(); pageNumber.Text = "" + 0; // -------------------- TEST ------------------ #endregion }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ _shoppingCart = ShoppingCart; if (IsReadOnly) { trReadOnly.Visible = true; trEditInvoice.Visible = false; } else { trReadOnly.Visible = false; trEditInvoice.Visible = true; } populateInvoiceOptions(); if (_invoiceOptionRBL != null) { if (_invoiceOptionRBL.Items.Count == 1) { trReadOnly.Visible = true; trEditInvoice.Visible = false; ShoppingCart.InvoiceOption = _invoiceOptionRBL.Items[0].Value; } if (_invoiceOptionRBL.Items.Count > 0) { ListItem itemSelected = _invoiceOptionRBL.Items.FindByValue(ShoppingCart.InvoiceOption); if (itemSelected != null) { _invoiceOptionRBL.ClearSelection(); _invoiceOptionRBL.Items.FindByValue(ShoppingCart.InvoiceOption).Selected = true; lblInvoiceOptions.Text = itemSelected.Text; } } } //} }
protected void gvX_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "TmViewClick") { GridViewRow namingContainer = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer; string str = e.CommandArgument.ToString(); base.Response.Redirect("examination_data_detail.aspx?x=" + str + "&cri=" + this.Session["e_type"].ToString()); } if (e.CommandName == "TmDeleteClick") { GridViewRow row = (GridViewRow)((ImageButton)e.CommandSource).NamingContainer; int rowIndex = row.RowIndex; RadioButtonList list = (RadioButtonList)this.gvX.Rows[rowIndex].Cells[11].FindControl("rbValid"); CheckBox box = (CheckBox)this.gvX.Rows[rowIndex].Cells[12].FindControl("cbAddBatch"); list.ClearSelection(); box.Checked = false; if (this.select_cnt == 0) { this.comment.Visible = false; UpdateBatch.Visible = false; } } }
public void refresh(PlaceHolder placeholder1, RadioButtonList radiobuttonlist, string currentTextboxSearch, DropDownList numberOfViews, int pageNumber, Label lbl_Min, Label lbl_MAX) { #region Display int min = Convert.ToInt32(numberOfViews.SelectedValue) * pageNumber; // numbering start int max = Convert.ToInt32(numberOfViews.SelectedValue) + min; // numbering to end lbl_Min.Text = "" + (min + 1); //Label min +1 to make it count 1,11,21,31 lbl_MAX.Text = "" + max; #region urlSite_SETUP con_site.Findproduct = currentTextboxSearch; // product search = q con_site.ProductLimitView = Convert.ToInt32(numberOfViews.SelectedValue); // ROW con_site.StartRead = (Convert.ToInt32(numberOfViews.SelectedValue) * pageNumber); // start con_EDP.getEDPfromSearchManager2(con_site.SearchManagerURL); //Using Url to get EDP con_site.Alldetails_Use_EDP = con_EDP.EdpString; //Insert EDP on main site con_dis.getDetails2(con_site.Alldetails_Use_EDP); // Use Detail Url con_dis.SelectedMultipleDisplay2(placeholder1); // Display product On placeholder #endregion #region DisplayBrand radiobuttonlist.ClearSelection(); // Clear Selection radiobuttonlist.Controls.Clear(); // Clear control radiobuttonlist.Items.Clear(); // clear items listBrand = con_dis.Manufacturer; // getlist from Control_display class listBrand = listBrand.Distinct().ToList(); // distinct listbrand listBrand = listBrand.OrderBy(i => i).ToList(); // Sort listbrand alphabetical for (int i = 0; i < listBrand.Count; i++) //Implement Listbrand on radioButtonlist { radiobuttonlist.Items.Add(new ListItem(listBrand[i])); } radiobuttonlist.AutoPostBack = true; #endregion #endregion }
protected void LoadInfo(int sectionId, DateTime date) { using (WebhostEntities db = new WebhostEntities()) { int year = DateRange.GetCurrentAcademicYear(); GradeTable attMarkings = db.GradeTables.Where(t => t.AcademicYearID == year && t.Name.Equals("Attendance")).Single(); AttendanceTable.Rows.Clear(); Section section = db.Sections.Where(sec => sec.id == sectionId).Single(); ClassNameLabel.Text = String.Format("[{0}] {1}", section.Block.LongName, section.Course.Name); AttendancePageInfo api = new AttendancePageInfo() { SectionId = sectionId, Date = date, Name = ClassNameLabel.Text, Attendances = new List <AttendanceData>() }; List <Student> StudentRoster = section.Course.Name.Equals("Morning Meeting") ? section.Students.OrderBy(s => s.GraduationYear).ThenBy(s => s.LastName).ThenBy(s => s.FirstName).ToList() : section.Students.OrderBy(s => s.LastName).ThenBy(s => s.FirstName).ToList(); bool allSubmitted = true; foreach (Student student in StudentRoster) { AttendanceMarking mark = null; AttendanceData atd = new AttendanceData() { StudentId = student.ID, Name = String.Format("{0} {1}", student.FirstName, student.LastName) }; if (section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).Count() == 1) { mark = section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).Single(); } else if (section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).Count() > 1) { LogError("Multiple Attendance Markings found for {0} {1} in [{2}] {3} on {4}", student.FirstName, student.LastName, section.Block.LongName, section.Course.Name, date.ToString("DDD dd MMM, yyyy")); AttendanceMarking toKeep = null; List <AttendanceMarking> toDelete = section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).ToList(); foreach (AttendanceMarking errMark in toDelete) { if (toKeep == null) { toKeep = errMark; } if (toKeep.Marking.Name.Equals("Excused")) { break; } if (errMark.SubmissionTime > toKeep.SubmissionTime) { toKeep = errMark; } } toDelete.Remove(toKeep); db.AttendanceMarkings.RemoveRange(toDelete); db.SaveChanges(); foreach (Faculty teacher in section.Teachers.ToList()) { MailControler.MailToUser("Attendance Needs Checking.", String.Format("There was a problem with the marking for {0} {1} in [{2}] {3} on {4}. I have attempted to correct the error, but you should double check it. Currently, they are marked as {5}.", student.FirstName, student.LastName, section.Block.LongName, section.Course.Name, date.ToString("DDD dd MMM, yyyy"), toKeep.Marking.Name), String.Format("{0}@dublinschool.org", teacher.UserName), String.Format("{0} {1}", teacher.FirstName, teacher.LastName)); } } else { allSubmitted = false; } TableRow row = new TableRow(); TableCell nameCell = new TableCell(); Label nameLabel = new Label() { Text = student.FirstName + " " + student.LastName, ToolTip = "Advisor: " + student.Advisor.FirstName + " " + student.Advisor.LastName, Width = Unit.Percentage(60) }; HiddenField sidf = new HiddenField() { Value = Convert.ToString(student.ID) }; nameCell.Controls.Add(sidf); nameCell.Controls.Add(nameLabel); TableCell markingCell = new TableCell(); RadioButtonList markddl = new RadioButtonList() { Width = Unit.Percentage(100), RepeatLayout = RepeatLayout.Table, RepeatDirection = RepeatDirection.Horizontal, RepeatColumns = 2, CssClass = "table_fixed" }; int presentId = attMarkings.GradeTableEntries.Where(m => m.Name.Equals("Present")).Single().id; markddl.DataSource = attMarkings.GradeTableEntries.ToList(); markddl.DataTextField = "Name"; markddl.DataValueField = "id"; markddl.DataBind(); if (mark != null) { markddl.ClearSelection(); markddl.SelectedValue = Convert.ToString(mark.MarkingIndex); atd.Marking = mark.Marking.Name; } else { markddl.ClearSelection(); markddl.SelectedValue = Convert.ToString(presentId); atd.Marking = "Present"; } markingCell.Controls.Add(markddl); ((List <AttendanceData>)api.Attendances).Add(atd); row.BorderWidth = Unit.Pixel(2); row.BorderStyle = BorderStyle.Solid; row.Cells.Add(nameCell); row.Cells.Add(markingCell); AttendanceTable.Rows.Add(row); } if (section.AttendanceSubmissionStatuses.Where(s => s.Day.Equals(date) && s.AttendanceStatus.Blocking).Count() > 0) { AttendanceSubmissionStatus status = section.AttendanceSubmissionStatuses.Where(s => s.Day.Equals(date)).Single(); if (status.TimeStamp.AddSeconds(5 * section.Students.Count) < DateTime.Now) { LogError("There was a problem entering attendance for [{0}] {1} at {2}. I will let the user know that there was a problem.", section.Block.LongName, section.Course.Name, status.TimeStamp.ToString("dddd, dd MM - h:mm:ss")); if (allSubmitted) // calculated manually above! { LogInformation("Attendance was submitted earlier--but may not have been updated correctly."); MailControler.MailToUser("Attendance Problem", String.Format("Hello,{0}" + "Your attendance entry for [{1}] {2} had a problem when you tried to submit it at {3}. There are saved attendance entries, but they may not be correct. Please double check the entries and resubmit if necessary.{0}{0}Thanks!", Environment.NewLine, section.Block.LongName, section.Course.Name, status.TimeStamp.ToString("dddd, dd MM - h:mm:ss")), user, "*****@*****.**", "Attendance Bot"); SubmittedLabel.Text = "You have not yet entered attendance data."; SubmittedLabel.CssClass = "incomplete_highlight"; status.TimeStamp = DateTime.Now; status.StatusId = db.AttendanceStatuses.Where(st => st.Name.Equals("Not Submitted")).Single().id; } else { LogInformation("Attendance was not submitted prior to this attempt."); MailControler.MailToUser("Attendance Problem", String.Format("Hello,{0}" + "Your attendance entry for [{1}] {2} had a problem when you tried to submit it at {3}. There are incomplete attendance records right now. Please double check the entries and resubmit your attendance for this class.{0}{0}Thanks!", Environment.NewLine, section.Block.LongName, section.Course.Name, status.TimeStamp.ToString("dddd, dd MM - h:mm:ss")), user, "*****@*****.**", "Attendance Bot"); SubmittedLabel.Text = "Successfully Submitted."; SubmittedLabel.CssClass = "success_highlight"; status.TimeStamp = DateTime.Now; status.StatusId = db.AttendanceStatuses.Where(st => st.Name.Equals("Submitted")).Single().id; } db.SaveChanges(); } else { LogWarning("The attendance for [{0}] {1} is still processing (less than the alotted {2} seconds have passed).", section.Block.LongName, section.Course.Name, (5 * section.Students.Count)); MailControler.MailToUser(String.Format("Attendance Submission Status for [{0}] {1}", section.Block.LongName, section.Course.Name), String.Format("Hello,{0}Your attendance for [{1}] {2} is still processing. Because of the number of students in your class, this may take as long as {3}:{4} minutes. Wait at least that long and check again to see if it has submitted properly.", Environment.NewLine, section.Block.LongName, section.Course.Name, (5 * section.Students.Count) / 60, (5 * section.Students.Count) % 60), user, "*****@*****.**", "Attendance Bot"); SubmittedLabel.Text = "Attendance for this section is Currently Processing."; SubmittedLabel.CssClass = "working_highlight"; } } else if (allSubmitted) { SubmittedLabel.Text = "Successfully Submitted."; SubmittedLabel.CssClass = "success_highlight"; } else { SubmittedLabel.Text = "You have not yet entered attendance data."; SubmittedLabel.CssClass = "incomplete_highlight"; } LogCurrentData(api); } }
private void DoChangeURL() { string _Url = Convert.ToString(ViewState["Url"]); string _Urltype = Convert.ToString(ViewState["UrlType"]); if (!String.IsNullOrEmpty(_Url)) { var objUrls = new UrlController(); string TrackingUrl = _Url; _Urltype = Globals.GetURLType(_Url).ToString("g").Substring(0, 1); if (_Urltype == "U" && (_Url.StartsWith("~/" + PortalSettings.DefaultIconLocation, StringComparison.InvariantCultureIgnoreCase))) { _Urltype = "I"; } ViewState["UrlType"] = _Urltype; if (_Urltype == "F") { if (_Url.ToLower().StartsWith("fileid=")) { TrackingUrl = _Url; var objFile = FileManager.Instance.GetFile(int.Parse(_Url.Substring(7))); if (objFile != null) { _Url = objFile.Folder + objFile.FileName; } } else { //to handle legacy scenarios before the introduction of the FileServerHandler var fileName = Path.GetFileName(_Url); var folderPath = _Url.Substring(0, _Url.LastIndexOf(fileName)); var folder = FolderManager.Instance.GetFolder(_objPortal.PortalID, folderPath); var fileId = -1; if (folder != null) { var file = FileManager.Instance.GetFile(folder, fileName); if (file != null) { fileId = file.FileId; } } TrackingUrl = "FileID=" + fileId.ToString(); } } if (_Urltype == "M") { if (_Url.ToLower().StartsWith("userid=")) { UserInfo objUser = UserController.GetUserById(_objPortal.PortalID, int.Parse(_Url.Substring(7))); if (objUser != null) { _Url = objUser.Username; } } } UrlTrackingInfo objUrlTracking = objUrls.GetUrlTracking(_objPortal.PortalID, TrackingUrl, ModuleID); if (objUrlTracking != null) { chkNewWindow.Checked = objUrlTracking.NewWindow; chkTrack.Checked = objUrlTracking.TrackClicks; chkLog.Checked = objUrlTracking.LogActivity; } else //the url does not exist in the tracking table { chkTrack.Checked = false; chkLog.Checked = false; } ViewState["Url"] = _Url; } else { if (!String.IsNullOrEmpty(_Urltype)) { optType.ClearSelection(); if (optType.Items.FindByValue(_Urltype) != null) { optType.Items.FindByValue(_Urltype).Selected = true; } else { optType.Items[0].Selected = true; } } else { if (optType.Items.Count > 0) { optType.ClearSelection(); optType.Items[0].Selected = true; } } chkNewWindow.Checked = false; //Need check chkTrack.Checked = false; //Need check chkLog.Checked = false; //Need check } //Url type changed, then we must draw the controlos for that type _doRenderTypeControls = true; }
protected void LoadInfo(int sectionId, DateTime date) { using (WebhostEntities db = new WebhostEntities()) { int year = DateRange.GetCurrentAcademicYear(); GradeTable attMarkings = db.GradeTables.Where(t => t.AcademicYearID == year && t.Name.Equals("Attendance")).Single(); AttendanceTable.Rows.Clear(); Section section = db.Sections.Where(sec => sec.id == sectionId).Single(); BlockNameLabel.Text = String.Format("{0} Attendance", section.Block.Name); foreach (Student student in section.Students.OrderBy(s => s.LastName).ThenBy(s => s.FirstName).ToList()) { AttendanceMarking mark = null; if (section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).Count() > 0) { mark = section.AttendanceMarkings.Where(m => m.StudentID == student.ID && m.AttendanceDate.Equals(date)).Single(); } TableRow row = new TableRow(); TableCell nameCell = new TableCell(); Label nameLabel = new Label() { Text = student.FirstName + " " + student.LastName, ToolTip = "Advisor: " + student.Advisor.FirstName + " " + student.Advisor.LastName }; HiddenField sidf = new HiddenField() { Value = Convert.ToString(student.ID) }; nameCell.Controls.Add(sidf); nameCell.Controls.Add(nameLabel); TableCell markingCell = new TableCell(); RadioButtonList markddl = new RadioButtonList(); markddl.RepeatLayout = RepeatLayout.Flow; markddl.RepeatDirection = RepeatDirection.Horizontal; markddl.RepeatColumns = 4; markddl.DataSource = MedAttendanceMarking.GetDatasource(); markddl.DataTextField = "Text"; markddl.DataValueField = "ID"; markddl.DataBind(); markddl.ClearSelection(); if (mark != null) { markddl.SelectedValue = Convert.ToString(mark.MarkingIndex); } else { markddl.SelectedIndex = 2; } markingCell.Controls.Add(markddl); row.Cells.Add(nameCell); row.Cells.Add(markingCell); AttendanceTable.Rows.Add(row); } } }