public override IQuery GetHsql(Object data) { StringBuilder sql = new StringBuilder("select a from ImageEntityRelation a where "); ImageEntityRelation imgRel = (ImageEntityRelation)data; if (imgRel != null) { Parms = new List <Object[]>(); if (!string.IsNullOrEmpty(imgRel.ImageName)) { sql.Append(" a.ImageName = :id and "); Parms.Add(new Object[] { "id", imgRel.ImageName }); } if (imgRel.Entity != null && imgRel.Entity.ClassEntityID != 0) { sql.Append(" a.Entity.ClassEntityID = :id1 and "); Parms.Add(new Object[] { "id1", imgRel.Entity.ClassEntityID }); } if (imgRel.EntityRowID != 0) { sql.Append(" a.EntityRowID = :id2 and "); Parms.Add(new Object[] { "id2", imgRel.EntityRowID }); } } sql = new StringBuilder(sql.ToString()); sql.Append(" 1=1 order by a.RowID asc "); IQuery query = Factory.Session.CreateQuery(sql.ToString()); SetParameters(query); return(query); }
public IList <ImageEntityRelation> Select(ImageEntityRelation data) { IList <ImageEntityRelation> datos = new List <ImageEntityRelation>(); datos = GetHsql(data).List <ImageEntityRelation>(); if (!Factory.IsTransactional) { Factory.Commit(); } return(datos); }
//public static void ShowPopUpShell(RegionNames regionName, object view, string viewName, bool clear) //{ // PopUpShell popUp = new PopUpShell(); // popUp.ShowViewInShell(regionName, view, viewName, clear); // popUp.ShowDialog(); //} internal static void ShowFile(ImageEntityRelation file) { string urlDocument = Util.GetFilePath(file); if (string.IsNullOrEmpty(urlDocument)) { return; } ViewDocumentBrowser fv = new ViewDocumentBrowser(urlDocument); fv.Show(); }
internal static string GetFilePath(ImageEntityRelation file) { //try //{ String File = Guid.NewGuid() + "_" + file.ImageName; File = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), WmsSetupValues.PrintReportDir + "\\" + File); //Save File to Disk Before Print. //file. FileStream oFileStream = new FileStream(File, FileMode.Create); oFileStream.Write(file.Image, 0, file.Image.Length); oFileStream.Close(); return(File); //} //catch { return ""; } }
public ImageEntityRelation SelectById(ImageEntityRelation data) { return((ImageEntityRelation)base.SelectById(data)); }
public Boolean Delete(ImageEntityRelation data) { return(base.Delete(data)); }
public Boolean Update(ImageEntityRelation data) { return(base.Update(data)); }
public ImageEntityRelation Save(ImageEntityRelation data) { return((ImageEntityRelation)base.Save(data)); }
public void UpdateImageEntityRelation(ImageEntityRelation data) { try { SetService(); SerClient.UpdateImageEntityRelation(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
public IList<ImageEntityRelation> GetImageEntityRelation(ImageEntityRelation data) { try { SetService(); return SerClient.GetImageEntityRelation(data); } finally { SerClient.Close(); if (SerClient.State == CommunicationState.Faulted) SerClient.Abort(); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (upFile.StreamFile == null || cboFtype.SelectedItem == null || cboProcess.SelectedItem == null) { Util.ShowError("File, File Type and Process are required."); return; } //Crear los registros en IMageEntityRelation y en PRocessEntityResource. ClassEntity curEntity = App.ClassEntityList.Where(f => f.ClassEntityID == this.ClassEntity).FirstOrDefault(); try { //File to Save ImageEntityRelation file = new ImageEntityRelation { FileType = (Connection)cboFtype.SelectedItem, ImageName = Util.ExtractFileName(upFile.FileName), Image = Util.GetImageByte(upFile.StreamFile), CreatedBy = App.curUser.UserName, CreationDate = DateTime.Now, Entity = curEntity, EntityRowID = this.RowID }; file = service.SaveImageEntityRelation(file); //Process Entity Resourse to Save ProcessEntityResource per = new ProcessEntityResource { CreatedBy = App.curUser.UserName, CreationDate = DateTime.Now, Entity = curEntity, EntityRowID = this.RowID, File = file, Process = (CustomProcess)cboProcess.SelectedItem, Printer = (Connection)cboPrinter.SelectedItem, Status = App.EntityStatusList.Where(f => f.StatusID == EntityStatus.Active).First() }; //Salvando el proceso service.SaveProcessEntityResource(per); //Obtreniendo la nueva lista LoadExistingList(); cboFtype.SelectedIndex = -1; cboProcess.SelectedIndex = -1; upFile.txtLogo.Text = ""; upFile.StreamFile = null; Util.ShowMessage("Record Created."); } catch (Exception ex) { Util.ShowError("Problem creating record.\n" + ex.Message); upFile.txtLogo.Text = ""; upFile.StreamFile = null; return; } }
internal static string GetFilePath(ImageEntityRelation file) { //try //{ String File = Guid.NewGuid() + "_" + file.ImageName; File = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), WmsSetupValues.PrintReportDir + "\\" + File); //Save File to Disk Before Print. //file. FileStream oFileStream = new FileStream(File, FileMode.Create); oFileStream.Write(file.Image, 0, file.Image.Length); oFileStream.Close(); return File; //} //catch { return ""; } }
//public static void ShowPopUpShell(RegionNames regionName, object view, string viewName, bool clear) //{ // PopUpShell popUp = new PopUpShell(); // popUp.ShowViewInShell(regionName, view, viewName, clear); // popUp.ShowDialog(); //} internal static void ShowFile(ImageEntityRelation file) { string urlDocument = Util.GetFilePath(file); if (string.IsNullOrEmpty(urlDocument)) return; ViewDocumentBrowser fv = new ViewDocumentBrowser(urlDocument); fv.Show(); }