public static object[] GetChartData() { ProductServiceClient prodService; Invoice[] invoices; prodService = new ProductServiceClient(); invoices = prodService.GetAllInvoices(); List <Invoice> data = new List <Invoice>(); data = invoices.ToList(); var chartData = new object[invoices.Count() + 1]; chartData[0] = new object[] { "Invoice Type", "Inv_Quantity", "Total Price" }; int j = 0; foreach (var i in data) { j++; chartData[j] = new object[] { "Type: " + i.Inv_Type + "(" + i.P_Code + ")", i.Quantity, i.Total_Price }; } return(chartData); }
public static object[] GetChartData() { ProductServiceClient ProService; Invoice[] invoice; ProService = new ProductServiceClient(); Product[] product = ProService.GetAllProducts(); invoice = ProService.GetAllInvoices(); List <Invoice> data = new List <Invoice>(); data = invoice.ToList(); var chartData = new object[invoice.Count() + 1]; chartData[0] = new object[] { "P_Code: ", "Product Quantity", "Invoice Quantity" }; int j = 0; foreach (var i in data) { j++; foreach (Product u in product) { //task per user int taskcount = 0; foreach (Invoice t in invoice) { if (u.P_Code.Equals(t.P_Code)) { taskcount++; } } //tasks done per user int donecount = 0; foreach (Invoice t in invoice) { if (u.P_Quantity.Equals(t.Quantity) && t.Inv_Type.Equals("dispatch")) { donecount++; } } foreach (Invoice t in invoice) { if (u.P_Code.Equals(i.P_Code)) { chartData[j] = new object[] { u.P_Code + ": " + i.Inv_Type, taskcount, donecount }; } } } } return(chartData); }
protected void Page_Load(object sender, EventArgs e) { userClient = new UserServiceClient(); prodClient = new ProductServiceClient(); tasks.InnerHtml = userClient.GetTasks().Length.ToString(); users.InnerHtml = userClient.GetAllUsers().Length.ToString(); int incomingcount = 0; int outgoingcount = 0; Invoice[] invs = prodClient.GetAllInvoices(); foreach (Invoice inv in invs) { if (inv.Inv_Type.Equals("incoming")) { incomingcount += inv.Quantity; } else if (inv.Inv_Type.Equals("dispatch")) { outgoingcount += inv.Quantity; } } string display = " "; Invoice[] invoices = prodClient.GetInvoicebyType("dispatch"); foreach (Invoice inv in invoices) { Product pro = prodClient.SearchProduct(inv.P_Code); User u = userClient.GetUserbyID(inv.UserID); display += "<tr>" + "<td class='text-truncate'>" + pro.P_Name + " " + inv.P_Code + "</td>" + "<td class='text-truncate p-1'>" + "<ul class='list-unstyled users-list m-0'>" + "<li><span class='avatar avatar-busy'>" + "<img src='" + u.pphoto + "' alt='avatar' data-toggle='tooltip' data-placement='right' title='" + u.Name + "'><i class=''></i>" + "</span></li>" + "</ul>" + "</td>" + "<td class='text-truncate'>" + inv.Quantity + "</td> " + "<td class='text-truncate'>" + inv.INV_Date + "</td> " + "</tr>" ; } ordertable.InnerHtml = display; incoming.InnerHtml = incomingcount.ToString(); outgoing.InnerHtml = outgoingcount.ToString(); GetChartData(); }
protected void Page_Load(object sender, EventArgs e) { userService = new UserServiceClient(); prodService = new ProductServiceClient(); Invoice[] invoices = prodService.GetAllInvoices(); Product[] products = prodService.GetAllProducts(); User[] users = userService.GetAllUsers(); string display = ""; Product pro = null; User u = null; //foreach (Invoice inv in invoices) for (int i = invoices.Length - 1; i >= 0; i--) { //User u = userService.GetUserbyID(inv.UserID); foreach (User us in users) { if (us.UserID.Equals(invoices[i].UserID)) { u = us; } } foreach (Product p in products) { if (p.P_Code.Equals(invoices[i].P_Code)) { pro = p; } } if (pro != null) { display += "<tr>" + "<td><input type='checkbox' class='input-chk'></td>" + "<td>" + "<p class='text'>" + invoices[i].INV_Date + "</p>" + "</td>" + "<td><span class='badge badge-primary'>" + pro.P_Name + " " + invoices[i].P_Code + "</span></td>" + "<td><p class='text'>" + invoices[i].Quantity + "</p></td>" + "<td><span class='badge badge-danger'>" + u.Name + "</span></td>" + "<td><span class='badge badge-primary'>" + invoices[i].Inv_Type + "</span></td>" + "</tbody>" ; } } trans.InnerHtml = display; }
private void getData() { ProductServiceClient prodService; Invoice[] data; prodService = new ProductServiceClient(); data = prodService.GetAllInvoices(); string lowstock = "Suggestion: "; foreach (Product u in prodService.GetAllProducts()) { foreach (var i in data) { if (i.P_Code.Equals(u.P_Code)) { bool isdone = true; foreach (var j in data) { if (!i.Inv_Type.Equals("dispatch")) { isdone = false; } } if (isdone) { lowstock += u.P_Name.ToUpper(); } } } } if (!lowstock.Equals("Suggestion: ")) { lowstock += " Sells the fastest (:- should get the next jobs !!!"; } suggestiontask.InnerHtml = lowstock; }