public JsonResult GET(string BusID, string TeacherID, string ReportType, string Content) { if (!ValidateSession()) { return(SessionError); } if (TeacherID != CurrentUser.ObjectId) { return(RequestIllegal); } if (DataBaseOperation.QuerySingle(new DBQuery().WhereIDIs(BusID).WhereEqualTo("TeacherObjectID", TeacherID), out SchoolBusObject bus) != DBQueryStatus.ONE_RESULT) { return(RequestIllegal); } BusReport busReport = new BusReport { BusID = BusID, TeacherID = TeacherID, ReportType = (BusReportTypeE)Convert.ToInt32(ReportType), OtherData = Content }; if (DataBaseOperation.CreateData(ref busReport) != DBQueryStatus.ONE_RESULT) { return(DataBaseError); } InternalMessage message_TP = new InternalMessage(InternalMessageTypes.Bus_Status_Report, CurrentUser, busReport, BusID); MessagingSystem.AddMessageProcesses(message_TP); return(Json(new { Report = busReport })); }
public ActionResult report(Bill bill, int id) { BusReport br = new BusReport(); var bill_id = db.Bill.Where(v => v.id == id).SingleOrDefault(); byte[] abytes = br.PrepareReport(GetBus(bill_id.id)); return(File(abytes, "application/pdf")); }
public JsonResult GET(string BusID, string TeacherID, string ReportType, string Content) { Dictionary <string, string> dict = new Dictionary <string, string>(); if (ValidateSession()) { if (TeacherID != CurrentUser.ObjectId) { return(RequestIllegal); } if (DataBaseOperation.QuerySingleData( new DBQuery() .WhereEqualTo("objectId", BusID) .WhereEqualTo("TeacherObjectID", TeacherID) , out SchoolBusObject bus) != DBQueryStatus.ONE_RESULT) { return(RequestIllegal); } BusReport busReport = new BusReport { BusID = BusID, TeacherID = TeacherID, ReportType = (BusReportTypeE)Convert.ToInt32(ReportType), OtherData = Content }; if (DataBaseOperation.CreateData(ref busReport) == DBQueryStatus.ONE_RESULT) { InternalMessage message_TC = new InternalMessage() { DataObject = busReport, ObjectId = BusID, User = CurrentUser, _Type = GlobalMessageTypes.Bus_Status_Report_TC }; InternalMessage message_TP = new InternalMessage() { DataObject = busReport, ObjectId = BusID, User = CurrentUser, _Type = GlobalMessageTypes.Bus_Status_Report_TP }; MessagingSystem.AddMessageProcesses(message_TC, message_TP); dict.Add("CreatedAt", busReport.CreatedAt.ToNormalString()); dict.Add("ErrCode", "0"); dict.Add("ReportID", busReport.ObjectId); dict.Add("ErrMessage", "null"); } else { return(DataBaseError); } } return(Json(dict)); }
protected void ShowButton_Click(object sender, EventArgs e) { string[] projectStringArray = ProjectControl.GetAllCheckedItems(); List <string> projectStringList = new List <string>(projectStringArray); List <int> projectIdList = projectStringList.ConvertAll <int>(Convert.ToInt32); string[] userStringArray = UserControl.GetAllCheckedItems(); List <string> userStringList = new List <string>(userStringArray); List <int> userIdList = userStringList.ConvertAll <int>(Convert.ToInt32); ReportResult result = BusReport.GenerateUserReport(userIdList, projectIdList, GetFromDate(), GetToDate(), int.Parse(CompletionList.SelectedValue), GetCompletionFromDate(), GetCompletionToDate()); GenerateTable(result); MainTable.Visible = true; PrintButton.Visible = true; }
private void BindProjects() { ProjectControl.DataValueField = "ProjectId"; ProjectControl.DataTextField = "ProjectName"; ProjectControl.DataSource = BusReport.GetProjectsByUser(GetFromDate(), GetToDate(), UserControl.Value, ClientControl.Value, ProjectGroupControl.Value, int.Parse(CompletionList.SelectedValue), GetCompletionFromDate(), GetCompletionToDate()); ProjectControl.DataBind(); if (ProjectControl.Items.Count > 0) { ProjectControl.Value = new string[] { "0" } } ; // any else { ProjectControl.Value = new string[] { } }; // not set }
private void BindProjectGroups() { ProjectGroupControl.DataValueField = "ProjectGroupId"; ProjectGroupControl.DataTextField = "ProjectGroupName"; ProjectGroupControl.DataSource = BusReport.GetProjectGroupsByUser(GetFromDate(), GetToDate(), UserControl.Value, ClientControl.Value); ProjectGroupControl.DataBind(); if (ProjectGroupControl.Items.Count > 0) { ProjectGroupControl.Value = new string[] { "0" } } ; // any else { ProjectGroupControl.Value = new string[] { } }; // not set BindProjects(); }
private void BindUsers() { UserControl.DataValueField = "UserId"; UserControl.DataTextField = "UserName"; UserControl.DataSource = BusReport.GetUsers(GetFromDate(), GetToDate()); UserControl.DataBind(); if (UserControl.Items.Count > 0) { UserControl.Value = new string[] { "0" } } ; // any else { UserControl.Value = new string[] { } }; // not set BindClients(); }
private void BindClients() { ClientControl.DataValueField = "ClientId"; ClientControl.DataTextField = "ClientName"; ClientControl.DataSource = BusReport.GetClients(GetFromDate(), GetToDate(), ManagerControl.Value); ClientControl.DataBind(); if (ClientControl.Items.Count > 0) { ClientControl.Value = new string[] { "0" } } ; // any else { ClientControl.Value = new string[] { } }; // not set BindProjectGroups(); }
protected void ShowButton_Click(object sender, EventArgs e) { string[] projectStringArray = ProjectControl.GetAllCheckedItems(); List <string> projectStringList = new List <string>(projectStringArray); List <int> projectIdList = projectStringList.ConvertAll <int>(Convert.ToInt32); ReportResult result; if (GroupingList.SelectedValue == "1") // By project { result = BusReport.GenerateProjectTaskBusinessScoreReport(projectIdList, GetFromDate(), GetToDate(), int.Parse(CompletionList.SelectedValue), GetCompletionFromDate(), GetCompletionToDate()); } else { result = BusReport.GenerateBusinessScoreProjectTaskReport(projectIdList, GetFromDate(), GetToDate(), int.Parse(CompletionList.SelectedValue), GetCompletionFromDate(), GetCompletionToDate()); } GenerateTable(result, GroupingList.SelectedValue == "1"); MainTable.Visible = true; PrintButton.Visible = true; }