public void Begin(string pathFile) { using (var reader = new StreamReader(pathFile)) { IService <ProductBL> productService = new ProductService(new ProductRepository(new SalesContext()), _mapper); IService <OrderBL> orderService = new OrderService(new OrderRepository(new SalesContext()), _mapper); IService <ManagerBL> managerService = new ManagerService(new ManagerRepository(new SalesContext()), _mapper); IService <ReportBL> reportService = new ReportService(new ReportRepository(new SalesContext()), _mapper); IService <CustomerBL> customerService = new CustomerService(new CustomerRepository(new SalesContext()), _mapper); using (var csvReader = new CsvFileReader(pathFile)) { csvReader.Dilimiter = ';'; string record = string.Empty; while ((record = reader.ReadLine()) != null) { csvReader.CreateObject(record); ProductBL product = csvReader.GetProduct(); CustomerBL customer = csvReader.GetCustomer(); ManagerBL manager = csvReader.GetManager(); DoWorkWithEntity(ref product, productService, _lock); DoWorkWithEntity(ref manager, managerService, _lock); DoWorkWithEntity(ref customer, customerService, _lock); ReportBL report = csvReader.GetReport(manager.Id); report.Manager = manager; DoWorkWithEntity(ref report, reportService, _lock); OrderBL order = csvReader.GetOrder(customer.Id, product.Id, report.Id); DoWorkWithEntity(ref order, orderService, _lock); } } } }
public void BindGraph() { try { ReportBL objBL = new ReportBL(); ApplicationResult objResult = new ApplicationResult(); objResult = objBL.DryerPerformanceReportMonthlyGraph(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)); List <String> dateyearArr = new List <String>(); // datatable column to array for (int a = 0; a < objResult.ResultDt.Rows.Count; a++) { dateyearArr.Add(objResult.ResultDt.Rows[a]["Date/Year"].ToString()); } List <String> PercentageEnggBDArr = new List <String>(); // datatable column to array for (int a = 0; a < objResult.ResultDt.Rows.Count; a++) { PercentageEnggBDArr.Add(objResult.ResultDt.Rows[a]["PercentageEnggBD"].ToString()); } // var stringArr = objResult.ResultDt.Rows[0].ItemArray.Select(x => x.ToString()).ToArray(); } catch (Exception ex) { log.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>"); } }
public ActionResult SearchLineChartTotalPaymentReportForYear([DataSourceRequest] DataSourceRequest request, DateTime fromDate, DateTime toDate, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().SearchReportTPForYear(fromDate, toDate, reportTypeID); GradationCompare[] arrayGradation = null; if (listData.Count > 0) { int countList = listData.Count; arrayGradation = new GradationCompare[countList]; int count = 0; foreach (ReportForTotalPayment item in listData) { // Tạo mảng insert dữ liệu để vẽ biểu đồ cột arrayGradation[count] = new GradationCompare() { NameGradationCompare = item.Year, amount = item.Payed, NameType = string.Concat("Tháng ", item.Month) }; count++; } } else { arrayGradation = new GradationCompare[1]; arrayGradation[0] = new GradationCompare() { NameGradationCompare = "1", NameType = "" }; } return(Json(arrayGradation)); }
public ActionResult <ReportProblemListResponseModel> ViewReportProblemSiteList([FromBody] ReportProblemListInputModel data) { ReportProblemListResponseModel res = new ReportProblemListResponseModel(); try { ReportBL bl = new ReportBL(DbContext); var temp = bl.GetProblem(data); res.data = temp.data; res.Message = "Success"; res.Response = true; res.TotalData = temp.TotalData; res.TotalPages = temp.TotalPages; return(res); } catch (Exception ex) { res.Message = ex.Message; res.Response = false; return(res); } }
public ActionResult ShowAddEditProjectReportPopup(int projectId, int reportId = 0) { ReportViewModel model = new ReportViewModel(); ReportBL reportBL = new ReportBL(); model.ProjectId = projectId; List <ConnectionModel> connectionList = new ReportBL().GetConnectionsByProject(projectId); var ddlConnectionList = connectionList.Select(a => new { id = a.Id, name = a.ConnectionName }); model.ConnectionList = new SelectList(ddlConnectionList, "id", "name"); if (reportId > 0) { ReportModel reportModel = reportBL.GetReportById(reportId); if (reportModel != null) { model.Id = reportModel.Id; model.Name = reportModel.Name; model.Description = reportModel.Description; model.ProcedureName = reportModel.ProcedureName; model.ProjectId = reportModel.ProjectId; model.ProjectName = reportModel.ProjectName; model.ConnectionId = reportModel.ConnectionId; model.IsActive = reportModel.IsActive; model.ConnectionList = new SelectList(connectionList, "Id", "CONNECTIONNAME", reportModel.ConnectionId); } if (model == null) { model = new ReportViewModel(); } } return(PartialView("_AddEditProjectReport", model)); }
public ActionResult List() { var Result = new object(); List <ReportModel> reportList = new ReportBL().GetReportList(); Result = new { aaData = (from report in reportList select new { Id = report.Id, Name = report.Name, Description = report.Description, ProcedureName = report.ProcedureName, ProjectId = report.ProjectId, ProjectName = report.ProjectName, ConnectionId = report.ConnectionId, ConnectionName = report.ConnectionName, IsActive = report.IsActive == 1 ? "Active" : "Inactive", Action = "" } ).ToArray() }; return(Json(Result, JsonRequestBehavior.AllowGet)); }
protected void btnGo_OnClick(object sender, EventArgs e) { try { LogBl objLogBl = new LogBl(); ReportBL objReportBl = new ReportBL(); //DateTime dtFromDateTime = DateTime.ParseExact(txtFromDate.Text + " " + txtFromTime.Text, "dd/MM/yyyy HH:mm:ss", // CultureInfo.InvariantCulture); var objResult = objReportBl.DailyMassBalanceReport(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), Convert.ToInt32(ddlReport.SelectedValue)); gvMassBalanceReport.DataSource = objResult.ResultDt; gvMassBalanceReport.DataBind(); if (gvMassBalanceReport.Rows.Count > 0) { divExport.Visible = true; divNo.Visible = false; } else { divExport.Visible = false; divNo.Visible = true; } } catch (Exception ex) { log.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>"); } }
public ActionResult CreateDataMarket() { List <ReportForMaket> result = new List <ReportForMaket>(); result = new ReportBL().CreateDataMarket(); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult <ReportSiteResponseModel> ReportSite([FromBody] ReportSiteInputModel data) { ReportSiteResponseModel res = new ReportSiteResponseModel(); try { ReportBL bl = new ReportBL(db); var temp = bl.GetReportSite(data); res.data = temp.data; res.Message = "Success"; res.Response = true; res.TotalPages = temp.TotalPages; res.TotalData = temp.TotalData; return(res); } catch (Exception ex) { res.Message = ex.Message; res.Response = false; return(res); } }
public ActionResult Index(ReportMenuViewModel vmodel) { if (ModelState.IsValid) { int language = LanguageBL.CheckLanguageSession(); switch (vmodel.TypeReportId) { case "1": vmodel.ReportTotalSales = ReportBL.FindReportTotalSales(vmodel, language); ViewBag.report = true; ViewBag.TypeReportId = vmodel.TypeReportId; return(PartialView("_PartialReportTotalSales", vmodel.ReportTotalSales)); case "2": vmodel.ReportTotalSalesByProduct = ReportBL.FindReportTotalSalesByProduct(vmodel, language); ViewBag.report = true; ViewBag.TypeReportId = vmodel.TypeReportId; return(PartialView("_PartialReportTotalSalesByProduct", vmodel.ReportTotalSalesByProduct)); default: break; } } vmodel.TypesReport = ReportBL.FindAllTypesReport(); return(View(vmodel)); }
public ActionResult <AddReportProblemResponseModel> ReportToSPV([FromBody] AddReportProblemInputModel data) { AddReportProblemResponseModel res = new AddReportProblemResponseModel(); try { ReportBL bl = new ReportBL(DbContext); //artinya ini report di kirim ke SPV/Admin //kalau false berarti kebalikannya data.isToSPV = true; var temp = bl.Save(data); res.data = temp; res.Message = "Success"; res.Response = true; return(res); } catch (Exception ex) { res.Message = ex.Message; res.Response = false; return(res); } }
public List <Account> Login() { //bool result = new AccountModel().Login(model.UserName, model.Password); List <Account> listAccount = new ReportBL().GetListAccount(); return(listAccount); }
public ActionResult SearchColumnsChartCompareForMonth([DataSourceRequest] DataSourceRequest request, int month, int year, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().DataReportTPCompareForMonth(year, month, reportTypeID); GradationCompare[] arrayGradation = null; if (listData.Count.Equals(3)) { arrayGradation = new GradationCompare[3]; int count = 0; foreach (ReportForTotalPayment item in listData) { // Tạo mảng insert dữ liệu để vẽ biểu đồ cột arrayGradation[count] = new GradationCompare() { NameGradationCompare = string.Format("Tháng {0}/{1}", item.Month, item.Year), amount = item.Payed, NameType = string.Format("Tháng {0}/{1}", item.Month, item.Year) }; count++; } } else { arrayGradation = new GradationCompare[1]; arrayGradation[0] = new GradationCompare() { NameGradationCompare = "1", NameType = "" }; } return(Json(arrayGradation)); }
public ActionResult ColumnsChartGradationCompare(string reportTypeID) { // typeID trong sql int typeID = 1; int toYear = DateTime.Today.Year; List <ReportForTotalPayment> listData = new ReportBL().DataReportTPForGradationCompare(toYear, typeID, reportTypeID); GradationCompare[] arrayGradation = null; if (listData.Count.Equals(2)) { arrayGradation = new GradationCompare[2]; int count = 0; foreach (ReportForTotalPayment item in listData) { // Tạo mảng insert dữ liệu để vẽ biểu đồ cột arrayGradation[count] = new GradationCompare() { NameGradationCompare = string.Concat("Lũy thừa 3 tháng năm ", item.Year), amount = item.Payed, NameType = string.Concat("Lũy thừa 3 tháng năm ", item.Year) }; count++; } } else { arrayGradation = new GradationCompare[1]; arrayGradation[0] = new GradationCompare() { NameGradationCompare = "1", NameType = "" }; } return(Json(arrayGradation)); }
/// <summary> /// Search báo cáo theo ngày của thị trường /// </summary> /// <param name="request"></param> /// <param name="fromDay"></param> /// <param name="toDay"></param> /// <returns></returns> public ActionResult SearchReportGradationCompare([DataSourceRequest] DataSourceRequest request, int gradation, int year, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().DataReportTPForGradationCompare(year, gradation, reportTypeID); string text = " tháng đầu năm "; switch (gradation) { case 1: text = string.Concat("3", text); break; case 2: text = string.Concat("6", text); break; case 3: text = string.Concat("9", text); break; default: text = string.Concat("12", text); break; } if (listData.Count.Equals(2)) { bool check = true; foreach (ReportForTotalPayment item in listData) { item.ReportID = string.Concat("Lũy kế ", text, item.Year); item.Type = 0; // Set lại giá trị cho check để lấy giá trị của năm trước check = false; } double totalPaymentPercent = listData[0].Payed - listData[1].Payed; // Object báo cáo tăng giảm so với cùng kỳ (%) ReportForTotalPayment dataDifferencePercent = new ReportForTotalPayment() { ReportID = string.Format("Tăng giảm so với cùng kì {0} (%)", year - 1), Payed = Math.Round(totalPaymentPercent / listData[1].Payed * 100, 2, MidpointRounding.ToEven), }; listData.Add(dataDifferencePercent); // Object báo cáo tăng giảm so với cùng kỳ (+/-) ReportForTotalPayment dataDifference = new ReportForTotalPayment() { ReportID = string.Format("Tăng giảm so với cùng kì {0} (+/-)", year - 1), Payed = Math.Round(totalPaymentPercent, 2, MidpointRounding.ToEven), }; listData.Add(dataDifference); } return(Json(listData.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }
// GET: Reports //[Authorize(Roles = "admin")] //[Authorize(Roles = "manager")] //[Authorize(Roles = "vendor")] public ActionResult Index() { ReportMenuViewModel vm = new ReportMenuViewModel(); vm.TypesReport = ReportBL.FindAllTypesReport(); ViewBag.report = false; return(View(vm)); }
public ActionResult SearchReportCompareForMonth([DataSourceRequest] DataSourceRequest request, int month, int year, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().DataReportTPCompareForMonth(year, month, reportTypeID); if (listData.Count.Equals(3)) { foreach (ReportForTotalPayment item in listData) { item.ReportID = string.Format("Tháng {0}/{1}", item.Month, item.Year); } double totalPayment = listData[0].Payed - listData[1].Payed; double totalPaymentLastYear = listData[0].Payed - listData[2].Payed; // Object báo cáo tăng giảm so với tháng trước (%) ReportForTotalPayment dataDifference = null; dataDifference = new ReportForTotalPayment() { ReportID = "Tăng giảm so với tháng trước (%)", Payed = Math.Round(totalPayment / listData[1].Payed * 100, 2, MidpointRounding.ToEven), }; listData.Add(dataDifference); // Object báo cáo tăng giảm so với tháng trước (+/-) dataDifference = new ReportForTotalPayment() { ReportID = "Tăng giảm so với tháng trước (+/-)", Payed = Math.Round(totalPayment, 2, MidpointRounding.ToEven), }; listData.Add(dataDifference); // Object báo cáo tăng giảm so với cùng kì năm trước (%) dataDifference = new ReportForTotalPayment() { ReportID = "Tăng giảm so với cùng kì năm trước (%)", Payed = Math.Round(totalPaymentLastYear / listData[2].Payed * 100, 2, MidpointRounding.ToEven), }; listData.Add(dataDifference); // Object báo cáo tăng giảm so với cùng kì năm trước (+/-) dataDifference = new ReportForTotalPayment() { ReportID = "Tăng giảm so với cùng kì năm trước (+/-)", Payed = Math.Round(totalPaymentLastYear, 2, MidpointRounding.ToEven), }; listData.Add(dataDifference); } else { listData = new List <ReportForTotalPayment>(); } return(Json(listData.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }
public ActionResult SearchColumnChartMaketReportForGradation([DataSourceRequest] DataSourceRequest request, int gradation, int year, string reportTypeID) { //string typeID = "1"; List <ReportForTotalPayment> listData = new ReportBL().DataReportTPForGradationCompare(year, gradation, reportTypeID); GradationCompare[] arrayGradation = null; string text = " tháng đầu năm "; switch (gradation) { case 1: text = string.Concat("3", text); break; case 2: text = string.Concat("6", text); break; case 3: text = string.Concat("9", text); break; default: text = string.Concat("12", text); break; } if (listData.Count.Equals(2)) { arrayGradation = new GradationCompare[2]; int count = 0; foreach (ReportForTotalPayment item in listData) { // Tạo mảng insert dữ liệu để vẽ biểu đồ cột arrayGradation[count] = new GradationCompare() { NameGradationCompare = string.Format("Lũy thừa {0} {1}", text, item.Year), amount = item.Payed, NameType = string.Format("Lũy thừa {0} {1}", text, item.Year) }; count++; } } else { arrayGradation = new GradationCompare[1]; arrayGradation[0] = new GradationCompare() { NameGradationCompare = "1", NameType = "" }; } return(Json(arrayGradation)); }
/// <summary> /// Search báo cáo theo ngày của thị trường /// </summary> /// <param name="request"></param> /// <param name="fromDay"></param> /// <param name="toDay"></param> /// <returns></returns> public ActionResult SearchReportTotalPaymentForYear([DataSourceRequest] DataSourceRequest request, DateTime fromDate, DateTime toDate, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().SearchReportTPForYear(fromDate, toDate, reportTypeID); // Số năm chênh lệch // Số 1 là số ngày cộng int countYear = toDate.Year - fromDate.Year + 1; // Khởi tạo datatable DataTable table = new DataTable(); // Tạo các cột cho datatable table.Columns.Add("ReportID", typeof(String)); for (int i = 1; i <= countYear; i++) { table.Columns.Add(string.Concat("year", i), typeof(double)); } table.Columns.Add("Year", typeof(string)); if (listData.Count > 0) { // Tạo vòng for cho 12 tháng for (int i = 1; i <= 12; i++) { List <ReportForTotalPayment> listMonths = listData.Where(x => x.Month == i.ToString()).ToList(); List <string> listYear = new List <string>(); // số thứ tự theo năm int count = 1; DataRow dr = table.NewRow(); dr["ReportID"] = string.Concat("Tháng ", i); foreach (ReportForTotalPayment item in listMonths) { dr[string.Concat("year", count)] = item.Payed; listYear.Add(item.Year); count++; } // add list year dr["Year"] = string.Join("_", listYear).ToString(); table.Rows.Add(dr); } // add dòng tổng DataRow drows = table.NewRow(); drows["ReportID"] = "Tổng"; for (int i = 1; i <= countYear; i++) { object sum = table.Compute(string.Format("SUM({0})", string.Concat("year", i)), string.Empty); drows[string.Concat("year", i)] = Convert.ToDouble(string.IsNullOrEmpty(sum.ToString()) ? 0 : sum); } table.Rows.Add(drows); } return(Json(table.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }
public JsonResult GetConnectionsByProject(int projectId) { List <ConnectionModel> connectionList = new ReportBL().GetConnectionsByProject(projectId); return(Json(new { success = true, connectionList = from connection in connectionList select new { id = connection.Id, text = connection.ConnectionName } }, JsonRequestBehavior.AllowGet)); }
public ActionResult SearchLineChartReportTotalPaymentForMonth([DataSourceRequest] DataSourceRequest request, DateTime fromDate, DateTime toDate, string reportTypeID) { List <ReportForTotalPayment> listData = new ReportBL().SearchReportTPForMonth(fromDate, toDate, reportTypeID); foreach (ReportForTotalPayment item in listData) { item.ReportID = string.Concat("Tháng ", item.Month, "/", item.Year); item.Type = 0; } return(Json(listData)); }
public List <Partner> ListPartNer() { try { List <Partner> listData = new ReportBL().ListPartNer(); return(listData); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <ReportDetailtServiceType> SearchMarketForPartner(DateTime fromDate, DateTime toDate, string partnerCode, string reportTypeID) { try { List <ReportDetailtServiceType> listReport = new ReportBL().SearchReportDetailtMonth(fromDate, toDate, partnerCode, reportTypeID); return(listReport); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <Report> ListDataGradationCompare(int toYear, int typeID, string reportTypeID) { try { List <Report> result = new ReportBL().ListDataGradationCompare(toYear, typeID, reportTypeID); return(result); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <Market> ListMarket() { try { List <Market> listData = new ReportBL().ListMarket(); return(listData); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <Account> Login() { //bool result = new AccountModel().Login(model.UserName, model.Password); List <Account> listAccount = new ReportBL().GetListAccount(); // Gán quyền Admin listAccount.Add(new Account() { EmployeeID = "Admin", Password = "******" }); return(listAccount); }
public List <ReportForMaket> SearchReportMonth(DateTime fromDate, DateTime toDate, string reportTypeID) { try { List <ReportForMaket> listReport = new ReportBL().SearchReportMaketForMonth(fromDate, toDate, reportTypeID); return(listReport); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <ReportForMaket> ListDataCompareMonth(int toYear, int toMonth, string reportTypeID) { try { List <ReportForMaket> result = new ReportBL().ListDataMaketForCompareMonth(toYear, toMonth, reportTypeID); return(result); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <ReportForMaket> CreateDataMarket() { try { List <ReportForMaket> listReport = new ReportBL().CreateDataMarket(); return(listReport); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }
public List <Report> SearchReportDay(DateTime fromDate, DateTime toDate, int reportTypeID) { try { List <Report> listReport = new ReportBL().SearchReportDay(fromDate, toDate, reportTypeID); return(listReport); } catch (Exception ex) { throw new DongAException(DongALayer.Business, ex.Message, ex); } }