public ActionResult UploadResult(int AssignmentId) { Metrics.Program.Main(); List <UploadResultModel> UploadResult = new List <UploadResultModel>(); UploadResult.Add(new UploadResultModel { RWSMS = DataLibrary.Models.UploadResultModel.RWSMS, SDPMS = DataLibrary.Models.UploadResultModel.SDPMS, OOPMG = DataLibrary.Models.UploadResultModel.OOPMG, TUG = DataLibrary.Models.UploadResultModel.TUG, TG = DataLibrary.Models.UploadResultModel.TG, finalScore = DataLibrary.Models.UploadResultModel.finalScore }); int TotAsNum = 1; var UserId = User.Identity.GetUserId(); var res = DBBridge.CheckAttendanceNum(UserId, AssignmentId); if (res.Count >= 1) { TotAsNum = res.Count + 1; } var Score = DataLibrary.Models.UploadResultModel.finalScore; DBBridge.CreateResult(UserId, AssignmentId, Score, TotAsNum); return(View(UploadResult)); }
public ActionResult Upload(HttpPostedFileBase file, ResultModel model) { var AsNumCheck = DBBridge.CheckAssignmentNum(model.AssignmentId); if (AsNumCheck.Count == 0) { ViewBag.Message = "There is no Assignment Id which you typed."; return(View()); } if (file != null && file.ContentLength > 0) { if (!file.FileName.Contains(".cs")) { ViewBag.Message = "The file extension is not .cs."; return(View()); } var path = Path.Combine("C:\\Users\\deniz\\source\\repos\\GradProj\\Metrics\\", "Assignment.cs"); file.SaveAs(path); } else { ViewBag.Message = "The file is empty!"; return(View()); } return(RedirectToAction("UploadResult", new { AssignmentId = model.AssignmentId })); }
public ActionResult CreateAssignment(AssignmentModel model) { if (ModelState.IsValid) { var info = DBBridge.CreateAssignment(model.AssignmentName, model.AssignmentInfo); if (info == 1) { ViewBag.Message = "The assignment is created successfully!"; } else { ViewBag.Message = "The assignment cannot be created!"; } } return(View()); }
public ActionResult Index() { var data = DBBridge.LoadAssignments(); List <AssignmentModel> Assignments = new List <AssignmentModel>(); foreach (var row in data) { Assignments.Add(new AssignmentModel { AssignmentId = row.AsId, AssignmentName = row.AsName, AssignmentInfo = row.AsInfo, AssignmentDate = row.AsDate }); } return(View(Assignments)); }
public ActionResult CreateRole(string UserId, UserModel model) { if (ModelState.IsValid) { var info = DBBridge.CreateRole(UserId, model.Role); if (info == 1) { ViewBag.Message = "The user role is created successfully!"; } else { ViewBag.Message = "The user role cannot be created!"; } } return(View()); }
public ActionResult ViewUsers() { var data = DBBridge.LoadUsers(); List <UserModel> Users = new List <UserModel>(); foreach (var row in data) { Users.Add(new UserModel { UserId = row.UserId, InsId = row.InstitutionId, UserName = row.UserFullName, MailAddress = row.Email }); } return(View(Users)); }
public ActionResult EditUserInfo(string UserId, UserModel model) { if (ModelState.IsValid) { var info = DBBridge.EditUser(UserId, model.InsId, model.UserName, model.MailAddress); if (info == 1) { ViewBag.Message = "The user information is changed successfully!"; } else { ViewBag.Message = "The user information cannot be changed!"; } } return(View()); }
public JsonResult SummaryReports() { //var query = "select count(betmoney) as TotalBets,sum(betmoney) as Sales,CONVERT(VARCHAR(19),month(betdate))+'/' +CONVERT(VARCHAR(19),day(betdate))+'/' +CONVERT(VARCHAR(19),Year(betdate)) as businessday from Receipts group by day(betdate) ,month(betdate),year(betdate)"; const string query = "select count(Stake) as TotalBets,sum(Stake) as Sales,CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate)) as businessday," + "[dbo].[ReturnTotalWinAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19)," + "Year(ReceiptDate))) as WinAmount,[dbo].[ReturnTotalOutStandingAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Outstanding ," + "[dbo].[ReturnTotalPaidAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Paid," + " [dbo].[ReturnTotalCanceledTicket](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Canceled," + " [dbo].[ReturnTotalCanceledAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as TotalCanceled ," + " [dbo].[ReturnTotalPaidNumber](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as PaidNumber," + " [dbo].[ReturnTicketByStatus](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate)),3) as WinNumber " + "from Receipts where ReceiptDate is not null and ReceiptDate > dateadd(day,-8,getdate()) and ReceiptStatus<> -1 group by day(ReceiptDate) ,month(ReceiptDate),year(ReceiptDate) order by month(ReceiptDate) desc,day(ReceiptDate) desc"; var report = new List <SummaryReportVm>(); try { var bridge = new DBBridge(); var reader = bridge.ExecuteReaderSQL(query); while (reader.Read()) { var dayreport = new SummaryReportVm { TicketSold = reader.GetInt32(0), Sales = Convert.ToDecimal(reader.GetDouble(1)), BusinessDay = reader.GetString(2), TotalWins = reader.GetInt32(3), PaidOrders = reader.GetInt32(5), Canceled = reader.GetInt32(7), CanceledNumber = reader.GetInt32(6), TicketsPaid = reader.GetInt32(8), WinCount = reader.GetInt32(9), }; report.Add(dayreport); } } catch (Exception er) { } var reports = report .Select(x => new { x.Sales, x.BusinessDay, x.TotalWins, x.PaidOrders, x.Canceled, Outstanding = x.OutStanding(), x.TicketsPaid, x.CanceledNumber, x.TicketSold, Profit = x.Sales - x.TotalWins, WinCount = x.WinCount, Cash = x.Cash() }); var counts = reports.Count(); return(Json(reports, JsonRequestBehavior.AllowGet)); }
public ActionResult Results() { var data = DBBridge.LoadResults(); List <ResultModel> Results = new List <ResultModel>(); foreach (var row in data) { Results.Add(new ResultModel { ResultId = row.ResId, InstitutionId = row.InstitutionId, AssignmentName = row.AsName, Score = row.Score, NumberofAttendance = row.TotAsNum }); } return(View(Results)); }
public ActionResult ViewUsers() { ViewBag.Message = "View the registered users."; var data = DBBridge.LoadUsers(); List <UserModel> Users = new List <UserModel>(); foreach (var row in data) { Users.Add(new UserModel { UserId = row.InstitutionId, UserName = row.UserFullName, MailAddress = row.EMail }); } return(View(Users)); }
public ActionResult Results() { ViewBag.Message = "View the past results."; var data = DBBridge.LoadResults(); List <ResultModel> Results = new List <ResultModel>(); foreach (var row in data) { Results.Add(new ResultModel { ResultId = row.ResultId, AssignmentName = row.AssignmentName, Score = row.Score, NumberofAttendance = row.TotalAssignmentNumber }); } return(View(Results)); }
public JsonResult BranchSummaryReports(int id) { // var query = "select count(betmoney) as TotalBets,sum(betmoney) as Sales,CONVERT(VARCHAR(19),month(betdate))+'/' +CONVERT(VARCHAR(19),day(betdate))+'/' +CONVERT(VARCHAR(19),Year(betdate)) as businessday from Receipts where branchid="+id+" group by day(betdate) ,month(betdate),year(betdate)"; string query = "select count(Stake) as TotalBets,sum(Stake) as Sales,CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate)) as businessday," + "[dbo].[ReturnTotalWinAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19)," + "Year(ReceiptDate))) as WinAmount,[dbo].[ReturnTotalOutStandingAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Outstanding ," + "[dbo].[ReturnTotalPaidAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Paid," + " [dbo].[ReturnTotalCanceledTicket](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as Canceled," + " [dbo].[ReturnTotalCanceledAmount](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as TotalCanceled ," + " [dbo].[ReturnTotalPaidNumber](CONVERT(VARCHAR(19),month(ReceiptDate))+'/' +CONVERT(VARCHAR(19),day(ReceiptDate))+'/' +CONVERT(VARCHAR(19),Year(ReceiptDate))) as PaidNumber " + "from Receipts where ReceiptDate is not null and ReceiptStatus<> -1 and Receipts.BranchId= " + id + " group by day(ReceiptDate) ,month(ReceiptDate),year(ReceiptDate) "; var report = new List<SummaryReportVm>(); try { var bridge = new DBBridge(); var reader = bridge.ExecuteReaderSQL(query); while (reader.Read()) { var dayreport = new SummaryReportVm { TicketSold = reader.GetInt32(0), Sales = Convert.ToDecimal(reader.GetDouble(1)), BusinessDay = reader.GetString(2), TotalWins = reader.GetInt32(3), PaidOrders = reader.GetInt32(5), Canceled = reader.GetInt32(7), CanceledNumber = reader.GetInt32(6), TicketsPaid = reader.GetInt32(8), }; report.Add(dayreport); } } catch (Exception er) { } var reports = report .Select(x => new { x.Sales, x.BusinessDay, x.TotalWins, x.PaidOrders, x.Canceled, Outstanding = x.OutStanding(), x.TicketsPaid, x.CanceledNumber, x.TicketSold }); var counts = reports.Count(); return Json(reports, JsonRequestBehavior.AllowGet); }
public JsonResult BranchTeller() { var branchManager = BetDatabase.Accounts.SingleOrDefault(t => t.UserId == User.Identity.Name); var branch = (branchManager.AdminE); var managerName = branchManager.UserId; string query = "select A.userid,AmountE as Balance,[dbo].[TellerBets](getdate(),A.UserId) As Sales,[dbo].[TellerBetsCount](getdate(),A.UserId) As TotalReciepts,[dbo].[TellerCashOut](getdate(),A.UserId) As CashOut from Accounts A where AdminE=" + branch + " and A.UserId not like '" + managerName + "'"; var report = new List <ManagerSummaryVM>(); try { var bridge = new DBBridge(); var reader = bridge.ExecuteReaderSQL(query); while (reader.Read()) { var dayreport = new ManagerSummaryVM { TellerName = reader.GetString(0), TellerBalance = Convert.ToDecimal(reader.GetDouble(1)), TotalSales = Convert.ToDecimal(reader.GetDecimal(2)), CashOut = Convert.ToDecimal(reader.GetDecimal(4)), ReceiptCount = Convert.ToDecimal(reader.GetDecimal(3)) }; report.Add(dayreport); } } catch (Exception er) { } var reports = report.Select(x => new { Balance = x.TellerBalance, TotalReceipt = x.ReceiptCount, UserId = x.TellerName, Sales = x.TotalSales, CashOut = x.CashOut, }).ToList(); return(Json(reports, JsonRequestBehavior.AllowGet)); }