예제 #1
0
        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 }));
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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;
        }
예제 #5
0
        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
        }
예제 #6
0
        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();
        }
예제 #7
0
        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();
        }
예제 #8
0
        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();
        }
예제 #9
0
        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;
        }