コード例 #1
0
        public override EditFormData GetData(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            EditFormData data = new EditFormData();

            data.Data = new FrameMaterialColorDTO();
            //try to get data
            try
            {
                if (id > 0)
                {
                    using (FrameMaterialColorMngEntities context = CreateContext())
                    {
                        data.Data = converter.DB2DTO_FrameMaterialColor(context.FrameMaterialColorMng_FrameMaterialColor_View.FirstOrDefault(o => o.FrameMaterialColorID == id));
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
コード例 #2
0
        public EditFormData GetEdit(int id, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            EditFormData data = new EditFormData();

            data.Data = new CushionTestReportDTO();
            data.Data.CushionTestReportFileDTOs = new List <CushionTestReportFileDTO>();
            data.Data.CushionTestStandardDTOs   = new List <CushionTestStandardDTO>();
            data.SupportCushionTestStandards    = new List <SupportCushionTestStandardDTO>();

            //OVER VIEW
            data.DataOverView = new CushionTestReportOverViewDTO();
            data.DataOverView.CushionTestReportFileOverViewDTOs = new List <CushionTestReportFileOverViewDTO>();
            data.DataOverView.CushionTestStandardOverViewDTOs   = new List <CushionTestStandardOverViewDTO>();

            try
            {
                using (CushionTestingMngEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        CushionTestingMng_CushionTestReport_View     dbItem  = context.CushionTestingMng_CushionTestReport_View.FirstOrDefault(s => s.CushionTestReportID == id);
                        CushionTestingMng_CushionTestReport_OverView dbItems = context.CushionTestingMng_CushionTestReport_OverView.FirstOrDefault(s => s.CushionTestReportID == id);
                        if (dbItem == null)
                        {
                            notification = new Notification()
                            {
                                Type = NotificationType.Error, Message = "Can not find data."
                            };
                            return(data);
                        }
                        if (dbItems == null)
                        {
                            notification = new Notification()
                            {
                                Type = NotificationType.Error, Message = "Can not find data."
                            };
                            return(data);
                        }
                        data.Data         = converter.DB2DTO_GetCushionTestReport(dbItem);
                        data.DataOverView = converter.DB2DTO_GetOverViewCushionTestReport(dbItems);
                    }
                    data.SupportCushionTestStandards = converter.DB2DTO_GetSupportCushionTestStandard(context.SupportMng_CushionTestStandard_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification = new Notification()
                {
                    Type = NotificationType.Error, Message = ex.Message
                };
                return(data);
            }
            return(data);
        }
コード例 #3
0
        public override EditFormData GetData(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            EditFormData data = new EditFormData();

            data.Data = new BackCushionDTO()
            {
                ImageFile_DisplayUrl = FrameworkSetting.Setting.ThumbnailUrl + "no-image.jpg"
            };
            data.Data.ProductGroups = new List <ProductGroupDTO>();
            data.Seasons            = new List <SeasonDTO>();

            //try to get data
            try
            {
                using (BackCushionMngEntities context = CreateContext())
                {
                    if (id == 0)
                    {
                        int index = -1;
                        foreach (ProductGroupDTO dtoGroup in GetProductGroup())
                        {
                            data.Data.ProductGroups.Add(new ProductGroupDTO()
                            {
                                BackCushionProductGroupID = index, ProductGroupID = dtoGroup.ProductGroupID, ProductGroupNM = dtoGroup.ProductGroupNM, IsEnabled = false
                            });
                            index--;
                        }
                    }
                    else if (id > 0)
                    {
                        data.Data = converter.DB2DTO_BackCushion(context.BackCushionMng_BackCushion_View.Include("BackCushionMng_BackCushionProductGroup_View").FirstOrDefault(o => o.BackCushionID == id));
                    }
                    data.Seasons = GetSeason().ToList();
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
コード例 #4
0
        public override EditFormData GetData(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };

            //try to get data
            try
            {
                using (ComplianceMngEntities context = CreateContext())
                {
                    EditFormData data = new EditFormData();
                    data.ComplianceProcessDTO          = new ComplianceProcessDTO();
                    data.FactoryDTOs                   = converter.DB2DTO_Factory(context.ComplianceMng_Factory_View.ToList());
                    data.ClientDTOs                    = converter.DB2DTO_Client(context.ComplianceMng_Client_View.ToList());
                    data.ComplianceCertificateTypeDTOs = converter.DB2DTO_ComplianceCertificateType(context.ComplianceMng_ComplianceCertificateType_View.ToList());
                    data.AuditStatusDTOs               = converter.DB2DTO_AuditStatus(context.ComplianceMng_AuditStatus_View.ToList());
                    data.EmployeeDTOs                  = converter.DB2DTO_Employee(context.ComplianceMng_Employee_View.ToList());

                    if (id > 0)
                    {
                        ComplianceMng_Compliance_View dbItem = context.ComplianceMng_Compliance_View
                                                               .Include("ComplianceMng_ComplianceAttachedFile_View")
                                                               .Include("ComplianceMng_CompliancePIC_View")
                                                               .FirstOrDefault(o => o.ComplianceProcessID == id);

                        data.ComplianceProcessDTO = converter.DB2DTO_ComplianceProcessDTO(dbItem);
                    }

                    return(data);
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
                return(new EditFormData());
            }
        }
コード例 #5
0
        public override DTO.EditFormData GetData(int id, out Library.DTO.Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            EditFormData data = new EditFormData
            {
                DefectsGroupDTO = new DefectsGroupDTO()
            };

            try
            {
                if (id > 0)
                {
                    using (var context = CreateContext())
                    {
                        var item = context.DefectsGroupMng_DefectsGroup_View.FirstOrDefault(o => o.DefectGroupID == id);
                        if (item == null)
                        {
                            notification = new Notification {
                                Type = NotificationType.Error, Message = "Can't Find Data"
                            };
                        }
                        else
                        {
                            data.DefectsGroupDTO = this.converter.DB2DTO_CheckListGroupDTO(item);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                notification = new Notification {
                    Type = NotificationType.Error, Message = ex.Message
                };
            }
            return(data);
        }