private void review_Clicked(object sender, EventArgs e) { Button clickedButton = (Button)sender; int row = Int32.Parse(clickedButton.ID.Substring(7)); int data = Convert.ToInt32(hf_Selected_Object.Value); List_able listable = current_Viewable.returnListable(); Abstract_Iter_able form_obj = listable.get_iterable_List()[row]; JCF_Submission_Facade submission_Facade = new JCF_Submission_Facade(); Flow_Rec_Facade flow_Rec_Facade = new Flow_Rec_Facade(); Flow_Rec parent_Flow; JCF_Submission submission; List <Abstract_Iter_able> form_List = new List <Abstract_Iter_able>(); if (form_obj.GetType().Equals(typeof(JCF_Submission))) { List <Abstract_Iter_able> flow_List = flow_Rec_Facade.GetByIdWhere(((JCF_Submission)form_obj).SubmissionID, "Submission_ID"); if (flow_List.Count > 0) { parent_Flow = (Flow_Rec)flow_Rec_Facade.GetByIdWhere(((JCF_Submission)form_obj).SubmissionID, "Submission_ID")[0]; List <Abstract_Iter_able> flow_objs = flow_Rec_Facade.GetByIdWhere(parent_Flow.ID, "Parrent_Flow"); List <Abstract_Iter_able> submissions; submission = (JCF_Submission)submission_Facade.GetByIdWhere(((JCF_Submission)form_obj).SubmissionID, "SubmissionID")[0]; form_List.Add(submission); foreach (Flow_Rec flow_obj in flow_objs) { submissions = submission_Facade.GetByIdWhere(flow_obj.Submission_ID, "SubmissionID"); if (submissions.Count > 0) { form_List.Add(submissions[0]); } } } else { submission = (JCF_Submission)submission_Facade.GetByIdWhere(((JCF_Submission)form_obj).SubmissionID, "SubmissionID")[0]; form_List.Add(submission); } Session["form_Obj"] = form_List; Session["viewDesired"] = "Edit"; } else { parent_Flow = (Flow_Rec)flow_Rec_Facade.GetByIdWhere(((Flow_Rec)form_obj).Submission_ID, "Submission_ID")[0]; Flow_Rec flow_obj = (Flow_Rec)flow_Rec_Facade.GetByIdWhere(parent_Flow.ID, "Parrent_Flow")[0]; submission = (JCF_Submission)submission_Facade.GetByIdWhere(flow_obj.Submission_ID, "SubmissionID")[0]; Session["viewDesired"] = "Evaluation"; while (parent_Flow.Parrent_Flow != new Guid()) { form_List.Add((Abstract_Iter_able)submission_Facade.GetByIdWhere(parent_Flow.Submission_ID, "SubmissionID")[0]); parent_Flow = (Flow_Rec)flow_Rec_Facade.GetByIdWhere(parent_Flow.Parrent_Flow, "ID")[0]; } if (parent_Flow.Parrent_Flow == new Guid()) { form_List.Add((Abstract_Iter_able)submission_Facade.GetByIdWhere(parent_Flow.Submission_ID, "SubmissionID")[0]); } Session["form_Obj"] = form_List; } Session["formable"] = master_Forms_List[data]; Session["eval_Obj"] = submission; Session["viewableType"] = master_Forms_List[data].Name; Session["eval_Obj"] = submission; ParentPortlet.NextScreen("Objectable_View"); }
private void delete_Clicked(object sender, EventArgs e) { Button clickedButton = (Button)sender; CNTR_Resource_Schedule_Facade resource_Schedule_Facade = new CNTR_Resource_Schedule_Facade(); string deleteLogMessage = PortalUser.Current.FirstName + " " + PortalUser.Current.LastName + " has deleted a Submission." + "\n"; int row = Int32.Parse(clickedButton.ID.Substring(7)); List_able listObj = current_Viewable.returnListable(); switch (listObj.getType()) { case "ICS_NHibernate.JCF_Submission": JCF_Submission obj = (JCF_Submission)listObj.get_iterable_List()[row]; JCF_Submission_Facade submission_Facade = new JCF_Submission_Facade(); JCF_Answer_Facade answer_Facade = new JCF_Answer_Facade(); Flow_Rec_Facade flow_Rec_Facade = new Flow_Rec_Facade(); submission_Facade.Remove(obj); deleteLogMessage += "SubmissionID: " + obj.SubmissionID.ToString() + "\n"; deleteLogMessage += "SubmissionUser: "******"\n"; deleteLogMessage += "SubmissionFormID: " + obj.FormID.ToString() + "\n"; deleteLogMessage += "SubmissionSubmittedDate: " + obj.SubmittedDate.ToString() + "\n"; try { List <CNTR_Resource_Schedule> resourceList = resource_Schedule_Facade.GetByIdWhere(obj.SubmissionID, "Submission_ID").Cast <CNTR_Resource_Schedule>().ToList(); foreach (CNTR_Resource_Schedule schedule in resourceList) { resource_Schedule_Facade.Remove(schedule); deleteLogMessage += "ResourceID: " + schedule.Schedule_ID.ToString() + "\n"; deleteLogMessage += "ResourceStartTime: " + schedule.Start_Date.ToString() + "\n"; deleteLogMessage += "ResourceEndTime: " + schedule.End_Date.ToString() + "\n"; deleteLogMessage += "ResourceUser: "******"\n"; } } catch { EventLog.WriteEntry("ICSNET", "Error while clearing resource scheduled when deleting submission."); } List <Flow_Rec> flow_List = flow_Rec_Facade.GetByIdWhere(obj.SubmissionID, "Submission_ID").Cast <Flow_Rec>().ToList(); if (flow_List.Any()) { Flow_Rec parent_Flow; if (flow_List[0].Parrent_Flow == new Guid()) { parent_Flow = flow_List[0]; } else { flow_List = flow_Rec_Facade.GetByIdWhere(flow_List[0].Parrent_Flow, "ID").Cast <Flow_Rec>().ToList(); if (flow_List.Any()) { parent_Flow = flow_List[0]; } else { parent_Flow = null; } } if (parent_Flow != null) { flow_List = flow_Rec_Facade.GetByIdWhere(parent_Flow.ID, "Parrent_Flow").Cast <Flow_Rec>().ToList(); List <JCF_Submission> submission_List = new List <JCF_Submission>(); foreach (Flow_Rec flow in flow_List) { List <JCF_Submission> submissions = submission_Facade.GetByIdWhere(flow.Submission_ID, "SubmissionID").Cast <JCF_Submission>().ToList(); if (submissions.Any()) { submission_List.Add(submissions[0]); submission_Facade.Remove(submissions[0]); } flow_Rec_Facade.Remove(flow); } foreach (JCF_Submission sub in submission_List) { List <Abstract_Iter_able> answer_List = answer_Facade.GetByIdWhere(sub.SubmissionID, "SubmissionID"); foreach (JCF_Answer answer in answer_List) { answer_Facade.Remove(answer); } } flow_Rec_Facade.Remove(parent_Flow); } } List <Abstract_Iter_able> answers_List = answer_Facade.GetByIdWhere(obj.SubmissionID, "SubmissionID"); foreach (JCF_Answer x in answers_List) { answer_Facade.Remove(x); } break; default: break; } var flow_Object = master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)] as Flow_Form_able; if (flow_Object != null) { LoadFlow(master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)], master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)].Index_Value, master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)].Index); } else { LoadForm(master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)].facade, master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)].Index_Value, master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)].Index, master_Forms_List[Convert.ToInt32(hf_Selected_Object.Value)]); } EventLog.WriteEntry("ICSNET", deleteLogMessage, EventLogEntryType.Warning); return; }
public void ChangeView(Object sender, EventArgs e) { Guid submission_Guid = new Guid(hf_Submission.Value); CNTR_CovidForm_Rec flow = new JICSBaseFacade <CNTR_CovidForm_Rec>().GetQuery().Where(x => x.SubmissionID == submission_Guid).SingleOrDefault(); int data = Convert.ToInt32(hf_Selected_Object.Value); switch (hf_isButtonClicked.Value) { case "edit": Session["viewDesired"] = "edit"; Session["form_Obj"] = flow; Session["formable"] = master_Forms_List[data]; Session["viewableType"] = master_Forms_List[data].Name; ParentPortlet.NextScreen("Objectable_View"); break; case "review": Session["viewDesired"] = "edit"; Session["form_Obj"] = flow; Session["formable"] = master_Forms_List[data]; Session["viewableType"] = master_Forms_List[data].Name; ParentPortlet.NextScreen("Objectable_View"); break; case "delete": new CNTR_CovidForm_Rec_Facade().Remove(flow); break; case "print": List_able listObj = current_Viewable.returnListable(); Abstract_Iter_able form_obj = listObj.get_iterable_List()[data]; EventLog.WriteEntry("ICSNET", "ListObject:" + listObj.getType(), EventLogEntryType.Information); switch (listObj.getType()) { case "ICS_NHibernate.JCF_Submission": JCF_Submission obj = (JCF_Submission)listObj.get_iterable_List()[data]; this.print_Form(obj); break; case "ICS_NHibernate.Flow_Rec": Flow_Rec flow_Obj = (Flow_Rec)listObj.get_iterable_List()[data]; JCF_Submission submission_Object = new JICSBaseFacade <JCF_Submission>().GetQuery().Where(x => x.SubmissionID == flow_Obj.Submission_ID).SingleOrDefault(); if (submission_Object != null) { this.print_Form(submission_Object); } break; case "ICS_NHibernate.CNTR_CovidForm_Rec": this.print_Form(flow); break; default: break; } break; } }