protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string ProtocolVersion = Request.QueryString["ProtocolVersionCKey"]; DataTable dt = ProtocolsData.GetDraftVersions(decimal.Parse(ProtocolVersion)); ddVersionLeft.Items.Add(""); ddVersionRight.Items.Add(""); foreach (DataRow dr in dt.Rows) { ddVersionLeft.Items.Add(dr["DraftVersion"].ToString()); ddVersionRight.Items.Add(dr["DraftVersion"].ToString()); } ddSection.Items.Add("Title"); ddSection.Items.Add("Cover Page"); ddSection.Items.Add("Authors"); ddSection.Items.Add("Case Summary"); ddSection.Items.Add("Notes and References"); } if (ddVersionLeft.SelectedIndex == 0 || ddVersionRight.SelectedIndex == 0) { btnCompare.Visible = false; } else { btnCompare.Visible = true; } }
public List <DraftVersion> GetDraftVersions(string ProtocolVersion) { List <DraftVersion> versions = new List <DraftVersion>(); DataTable dt = ProtocolsData.GetDraftVersions(decimal.Parse(ProtocolVersion)); foreach (DataRow dr in dt.Rows) { DraftVersion obj = new DraftVersion(); obj.Version = dr["DraftVersion"].ToString(); versions.Add(obj); } return(versions); }
protected void grdDashboard_RowDataBound(object sender, GridViewRowEventArgs e) { //if ((e.Row.RowState & DataControlRowState.Edit) > 0) { string protocolversionckey = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "ProtocolVersionCKey")); if (protocolversionckey != "") { DropDownList ddlReviewStatus = (DropDownList)e.Row.FindControl("ddlReviewStatus"); DropDownList ddlVersions = (DropDownList)e.Row.FindControl("ddlVersions"); DataTable dt = ProtocolsData.GetDraftVersions(decimal.Parse(protocolversionckey)); ddlVersions.DataSource = dt; ddlVersions.DataTextField = "DraftVersion"; ddlVersions.DataValueField = "DraftVersion"; ddlVersions.DataBind(); ddlVersions.SelectedIndex = 0; string DraftVersion = ddlVersions.SelectedValue.ToString(); List <ReviewStatus> reviewstatuses = new List <ReviewStatus>(); if (DraftVersion != "") { reviewstatuses = new Workflow().GetWorkflowProtocolReviewStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); } //ddlReviewStatus.ForeColor = System.Drawing.Color.Black; List <Author> authors = new Author().getAuthors(decimal.Parse(protocolversionckey), 0, 999); //get the work version if (reviewstatuses.Count > 0) { foreach (Author reviewer in authors) { ReviewStatus status = reviewstatuses.Where(x => x.ReviewerCKey == reviewer.AuthorCKey && reviewer.RoleCKey == (decimal)3.100004300).FirstOrDefault(); if (status != null) { if (status.Status != "3.100004300") { reviewer.Name = reviewer.Name + " - Pending"; } else { reviewer.Name = reviewer.Name + " - Done"; } } else { //must have been addeded after draft was released //reviewer.Name = reviewer.Name + " - Pending"; //new Workflow().AddProtocolReviewer(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); //if ((int)reviewer.RoleCKey == 3) //{ // reviewer.Name = reviewer.Name + " - Pending"; //} } } } else { } var reviewers = authors.Where(x => x.RoleCKey == (decimal)3.100004300).OrderBy(x => x.Name); ddlReviewStatus.DataSource = reviewers; ddlReviewStatus.DataTextField = "Name"; ddlReviewStatus.DataValueField = "AuthorCKey"; ddlReviewStatus.DataBind(); DropDownList ddlEditStatus = (DropDownList)e.Row.FindControl("ddlEditStatus"); List <ProtocolStatus> editstatuses = new List <ProtocolStatus>(); if (DraftVersion != "") { editstatuses = new Workflow().GetWorkflowProtocolEditStatus(decimal.Parse(protocolversionckey), decimal.Parse(ddlVersions.SelectedValue.ToString())); } if (editstatuses.Count > 0) { foreach (Author editor in authors) { ProtocolStatus status = editstatuses.Where((x => x.EditorCKey == editor.AuthorCKey && ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2))).FirstOrDefault(); //ProtocolStatus status = editstatuses.Where(x => x.EditorCKey == editor.AuthorCKey).FirstOrDefault(); if (status != null) { if (status.Status != "4.100004300") { editor.Name = editor.Name + " - Pending review"; } else { editor.Name = editor.Name + " - Done"; } } else //author has not submitted draft yet { // if ((int)editor.RoleCKey == 1 || (int)editor.RoleCKey == 2) // editor.Name = editor.Name + " - Pending"; //new Workflow().AddProtocolAuthor(decimal.Parse(protocolversionckey), ((SSPUser)Session["user"]).CKey); } } } else { /* * foreach (Author editor in authors) * { * editor.Name = editor.Name + " - Pending"; * }*/ } var editors = authors.Where(x => x.RoleCKey == (decimal)1.100004300 || x.RoleCKey == (decimal)2.100004300).OrderBy(x => x.Name); ddlEditStatus.DataSource = editors; ddlEditStatus.DataTextField = "Name"; ddlEditStatus.DataValueField = "AuthorCKey"; ddlEditStatus.DataBind(); DropDownList ddleCCStatus = (DropDownList)e.Row.FindControl("ddleCCStatus"); DropDownList ddlPublicationStatus = (DropDownList)e.Row.FindControl("ddlPublicationStatus"); ddleCCStatus.Items.Add("Not Available"); ddlPublicationStatus.Items.Add("Not Available"); } } }