コード例 #1
0
ファイル: DAL_AdminData.cs プロジェクト: huynhngocthuat/pbl3
        public bool DAL_CheckIfResolvedReport(int reportId)
        {
            //reportStatus defalt = 0: chưa được nhận tin, 1: chưa xử lý, 2: đã xử lý, 3: thông tin sai
            //responseType = 1: đã nhận tin, 2: đã xử lý, 3: thông tin báo cáo sai
            REPORT report = db.REPORTs.Where(p => p.reportId == reportId).Single();

            //nếu report chưa được nhận
            if (report.reportStatus == 0)
            {
                return(false);
            }

            //nếu báo cáo đã được nhận, chưa được xử lý
            else if (report.reportStatus == 1)
            {
                return(false);
            }

            //nếu báo cáo đã được xử lý
            else if (report.reportStatus == 2)
            {
                return(true);
            }

            //nếu báo cáo đã được phản hồi là sai thông tin
            else if (report.reportStatus == 3)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public void DAL_EditReport(int reportId, string newRoomId, string newEquipmentId, string newStatusId, string newNote)
        {
            REPORT report = db.REPORTs.Find(reportId);

            report.roomId       = newRoomId;
            report.equipmentId  = newEquipmentId;
            report.statusId     = newStatusId;
            report.note         = newNote;
            report.reportedDate = DateTime.Now;
            db.SaveChanges();
        }
コード例 #3
0
ファイル: DAL_AdminData.cs プロジェクト: huynhngocthuat/pbl3
        public bool DAL_CheckReportStatus(int reportId, int responseType)
        {
            //reportStatus default = 0: chưa được nhận tin, 1: chưa xử lý, 2: đã xử lý, 3: thông tin sai
            //responseType = 1: đã nhận tin, 2: đã xử lý, 3: thông tin báo cáo sai
            REPORT report = db.REPORTs.Where(p => p.reportId == reportId).Single();

            //nếu report chưa được nhận
            if (report.reportStatus == 0)
            {
                if (responseType == 1)
                {
                    return(true);                   //được phản hồi nhận tin
                }
                else if (responseType == 2)
                {
                    return(false);                        //không được phản hồi đã xử lý khi chưa nhận tin
                }
                else if (responseType == 3)
                {
                    return(false);                        //không được phản hồi báo cáo sai
                }
            }

            //nếu báo cáo đã được nhận, chưa được xử lý
            else if (report.reportStatus == 1)
            {
                if (responseType == 1)
                {
                    return(false);                   //không được phản hồi nhận tin
                }
                else if (responseType == 2)
                {
                    return(true);                        //được phản hồi đã xử lý
                }
                else if (responseType == 3)
                {
                    return(true);                        //được phản hồi rằng báo cáo sai
                }
            }
            return(false);
        }
コード例 #4
0
        public void DAL_AddReport(int newAccountId, string newRoomId, string newEquimentId, string newStatusId, string newNote)
        {
            //lay maxId
            int maxId = db.REPORTs.Select(p => p.reportId).Max();
            // tao bao cao
            REPORT report = new REPORT()
            {
                reportId     = maxId + 1,
                accountId    = newAccountId,
                roomId       = newRoomId,
                equipmentId  = newEquimentId,
                statusId     = newStatusId,
                note         = newNote,
                reportStatus = 0,
                reportedDate = DateTime.Now,
                isEdit       = true
            };

            db.REPORTs.Add(report);
            db.SaveChanges();
        }