public void LoadResponseForm() { ReportShow rp = BUS_AdminData.Instance.BUS_GetReportByReportId(reportId); AccountShow ac = BUS_AdminData.Instance.BUS_GetAccountByAccountId(rp.getAccountId()); txb_classSV.Text = ac.@class; txb_nameSV.Text = ac.fullName; txbRoomId.Text = roomId.ToString(); txbEquipmentName.Text = equipmentName; txbEquipmentStatus.Text = equipmentStatus; rtbNote.Text = note; dtpReportedDate.Value = Convert.ToDateTime(reportDate); }
static void Main(string[] args) { ATS ats = new ATS(); ReportShow show = new ReportShow(); BillingSystem billingSystem = new BillingSystem(ats); Contract contract1 = ats.RegisterContract(new Client("Ivan", "Ivanov", 30), TariffTypes.Standart); Contract contract2 = ats.RegisterContract(new Client("Ilja", "Iljin", 10), TariffTypes.Elementary); Contract contract3 = ats.RegisterContract(new Client("Dima", "Grachev", 50), TariffTypes.Lux); contract1.Client.AddMoney(50); var t1 = ats.GetNewTerminal(contract1); var t2 = ats.GetNewTerminal(contract2); var t3 = ats.GetNewTerminal(contract3); t1.ConnectToPort(); t2.ConnectToPort(); t3.ConnectToPort(); t1.Call(t2.Number); Thread.Sleep(1000); t2.EndCall(); Thread.Sleep(1000); t3.Call(t1.Number); Thread.Sleep(1000); t3.EndCall(); t2.Call(t1.Number); Thread.Sleep(30000); t1.EndCall(); t3.Call(1234567); t2.Call(t2.Number); Console.WriteLine("Sorted records:"); foreach (var item in show.SortCalls(billingSystem.GetReport(t2.Number), SortTypes.SortByPrice)) { Console.WriteLine("Calls:\n Type {0} |\n Date: {1} |\n Duration: {2} | Cost: {3} | Telephone number: {4}", item.CallType, item.Date, item.Time.ToString("mm:ss"), item.Price, item.Number); } Console.ReadKey(); }
//public void DAL_DeleteAccount(List<String> lusername) //{ // foreach(string i in lusername) // { // var sup = db.ACCOUNTs.Where(p => p.username == i).FirstOrDefault(); // db.ACCOUNTs.Remove(sup); // db.SaveChanges(); // } //} #endregion #region FMain Huỳnh Ngọc Thuật //SELECT REPORT.reportId, REPORT.roomId, MAX(RESPONSE.responseType) as 'responseType', responsedDate, MIN(CAST(message AS NVARCHAR(100))) as message, equipmentName, equipmentStatus, CAST(note AS NVARCHAR(100))[note], reportedDate //FROM REPORT //LEFT JOIN RESPONSE ON RESPONSE.reportId = REPORT.reportId //INNER JOIN EQUIPMENT ON EQUIPMENT.equipmentId = REPORT.equipmentId //INNER JOIN STATUS ON STATUS.statusId = REPORT.statusId //GROUP BY REPORT.reportId, REPORT.roomId, responsedDate, equipmentName, equipmentStatus, CAST(note AS NVARCHAR(100)) , reportedDate public List <ReportShow> DAL_ReportShow() { List <ReportShow> listReportShow = new List <ReportShow>(); // Lay tat ca cac report var l1 = (from report in db.REPORTs join equipment in db.EQUIPMENTs on report.equipmentId equals equipment.equipmentId join status in db.STATUS on report.statusId equals status.statusId join response in db.RESPONSEs on report.reportId equals response.reportId into p from p2 in p.DefaultIfEmpty() select new { reportId = report.reportId, accontId = report.accountId, roomId = report.roomId, responseDate = (p2 == null) ? null : p2.responsedDate, Type = (p2 == null) ? 0 : p2.responseType, message = (p2 == null) ? null : p2.message, equipmentName = equipment.equipmentName, equipmentStatus = status.equipmentStatus, note = report.note, reportDate = report.reportedDate, isEdit = report.isEdit }); // loc bo cac report bi trung var l2 = (from response in db.RESPONSEs group response by response.reportId into g select new { reportID = g.Key, responseID = (from t2 in g select t2.responseType).Max(), }); var L_END = (from kq in l1 join list in l2 on kq.reportId equals list.reportID into p from ps in p.DefaultIfEmpty() where (kq.Type == ps.responseID) || (kq.Type == 0) select new { reportId = kq.reportId, accountId = kq.accontId, roomId = kq.roomId, responseDate = kq.responseDate, responseMassage = kq.message, equipmentName = kq.equipmentName, equipmentStatus = kq.equipmentStatus, reportMessage = kq.note, reportDate = kq.reportDate, isEdit = kq.isEdit }).ToList(); // Them tung report vao listReportShow foreach (var item in L_END) { ReportShow newReport = new ReportShow(); newReport.STT = item.reportId; newReport.setAccountId(item.accountId); newReport.roomID = item.roomId; newReport.responsedDate = Convert.ToDateTime(item.responseDate); newReport.responseMessage = item.responseMassage; newReport.equipmentName = item.equipmentName; newReport.equipmentStatus = item.equipmentStatus; newReport.reportMessage = item.reportMessage; newReport.reportedDate = Convert.ToDateTime(item.reportDate); newReport.setIsEdit(Convert.ToBoolean(item.isEdit)); listReportShow.Add(newReport); } return(listReportShow); }