internal static ChangeSet ConvertToSimple(create create) { ChangeSet changeSet = new ChangeSet(); Change change = new Change(); change.Type = ChangeType.Create; change.OsmGeo = new List <OsmGeo>(); if (create.node != null) { foreach (node nd in create.node) { change.OsmGeo.Add((OsmGeo)XmlSimpleConverter.ConvertToSimple(nd)); } } if (create.way != null) { foreach (way wa in create.way) { change.OsmGeo.Add((OsmGeo)XmlSimpleConverter.ConvertToSimple(wa)); } } if (create.relation != null) { foreach (relation re in create.relation) { change.OsmGeo.Add((OsmGeo)XmlSimpleConverter.ConvertToSimple(re)); } } changeSet.Changes = new List <Change>(); changeSet.Changes.Add(change); return(changeSet); }
public string createCourseString(string name, string user) { if (name.Length <= 0 || name == null) { return("nameNull"); } if (user.Length <= 0 || user == null) { return("userNull"); } string response = "Error"; try { create use = new create(); use.name = name; use.user = new Guid(user); response = createCourse(use).ToString(); } catch (Exception ex) { return(ex.ToString()); } return(response); }
public string createCourse(create use) { Guid courseId = Guid.NewGuid(); try { int check = checkCourse(use.name); if (check != 0) { return(check.ToString()); } SqlConnection con = new SqlConnection(data); SqlCommand cmd = new SqlCommand("INSERT INTO courseData (courseId, courseName, creator, status, information) VALUES (@courseId, @courseName, @creator, @status, @information)", con); cmd.Parameters.AddWithValue("@courseId", courseId); cmd.Parameters.AddWithValue("@courseName", use.name); cmd.Parameters.AddWithValue("@creator", use.user); cmd.Parameters.AddWithValue("@status", "locked"); cmd.Parameters.AddWithValue("@information", "tere"); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } catch (SqlException ex) { return(ex.ToString()); } catch (Exception ex) { return(ex.ToString()); } return(courseId.ToString());; }
private void addBtn_Click(object sender, RoutedEventArgs e) { /*int parse = dataGrid.SelectedIndex; * DataRowView rowView = dataGrid.SelectedValue as DataRowView; * * MessageBox.Show(parse.ToString() + rowView[0].ToString());*/ pageContent.Children.Clear(); UserControl usc = null; usc = new create(); pageContent.Children.Add(usc); }
private ChangeSet Convertv6XmlChanges(osmChange osm_change) { List <Change> changeList = new List <Change>(); if (osm_change.create != null) { for (int index1 = 0; index1 < osm_change.create.Length; ++index1) { create create = osm_change.create[index1]; List <OsmGeo> osmGeoList = new List <OsmGeo>(); if (create.node != null) { for (int index2 = 0; index2 < create.node.Length; ++index2) { osmGeoList.Add((OsmGeo)this.Convertv6XmlNode(create.node[index2])); } } if (create.way != null) { for (int index2 = 0; index2 < create.way.Length; ++index2) { osmGeoList.Add((OsmGeo)this.Convertv6XmlWay(create.way[index2])); } } if (create.relation != null) { for (int index2 = 0; index2 < create.relation.Length; ++index2) { osmGeoList.Add((OsmGeo)this.Convertv6XmlRelation(create.relation[index2])); } } if (osmGeoList.Count > 0) { changeList.Add(new Change() { OsmGeo = osmGeoList, Type = ChangeType.Create }); } } } return(new ChangeSet() { Changes = changeList }); }
public Main() { data = new DataProvider(); ran = new Random(); time = new Clock(this); economy = new Economy(); eventpool = DataProvider.data2Event(data.getDataFor(3)); for (int i = 0; i < 9; i++) { jobseekers.Add(new Employee(this)); } eventpool.ForEach(item => item.sys = this); create cr = new create(this); cr.Show(); time.DayEnded += new Clock.DayEndHandler(EndDay); // time.Start(); }
static void Main(string[] args) { GeneralMethods PTEGE = new GeneralMethods(); // string folderpath1 = ConfigurationManager.AppSettings["Folderpath"].ToString(); // string folderpath = (folderpath1 + DateTime.Now.ToString("dd-MM-yyyy")); // string aaa = PTEGE.AutoFolderCreate(folderpath); string oper = null; string Trackernm = ConfigurationManager.AppSettings["Trackername"].ToString().ToUpper(); if (Trackernm.Contains("NEW")) { oper = ConfigurationManager.AppSettings["Operatornew"].ToString(); } else if (Trackernm.Contains("OLD")) { oper = ConfigurationManager.AppSettings["Operatorold"].ToString(); } try { int MoveFile; // create c1 = new create(); //c1.createawb(@"E:\JITESH\PingAutomation\Output_File\20190114_123638.xls", "MAGNUM CARGO PVT. LTD", "020"); Console.WriteLine("program is started"); FileStream files; StreamWriter strWriter; String FileName = ConfigurationManager.AppSettings["LogfilePath"] + @"\PingAutomation" + DateTime.Now.ToString("dd-MMM-yyyy") + ".txt"; files = new FileStream(FileName, FileMode.Append, FileAccess.Write, FileShare.None); strWriter = new StreamWriter(files); strWriter.WriteLine("---------------------------------------------------------------"); strWriter.WriteLine("Log generated at " + DateTime.Now.ToString("dd-MMM-yyyy HH:mm")); strWriter.WriteLine(" "); Console.WriteLine("Log"); // create cc = new create(); // cc.createawb(@"E:\JITESH\PingAutomation\Output_File\20190131_060021.xls", "MAGNUM CARGO PVT. LTD", "020", "50752100", strWriter); #region datatable of status 2-ACk and hawb count 0 DataSet TrackerData = new DataSet(); TrackerData = PTEGE.isPresentontracker(); int o = TrackerData.Tables[0].Rows.Count; #endregion if (o >= 1) { #region get clientdetails from tracker for (int w = 0; w < o; w++) { Console.WriteLine("clientdetails"); string ClientName1 = TrackerData.Tables["Table1"].Rows[w]["Client_Name"].ToString(); int clen = ClientName1.Length; if (clen < 15) { int sss = clen - 1; ClientName = ClientName1.Substring(0, clen); } else { ClientName = ClientName1.Substring(0, 15); } Prefix = TrackerData.Tables["Table1"].Rows[w]["Pfx"].ToString(); AWBNo = TrackerData.Tables["Table1"].Rows[w]["AWB_No"].ToString(); HAWBcount = TrackerData.Tables["Table1"].Rows[w]["Hawb Count"].ToString(); Shipmentstatus = TrackerData.Tables["Table1"].Rows[w]["Shipment_Status"].ToString(); Console.WriteLine(ClientName + " " + Prefix + " " + AWBNo); string a = AWBNo.Substring(0, 4); string b = AWBNo.Substring(4, 4); string spaceAWB = a + " " + b; DataSet dd = new DataSet(); string excelpath = ConfigurationManager.AppSettings["RuleExcel_Ping"].ToString(); dd = PTEGE.ImportexcelData(excelpath, ClientName); #endregion int v = dd.Tables[0].Rows.Count; Thread.Sleep(300); for (int h = 0; h < v; h++) { Thread.Sleep(300); string Prefixexcl = dd.Tables["Sheet1"].Rows[h][1].ToString(); if (Prefixexcl.Contains(Prefix)) { Thread.Sleep(300); string Rule_Nm = dd.Tables["Sheet1"].Rows[h][2].ToString(); if (!Rule_Nm.Contains("Not_Done")) { #region pst string fpath = null; try { IEnumerable <MailItem> mailItems = readPst(ConfigurationManager.AppSettings["PSTFilePath"].ToString(), ConfigurationManager.AppSettings["PSTFolder"].ToString()); foreach (MailItem mailItem in mailItems) { string ReceivedTime = string.Empty, Sender = string.Empty, MailBody = string.Empty; string Subject = string.Empty; //Sender = mailItem.SenderEmailAddress; Sender = mailItem.SenderName; Subject = mailItem.Subject; { List <string> tempFileName = new List <string>(); List <string> tempPDFFileName = new List <string>(); // string temp = mailItem.Attachments[1].FileName; String FolderName = NewFolderName(); int k = 1; int j = mailItem.Attachments.Count; if (mailItem.Attachments.Count == 0) { Application app1 = new Application(); NameSpace outlookNs1 = app1.GetNamespace("MAPI"); MAPIFolder MoveToFolder1 = outlookNs1.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderDeletedItems); mailItem.Move(MoveToFolder1); strWriter.WriteLine(mailItem.Subject + " Have Moved to Deleted folder successfully as attachment is not present"); strWriter.WriteLine(" "); strWriter.WriteLine("-------------------------------------------------------"); strWriter.WriteLine(" "); MoveFile = 0; // break; } Console.WriteLine("mail attachment"); if (mailItem.Attachments.Count >= 1) { if (!string.IsNullOrEmpty(Subject)) { if (Subject.Contains(AWBNo) || Subject.Contains(spaceAWB)) { DataSet ex = new DataSet(); excelpath = ConfigurationManager.AppSettings["RuleExcel_Ping"].ToString(); ex = PTEGE.ImportexcelData(excelpath, ClientName); int p = ex.Tables[0].Rows.Count; for (int x = 0; x < p; x++) { Thread.Sleep(300); Console.WriteLine("RULECOUNT = " + x); string Prefixexcel = ex.Tables["Sheet1"].Rows[x][1].ToString(); Thread.Sleep(300); if (Prefix.Equals(Prefixexcel)) { Thread.Sleep(300); string Rule_Name = ex.Tables["Sheet1"].Rows[x][2].ToString(); if (!Rule_Name.Contains("Not_Done")) { Console.WriteLine("Rule present"); for (int g = 1; g <= mailItem.Attachments.Count; g++) { if (mailItem.Attachments[g].FileName.Contains(".pdf") || mailItem.Attachments[g].FileName.Contains(".PDF")) { Console.WriteLine("attachment downloaded"); fpath = ConfigurationManager.AppSettings["PDFFolderPath"].ToString(); mailItem.Attachments[g].SaveAsFile(fpath + mailItem.Attachments[g].FileName); string filename = fpath + mailItem.Attachments[g].FileName; Console.WriteLine(filename); string newfilename; string newpath; bool fHasSpace = filename.Contains(" "); if (fHasSpace == true) { newpath = filename.Replace(" ", ""); Console.WriteLine(newpath); // newfilename = Prefix + "-" + AWBNo; if (File.Exists(newpath)) { File.Delete(newpath); } System.IO.File.Move(filename, newpath); } else { newpath = filename; Console.WriteLine(newpath); } Console.WriteLine("Rule creation"); string rulename = Rule_Name + "_" + Prefixexcel; String targetfile = DateTime.Now.ToString("yyyyMMdd_hhmmss"); String targetfile1 = targetfile + ".xls"; string targetfolderpath = ConfigurationManager.AppSettings["Output_File_Path"].ToString(); string outputfile = targetfolderpath + targetfile1; Process process = new Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.Start(); Thread.Sleep(2000); process.StandardInput.WriteLine("PDECMD -R\"" + rulename + "\" -F\"" + newpath + "\" -O\"" + outputfile); Thread.Sleep(8000); string xyz = process.StandardOutput.ReadLine(); process.StandardInput.Flush(); process.StandardInput.Close(); process.WaitForExit(); Thread.Sleep(2000); Console.WriteLine(process.StandardOutput.ReadToEnd()); string xyz1 = process.StandardOutput.ReadLine(); string outputReader = process.StandardOutput.ReadToEnd(); PTEGE.changeoperator(Prefix, AWBNo, "Automation", strWriter); driver = new ChromeDriver(); Console.WriteLine("rule created"); Thread.Sleep(2000); create c = new create(); c.createawb(outputfile, ClientName, Prefix, AWBNo, strWriter, driver); w = o; } } } } } } } } } } } catch (System.Exception ex) { Console.WriteLine(ex.Message); PTEGE.changeoperator(Prefix, AWBNo, oper, strWriter); PTEGE.UpdatePingStatus(Prefix, AWBNo, strWriter); // PTEGE.changeoperator(Prefix, AWBNo, "IntelecS", strWriter); driver.Close(); driver.Quit(); break; } #endregion } } } } } driver.Close(); driver.Quit(); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } }
public System.IAsyncResult Begincreate(create create, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("create", new object[] { create}, callback, asyncState); }
: append(create(value), @this));
? append(create(head(@this)), rhs: tail(@this).InsertAt(m - 1, value)