public string WriteData(List <Job> range) { using (var db = new EFBase()) { for (int i = 0; i < range.Count; i++) { Job TempJob = new Job(); TempJob.Id = range[i].Id; TempJob.Title = range[i].Title; TempJob.URL = range[i].URL; TempJob.ProposalNum = range[i].ProposalNum; TempJob.Salary = range[i].Salary; TempJob.Time = range[i].Time; TempJob.isFixedSalary = range[i].isFixedSalary; db.Jobs.Add(TempJob); } var count = db.SaveChanges(); Console.WriteLine("{0} records saved to database", count); Console.WriteLine(); Console.WriteLine("All Jobs in database:"); } return("Added to db: "); }
public ClientWindow() { InitializeComponent(); cbSenderSelect.ItemsSource = VariableClass.Senders; cbSenderSelect.DisplayMemberPath = "Key"; cbSenderSelect.SelectedValuePath = "Value"; cbSmtpSelect.ItemsSource = VariableClass.Addreses; cbSmtpSelect.DisplayMemberPath = "Key"; cbSmtpSelect.SelectedValuePath = "Value"; LoadMail(); db = new EFBase(); dgEmails.ItemsSource = db.MyEmails; }
public void peek() { using (var db = new EFBase()) { foreach (var melo in db.Jobs) { System.Console.WriteLine("Id: " + melo.Id + " \nTitle: " + melo.Title + " \nURL: " + melo.URL + " \nProposalnum: " + melo.ProposalNum + " \nSalary: " + melo.Salary + " \nTime: " + melo.Time + " \nisFixedSalary: " + melo.isFixedSalary + " \n\n " ); } } }
public List <Job> GetAllJobs() { using (var db = new EFBase()) { foreach (var melo in db.Jobs) { Job TempJob = new Job(); TempJob.Id = melo.Id; TempJob.Title = melo.Title; TempJob.URL = melo.URL; TempJob.ProposalNum = melo.ProposalNum; TempJob.Salary = melo.Salary; TempJob.Time = melo.Time; TempJob.isFixedSalary = melo.isFixedSalary; } } return(jobList); }
private void SetLabelText(EFBase.MessageProvider provider) { string messagekey = "EEPWebNetClient/WinSysMsg/txt_Login"; string content = provider[messagekey]; if (!string.IsNullOrEmpty(content)) { var tooltiplist = content.Split(';'); if (tooltiplist.Length >= 1) { (Login1.FindControl("UserNameLabel") as Label).Text = tooltiplist[0]; (Login1.FindControl("PasswordLabel") as Label).Text = tooltiplist[1]; (Login1.FindControl("DatabaseLabel") as Label).Text = tooltiplist[2]; (Login1.FindControl("SolutionLabel") as Label).Text = tooltiplist[3]; (Login1.FindControl("Remember") as CheckBox).Text = tooltiplist[4]; (Login1.FindControl("LoginButton") as Button).Text = tooltiplist[6]; (Login1.FindControl("Logout") as Button).Text = tooltiplist[7]; String loginVerify = ConfigurationManager.AppSettings["IsLoginVerify"]; String userIP = GetIP4Address(); String loginVerifyIP = ConfigurationManager.AppSettings["LoginVerifyIP"]; if (String.IsNullOrEmpty(loginVerify) || loginVerify == "false" || (!String.IsNullOrEmpty(loginVerifyIP) && userIP.StartsWith(loginVerifyIP))) { (Login1.FindControl("checkcodetr") as HtmlTableRow).Visible = false; } else { (Login1.FindControl("lbCheckCode") as Label).Text = tooltiplist[5]; String VNum = hfNValue.Value; String ONum = hfOValue.Value; ONum = VNum; VNum = MakeValidateCode(); Bitmap validateimage; Graphics g; Graphics tmpG = Graphics.FromImage(new Bitmap(1, 1)); tmpG.PageUnit = GraphicsUnit.Pixel; SizeF size = tmpG.MeasureString(VNum, new Font("Verdana", 13)); validateimage = new Bitmap((int)size.Width + 10, (int)size.Height - 4, PixelFormat.Format24bppRgb); g = Graphics.FromImage(validateimage); g.DrawString(VNum, new Font("Verdana", 13), new SolidBrush(Color.White), new PointF(8, -2)); g.FillRectangle(new LinearGradientBrush(new Point(0, 0), new Point(110, 20), Color.FromArgb(0, 0, 0, 0), Color.FromArgb(255, 255, 60, 40)), 0, 0, 120, 30); g.Save(); MemoryStream ms = new MemoryStream(); validateimage.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); String imagePath = this.Page.Request.ApplicationPath; imagePath = imagePath.Remove(imagePath.LastIndexOf('/')); String mapPath = this.Page.MapPath(imagePath); if (!Directory.Exists(mapPath + "\\InfolightTemp")) { Directory.CreateDirectory(mapPath + "\\InfolightTemp"); } else { String[] files = Directory.GetFiles(mapPath + "\\InfolightTemp"); for (int i = 0; i < files.Length; i++) { File.Delete(files[i]); } } Guid filename = new Guid(); mapPath += "\\InfolightTemp\\" + filename + ".gif"; imagePath = "~/InfolightTemp/" + filename + ".gif"; FileStream f = new FileStream(mapPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); ms.WriteTo(f); f.Close(); f.Dispose(); ms.Close(); (Login1.FindControl("Image1") as System.Web.UI.WebControls.Image).ImageUrl = imagePath; hfNValue.Value = VNum; hfOValue.Value = ONum; } } } }
public static APIBase From(EFBase item) { throw new NotImplementedException("You must override this method in the subclass"); }