Example #1
0
 partial void Deletet_Picture(t_Picture instance);
Example #2
0
 partial void Updatet_Picture(t_Picture instance);
Example #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="ID_Polygon"></param>
 /// <returns></returns>
 public List<t_Picture> GetAllFlags()
 {
     try
     {
         DatabaseDataContext dataContext = new DatabaseDataContext(DB_PATH);
         List<t_Picture> Result = new List<t_Picture>();
         foreach (t_Picture p in dataContext.t_Pictures.Where(p => p.isFlag))
         {
             t_Picture tmp = new t_Picture();
             tmp.id = p.id;
             tmp.isFlag = p.isFlag;
             tmp.Name = p.Name;
             tmp.Data = new System.Data.Linq.Binary(p.Data.ToArray());
             Result.Add(tmp);
         }
         return Result;
     }
     catch (Exception ex)
     {
         LogManager.AddLog(DB_PATH, 0, "ANRLDataService.svc.cs:GetAllFlags", ex.ToString());
     }
     return null;
 }
Example #4
0
 partial void Insertt_Picture(t_Picture instance);
Example #5
0
 void of_FileOk(object sender, CancelEventArgs e)
 {
     OpenFileDialog of = sender as OpenFileDialog;
     if (of != null)
     {
         DatabaseDataContext dataContext = new DatabaseDataContext(DB_Path);
         dataContext.t_Pictures.DeleteAllOnSubmit(dataContext.t_Pictures.Where(p => p.isFlag));
         dataContext.SubmitChanges();
         foreach (String s in of.FileNames)
         {
             FileStream fs = File.OpenRead(s);
             List<Byte> lb = new List<Byte>();
             lb.Clear();
             int b;
             while ((b = fs.ReadByte()) >= 0)
             {
                 lb.Add((Byte)b);
             }
             t_Picture p = new t_Picture();
             p.isFlag = true;
             String[] Name = s.Split(new char[]{'\\'});
             p.Name = Name[Name.Length - 1].Split(new char[] {'.'})[0];
             if (p.Name.Contains("flag_"))
             {
                 p.Name = p.Name.Substring(5);
             }
             p.Data = new Binary(lb.ToArray());
             fs.Close();
             dataContext.t_Pictures.InsertOnSubmit(p);
             dataContext.SubmitChanges();
         }
         dataContext.SubmitChanges();
     }
 }