Esempio n. 1
0
        public AddOperationCompleted(Models.User curUser, Models.OrderItemOperation op, Models.Part prt, RadanMaster.DAL.RadanMasterContext ctx)
        {
            InitializeComponent();
            currentUser = curUser;
            part        = prt;
            //dbContext = new RadanMaster.DAL.RadanMasterContext();
            dbContext = ctx;

            dbContext.Parts.Load();
            dbContext.Operations.Load();
            dbContext.OrderItemOperations.Load();
            dbContext.OperationPerformeds.Load();
            dbContext.OrderItemOperationPerformeds.Load();

            textEditUser.Text      = currentUser.UserName;
            textEditItemName.Text  = prt.FileName;
            textEditOperation.Text = op.operation.Name;

            List <Models.OrderItemOperation> assignableOps = new List <Models.OrderItemOperation>();

            assignableOps = dbContext.OrderItemOperations.Where(o => o.operationID == op.operationID).ToList();

            //assignableOps = dbContext.OrderItemOperations.ToList();
            gridControlAssignableOps.DataSource = null;
            gridControlAssignableOps.DataSource = assignableOps;
        }
Esempio n. 2
0
        /// <summary>
        /// returns a stream of the PDF file attached to the orderItem part
        /// </summary>
        /// <returns></returns>
        public Stream GetPDFStream()
        {
            int partIndex = OrderItemOp.operation.Part.ID;

            Models.Part prt = Globals.dbContext.Parts.FirstOrDefault(p => p.ID == partIndex);
            if (prt.Files.Count > 0)
            {
                int         fileIndex = prt.Files.FirstOrDefault().FileId;
                Models.File file      = Globals.dbContext.Files.FirstOrDefault(f => f.FileId == fileIndex);
                Stream      stream    = new MemoryStream(file.Content);
                return(stream);
            }
            return(null);
        }