Beispiel #1
0
        private void GridDetails_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ProcessWindow pw = new ProcessWindow("Displaying File ...");

            try
            {
                //Para el selected Item despliega el archivo.
                if (GridDetails.SelectedItem == null)
                {
                    return;
                }

                ProcessEntityResource per = GridDetails.SelectedItem as ProcessEntityResource;
                if (per.Template != null)
                {
                    UtilWindow.ShowDocument(per.Template, per.EntityRowID, "", false);
                }

                else if (per.File != null)
                {
                    UtilWindow.ShowFile(per.File);
                }
            }
            catch (Exception ex) { Util.ShowError("Fiel could not be displayed.\n" + ex.Message); }
            finally { pw.Close(); }
        }
        public static PrintFileFactory getFactory(ProcessEntityResource resource)
        {
            switch (resource.File.FileType.Name)
            {
            case SFileType.PDF:
                return(new PDF(resource));

            default:
                return(null);
            }
        }
        public IList <ProcessEntityResource> Select(ProcessEntityResource data)
        {
            IList <ProcessEntityResource> datos = new List <ProcessEntityResource>();

            datos = GetHsql(data).List <ProcessEntityResource>();

            if (!Factory.IsTransactional)
            {
                Factory.Commit();
            }

            return(datos);
        }
Beispiel #4
0
 public PDF(ProcessEntityResource resource)
 {
     Resource = resource;
 }
        public override IQuery GetHsql(Object data)
        {
            StringBuilder         sql = new StringBuilder("select a from ProcessEntityResource a    where  ");
            ProcessEntityResource ProcessEntityResource = (ProcessEntityResource)data;

            if (ProcessEntityResource != null)
            {
                Parms = new List <Object[]>();
                if (ProcessEntityResource.RowID != 0)
                {
                    sql.Append(" a.RowID = :id     and   ");
                    Parms.Add(new Object[] { "id", ProcessEntityResource.RowID });
                }

                if (ProcessEntityResource.Entity != null && ProcessEntityResource.Entity.ClassEntityID != 0)
                {
                    sql.Append(" a.Entity.ClassEntityID = :ix2     and   ");
                    Parms.Add(new Object[] { "ix2", ProcessEntityResource.Entity.ClassEntityID });
                }


                if (ProcessEntityResource.Process != null && ProcessEntityResource.Process.ProcessID != 0)
                {
                    sql.Append(" a.Process.ProcessID = :ip2     and   ");
                    Parms.Add(new Object[] { "ip2", ProcessEntityResource.Process.ProcessID });
                }



                if (ProcessEntityResource.Status != null && ProcessEntityResource.Status.StatusID != 0)
                {
                    sql.Append(" a.Status.StatusID = :id2     and   ");
                    Parms.Add(new Object[] { "id2", ProcessEntityResource.Status.StatusID });
                }


                if (ProcessEntityResource.EntityRowID != 0)
                {
                    sql.Append(" a.EntityRowID = :id11     and   ");
                    Parms.Add(new Object[] { "id11", ProcessEntityResource.EntityRowID });
                }


                if (ProcessEntityResource.Template != null && ProcessEntityResource.Template.RowID != 0)
                {
                    sql.Append(" a.Template.RowID  = :idx2     and   ");
                    Parms.Add(new Object[] { "idx2", ProcessEntityResource.Template.RowID });
                }


                if (ProcessEntityResource.File != null && ProcessEntityResource.File.RowID != 0)
                {
                    sql.Append(" a.File.RowID  = :idf2     and   ");
                    Parms.Add(new Object[] { "idf2", ProcessEntityResource.File.RowID });
                }


                //if (ProcessEntityResource.ResourceType != 0)
                //{
                //    sql.Append(" a.ResourceType = :id12     and   ");
                //    Parms.Add(new Object[] { "id12", ProcessEntityResource.ResourceType });
                //}



                //if (ProcessEntityResource.ResourceID != 0)
                //{
                //    sql.Append(" a.ResourceID = :id13     and   ");
                //    Parms.Add(new Object[] { "id13", ProcessEntityResource.ResourceID });
                //}
            }
            sql = new StringBuilder(sql.ToString());
            sql.Append(" 1=1 ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());

            SetParameters(query);
            return(query);
        }
 public ProcessEntityResource SelectById(ProcessEntityResource data)
 {
     return((ProcessEntityResource)base.SelectById(data));
 }
 public Boolean Delete(ProcessEntityResource data)
 {
     return(base.Delete(data));
 }
 public Boolean Update(ProcessEntityResource data)
 {
     return(base.Update(data));
 }
 public ProcessEntityResource Save(ProcessEntityResource data)
 {
     return((ProcessEntityResource)base.Save(data));
 }
Beispiel #10
0
 public void UpdateProcessEntityResource(ProcessEntityResource data)
 {
     try
     {
         SetService(); SerClient.UpdateProcessEntityResource(data);
     }
     finally
     {
         SerClient.Close();
         if (SerClient.State == CommunicationState.Faulted)
             SerClient.Abort();
     }
 }
Beispiel #11
0
 public IList<ProcessEntityResource> GetProcessEntityResource(ProcessEntityResource data)
 {
     try
     {
         SetService(); return SerClient.GetProcessEntityResource(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;
            }
        }