private void Accept_OnClick(object sender, RoutedEventArgs e) { for (int i = 0; i < checkedEmployees.Length; i++) { if (checkedEmployees[i]) { Mail mail = new Mail(); mail.send(i + 2, fileName, checkedEmployees.Length); } } }
private void Accept_OnClick(object sender, RoutedEventArgs e) { Mail mail = new Mail(); string fromMail = "[email protected] "; if (currentUser.Equals("user3")) { fromMail = "*****@*****.**"; } else if (currentUser.Equals("user4")) { fromMail = "*****@*****.**"; } mail.send(fromMail, "*****@*****.**", fileName); }
private void Accept_OnClick(object sender, RoutedEventArgs e) { var window = new ExcelDialog(); window.Show(); var newProcess = Archiver.GetNewProcessId(); Archiver.AddActivity(newProcess, Archiver.ProcessActivity.odebranie_zamowienia.ToString()); Archiver.AddActivity(newProcess, Archiver.ProcessActivity.przygotowanie_arkusza.ToString()); for (int i = 0; i < checkedEmployees.Length; i++) { if (checkedEmployees[i]) { Mail mail = new Mail(); Archiver.AddActivity(newProcess, Archiver.ProcessActivity.uzupelnianie_zamowienia_pracownik_.ToString() + (i + 2)); mail.send(i + 2, fileName, checkedEmployees.Length, newProcess); } } Archiver.AddActivity(newProcess, Archiver.ProcessActivity.zatwierdzenie_oferty.ToString()); Archiver.AddActivity(newProcess, Archiver.ProcessActivity.archiwizacja.ToString()); }
public static void DivideOrders(String xmlPath) { int numberOfDividedFiles = 0; Employee[] employees = new Employee[3]; employees[0] = new Employee(); employees[0].name = "employee2"; employees[0].products = new string[] { "1" }; employees[1] = new Employee(); employees[1].name = "employee3"; employees[1].products = new string[] { "2" }; employees[2] = new Employee(); employees[2].name = "employee4"; employees[2].products = new string[] { "3" }; List <XmlNode> products = new List <XmlNode>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); XmlReader reader = new XmlNodeReader(xmlDoc); DataSet newDs = new DataSet(); newDs.ReadXml(reader); DataTable dt = newDs.Tables[0]; DataRelationCollection children = dt.ChildRelations; for (int i = 0; i < xmlDoc.DocumentElement.ChildNodes[0].ChildNodes.Count; i++) { String x = xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[i].Name; if (xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[i].Name == "product") { products.Add(xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[i]); } } for (int i = 0; i < employees.Length; i++) { bool ifAnyProductMatchEmployee = false; XmlDocument xmlDocdest = new XmlDocument(); XmlNode rootNode = xmlDocdest.CreateElement("orders"); xmlDocdest.AppendChild(rootNode); XmlNode orderNode = xmlDocdest.CreateElement("order"); rootNode.AppendChild(orderNode); AddOrderInformation(xmlDocdest, orderNode, xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[0].InnerText, xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[1].InnerText, xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[2].ChildNodes[0].InnerText, xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[2].ChildNodes[1].InnerText, xmlDoc.DocumentElement.ChildNodes[0].ChildNodes[2].ChildNodes[2].InnerText); foreach (XmlNode product in products) { if (employees[i].products.Contains(product.ChildNodes[0].InnerText)) { AddProduct(xmlDocdest, orderNode, product); ifAnyProductMatchEmployee = true; } } if (ifAnyProductMatchEmployee) { int employeeNumber = i + 2; String pathToXml = "..\\..\\xmls_result\\divided_xml_employee_" + employeeNumber + ".xml"; String pathToExcel = "..\\..\\excel_result\\divided_excel_employee_" + employeeNumber + ".xlsx"; xmlDocdest.Save(pathToXml); ExcelManager.XmlToExcel(pathToXml, pathToExcel); Mail mail = new Mail(); mail.send(employeeNumber, pathToExcel, 1); numberOfDividedFiles++; } } }