Ejemplo n.º 1
0
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<FARUploadDto> SingleAsync(int id)
 {
     FARUploadDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.LOG_FARUpload
                             where item.Id == id
                             select new FARUploadDto()
                             {
                                 Id = item.Id,
                                 MasterId = item.MasterId,
                                 FAType = item.FAType,
                                 FileName = item.FileName,
                                 ReasonId = item.ReasonId,
                                 UploadedDate = item.UploadedDate,
                                 UploadedBy = item.UploadedBy
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<MSTServiceDto> SingleAsync(int id)
 {
     MSTServiceDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.MST_Services
                             where item.IsDeleted == false && item.Id == id
                             select new MSTServiceDto()
                             {
                                 Id = item.Id,
                                 Name = item.Name,
                                 Description = item.Description,
                                 IsDeleted = item.IsDeleted,
                                 LastUpdatedBy = item.LastUpdatedBy,
                                 LastUpdate = item.LastUpdate,
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public FARAnalystReassignLogDto Single(int id)
 {
     FARAnalystReassignLogDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.LOG_FARAnalystReassign
                       where item.IsDeleted == false && item.Id == id
                       select new FARAnalystReassignLogDto()
                       {
                           Id = item.Id,
                           MasterId = item.MasterId,
                           AnalystFrom = item.AnalystFrom,
                           AnalystTo = item.AnalystTo,
                           UpdatedDate = item.UpdatedDate,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public FARMechanismDto Single(int id)
 {
     FARMechanismDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.FAR_Mechanism
                       where item.IsDeleted == false && item.Id == id
                       select new FARMechanismDto()
                       {
                           Id = item.Id,
                           Name = item.Name,
                           Description = item.Description,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public SitesDto Single(int id)
 {
     SitesDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.MST_Sites
                       where item.IsDeleted == false && item.Id == id
                       select new SitesDto()
                       {
                           Id = item.Id,
                           Name = item.Name,
                           Address1 = item.Address1,
                           Address2 = item.Address2,
                           Phone = item.Phone,
                           Description = item.Description,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
     }
     return result;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public MSTProcessTypesDto Single(int id)
 {
     MSTProcessTypesDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.MST_ProcessTypes
                       where item.IsDeleted == false && item.Id == id
                       select new MSTProcessTypesDto()
                       {
                           Id = item.Id,
                           Name = item.Name,
                           Description = item.Description,
                           Duration = item.Duration,
                           SeqNumber = item.SeqNumber,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Finds the asynchronous.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task<FARPriorityLogDto> SingleAsync(int id)
        {
            FARPriorityLogDto result = null;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    result = await (from item in context.LOG_FARPriority
                                    where item.IsDeleted == false && item.Id == id
                                    select new FARPriorityLogDto()
                                    {
                                        Id = item.Id,
                                        MasterId = item.MasterId,
                                        PriorityIdNew = item.PriorityNew,
                                        PriorityIdOld = item.PriorityOld,
                                        PriorityNew = new MSTPriorityDto { Name = item.MST_Priority1.Name },
                                        PriorityOld = new MSTPriorityDto { Name = item.MST_Priority.Name },
                                        ReasonId = item.ReasonId,
                                        Reason = new DelayReasonDto { Description = item.MST_Reason.Description },
                                        IsDeleted = item.IsDeleted,
                                        LastUpdatedBy = item.LastUpdatedBy,
                                        LastUpdate = item.LastUpdate,


                                    }).SingleAsync();
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = null;
            }
            return result;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<MSTFarReportDto> SingleAsync(int id)
 {
     MSTFarReportDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.MST_FARReport
                             where item.IsDeleted == false && item.Id == id
                             select new MSTFarReportDto()
                             {
                                 Id = item.Id,
                                 ReportTypeId = item.ReportTypeId,
                                 OriginId = item.OriginId,
                                 Required = item.Required,
                                 ReportType = new ReportTypesDto { Id = item.MST_ReportTypes.Id, Name = item.MST_ReportTypes.Name, Description = item.MST_ReportTypes.Description },
                                 Origin = new MSTOriginDto { Id = item.MST_Origin.Id, Name = item.MST_Origin.Name, Description = item.MST_Origin.Description },
                                 Description = item.Description,
                                 LastUpdatedBy = item.LastUpdatedBy,
                                 LastUpdate = item.LastUpdate,
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         result = null;
         _logService.Error(ex.Message, ex);
     }
     return result;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<MSTCustomerDto> SingleAsync(int id)
 {
     MSTCustomerDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.MST_Customer
                             where item.IsDeleted == false && item.Id == id
                             select new MSTCustomerDto()
                             {
                                 Id = item.Id,
                                 CustomerName = item.CustomerName,
                                 EndCustomer = item.EndCustomer,
                                 Location = item.Location,
                                 Strategic = item.Strategic,
                                 IsDeleted = item.IsDeleted,
                                 LastUpdatedBy = item.LastUpdatedBy,
                                 LastUpdate = item.LastUpdate,
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public DelayReasonDto Single(int id)
 {
     DelayReasonDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.MST_ReasonINIReport
                       where item.IsDeleted == false && item.Id == id
                       select new DelayReasonDto()
                       {
                           Id = item.Id,
                           Description = item.Description,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public LOGHistoryDto Single(int id)
 {
     LOGHistoryDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.LOG_FARHistory
                       where item.IsDeleted == false && item.Id == id
                       select new LOGHistoryDto()
                       {
                           Id = item.Id,
                           MasterId = item.MasterId,
                           StatusId = item.StatusId,
                           ReasonId = item.ReasonId,
                           LogDate = item.LogDate,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<FARInitialTargetLogDto> SingleAsync(int id)
 {
     FARInitialTargetLogDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.LOG_FARInitialTarget
                             where item.IsDeleted == false && item.Id == id
                             select new FARInitialTargetLogDto()
                             {
                                 Id = item.Id,
                                 MasterId = item.MasterId,
                                 ReasonId = item.ReasonId,
                                 TargetDate = item.TargetDate,
                                 IsDeleted = item.IsDeleted,
                                 LastUpdatedBy = item.LastUpdatedBy,
                                 LastUpdate = item.LastUpdate,
                                 
                                
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Finds the asynchronous.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public async Task<RecordLockDto> SingleAsync(int id)
 {
     RecordLockDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.FAR_RecordLock
                             where item.IsDeleted == false && item.Id == id
                             select new RecordLockDto()
                             {
                                 Id = item.Id,
                                 ProcessHistoryId = item.ProcessHistoryId,
                                 LockBy = item.LockBy,
                                 LockDate = item.LockDate,
                                 MasterId = item.MasterId,
                                 ReleaseDate = item.ReleaseDate,
                                 LastUpdatedBy = item.LastUpdatedBy,
                                 LastUpdate = item.LastUpdate,
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         result = null;
         _logService.Error(ex.Message, ex);
     }
     return result;
 }
Ejemplo n.º 14
0
 public async Task<FARCancelLogDto> SingleAsync(int id)
 {
     FARCancelLogDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = await (from item in context.LOG_FARCancel
                             where item.IsDeleted == false && item.Id == id
                             select new FARCancelLogDto()
                             {
                                 Id = item.Id,
                                 MasterId = item.MasterId,
                                 StatusId = item.StatusId,
                                 ReasonId = item.ReasonId,
                                 CancelledDate = item.CancelledDate,
                                 IsDeleted = item.IsDeleted,
                                 InsertedBy = item.InsertedBy,
                                 InsertedOn = item.InsertedOn,
                                 UpdatedBy = item.UpdatedBy,
                                 UpdatedOn = item.UpdatedOn,
                             }).SingleAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public FARDeviceDetailsDto Single(int id)
 {
     FARDeviceDetailsDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.FAR_DeviceDetails
                       where item.IsDeleted == false && item.Id == id
                       select new FARDeviceDetailsDto()
                       {
                           Id = item.Id,
                           MasterId = item.MasterId,
                           Master = new FARMasterDto()
                           {
                               Id = item.FAR_Master.Id,
                               Number = item.FAR_Master.Number,
                               Analyst = item.FAR_Master.Analyst,
                               Requestor = item.FAR_Master.Requestor,
                               RefNo = item.FAR_Master.RefNo,
                               StatusId = item.FAR_Master.StatusId,
                               Product = item.FAR_Master.Product,
                               Customer = item.FAR_Master.Customer,
                               FailureRate = item.FAR_Master.FailureRate,
                               RequestDate = item.FAR_Master.RequestDate,
                               FailureDesc = item.FAR_Master.FailureDesc,
                           },
                           WaferNo = item.WaferNo,
                           SerialNo = item.SerialNo,
                           LotNo = item.LotNo,
                           MfgPartNo = item.MfgPartNo,
                           TechnologyId = item.TechnologyId,
                           Technogoly = new MSTTechnogolyDto() { Id = item.MST_Technology.Id, Name = item.MST_Technology.Name, Description = item.MST_Technology.Description, },
                           PackageTypeId = item.PackageTypeId,
                           PackageType = new MSTPackageTypesDto() { Id = item.MST_PackageTypes.Id, Name = item.MST_PackageTypes.Name, Description = item.MST_PackageTypes.Description, },
                           AssemblySiteId = item.AssembliesSiteId,
                           AssemblySites = new MSTAssemblySiteDto() { Id = item.MST_AssemblySites.Id, Name = item.MST_AssemblySites.Code, Description = item.MST_AssemblySites.Description, },
                           FabSiteId = item.FabSiteId,
                           FabSite = new FabSiteDto() { Id = item.FabSites.Id, Name = item.FabSites.Name, Description = item.FabSites.Description, },
                           ServiceId = item.ServiceId,
                           FARServices = new MSTServiceDto() { Id = item.MST_Services.Id, Name = item.MST_Services.Name, Description = item.MST_Services.Description },
                           DateCode = item.DateCode,
                           Quantity = item.Quantity,
                           Stage = item.Stage,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public FARMasterDto Single(int id)
 {
     FARMasterDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.FAR_Master
                       where item.IsDeleted == false && item.Id == id
                       select new FARMasterDto()
                       {
                           Id = item.Id,
                           Number = item.Number,
                           OriginId = item.OriginId,
                           FAROrigin = new MSTOriginDto() { Id = item.MST_Origin.Id, Name = item.MST_Origin.Name, Description = item.MST_Origin.Description },
                           Requestor = item.Requestor,
                           RefNo = item.RefNo,
                           FailureTypeId = item.FailureTypeId,
                           FARFailureType = new MSTFailureTypeDto() { Id = item.MST_FailureType.Id, Name = item.MST_FailureType.Name, Description = item.MST_FailureType.Description },
                           FailureOriginId = item.FailureOriginId,
                           FARFailureOrigin = new MSTFailureOriginDto() { Id = item.MST_FailureOrigin.Id, Name = item.MST_FailureOrigin.Name, Description = item.MST_FailureOrigin.Description },
                           FailureRate = item.FailureRate,
                           StatusId = item.StatusId,
                           FARStatus = new MSTStatusDto() { Id = item.MST_Status.Id, Name = item.MST_Status.Name, Description = item.MST_Status.Description },
                           Analyst = item.Analyst,
                           RequestDate = item.RequestDate,
                           SamplesArriveDate = item.SamplesArriveDate,
                           PriorityId = item.PriorityId,
                           FARPriority = new MSTPriorityDto() { Id = item.MST_Priority.Id, Name = item.MST_Priority.Name, Description = item.MST_Priority.Description },
                           InitialReportTargetDate = item.InitialReportTargetDate,
                           BUId = item.BUId,
                           Bu = new MSTBuDto() { Id = item.MST_BU.Id, Name = item.MST_BU.Name, Description = item.MST_BU.Description },
                           Product = item.Product,
                           FailureDesc = item.FailureDesc,
                           FinalReportTargetDate = item.FinalReportTargetDate,
                           Submitted = item.Submitted,
                           Customer = item.Customer,
                           LabSiteId = item.LabSiteId,
                           LabSite = new MSTLabSiteDto { Id = item.MST_LabSite.Id, Name = item.MST_LabSite.Name, Description = item.MST_LabSite.Description },
                           RatingId = item.RatingId,
                           Rating = new MSTRatingDto { Id = item.MST_Rating != null ? item.MST_Rating.Id : 0, Name = item.MST_Rating != null ? item.MST_Rating.Name : "", Description = item.MST_Rating != null ? item.MST_Rating.Description : "" },
                           Comments = item.Comments,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         return null;
     }
     return result;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public LOGProcessHistoryDto Single(int id)
 {
     LOGProcessHistoryDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.LOG_ProcessHistory
                       where item.Id == id
                       select new LOGProcessHistoryDto()
                       {
                           Id = item.Id,
                           ProcessHisId = item.ProcessHisId,
                           FARProcessHistory = new FARProcessHistoryDto()
                           {
                               Id = item.FAR_ProcessHistory.Id,
                               Analystor = item.FAR_ProcessHistory.Analystor,
                               Comment = item.FAR_ProcessHistory.Comment,
                               DateIn = item.FAR_ProcessHistory.DateIn,
                               DateOut = item.FAR_ProcessHistory.DateOut,
                               Description = item.FAR_ProcessHistory.Description,
                               PlannedIn = item.FAR_ProcessHistory.PlannedIN,
                               PlannedOut = item.FAR_ProcessHistory.PlannedOUT,
                               SeqNum = item.FAR_ProcessHistory.SeqNum,
                           },
                           InsertedBy = item.InsertedBy,
                           InsertedDate = item.InsertedDate,
                           PlanFrom = item.PlanFrom,
                           PlanTo = item.PlanTo,
                           PlanType = (PlanType)item.PlanType,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public MSTProcessProductDto Single(int id)
 {
     MSTProcessProductDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.MST_ProcessProduct
                       where item.IsDeleted == false && item.Id == id
                       select new MSTProcessProductDto()
                       {
                           Id = item.Id,
                           InChargePerson = item.InChargePerson,
                           ProcessTypeId = item.ProcessTypeId,
                           ProcessType = new MSTProcessTypesDto
                           {
                               Name = item.MST_ProcessTypes.Name,
                               Description = item.MST_ProcessTypes.Description,
                           },
                           ProductId = item.ProductId,
                           Product = new MSTProductDto
                           {
                               Name = item.MST_Product.Name,
                               Description = item.MST_Product.Description,
                           },
                           Description = item.Description,
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Finds the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public MSTProductDto Single(int id)
 {
     MSTProductDto result = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             result = (from item in context.MST_Product
                       where item.IsDeleted == false && item.Id == id
                       select new MSTProductDto()
                       {
                           Id = item.Id,
                           Name = item.Name,
                           Description = item.Description,
                           MainPerson = item.MainPerson,
                           SecondaryPerson = item.SecondaryPerson,
                           TertiaryPerson = item.TertiaryPerson,
                           LabSiteId = item.LabSiteId,
                           LabSite = new MSTLabSiteDto
                           {
                               Id = item.MST_LabSite.Id,
                               Name = item.MST_LabSite.Name
                           },
                           IsDeleted = item.IsDeleted,
                           LastUpdatedBy = item.LastUpdatedBy,
                           LastUpdate = item.LastUpdate,
                       }).Single();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         result = null;
     }
     return result;
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Delete(DelayReasonDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var assembly = context.MST_ReasonINIReport.Single(x => x.Id == entity.Id && x.IsDeleted == false);
                    assembly.IsDeleted = true;

                    context.Entry<MST_ReasonINIReport>(assembly).State = System.Data.Entity.EntityState.Modified;
                    result = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return result;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Deletes the by asynchronous.
        /// </summary>
        /// <param name="Id">The identifier.</param>
        /// <returns></returns>
        public async Task<SaveResult> DeleteByAsync(int Id)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var assembly = context.MST_Services.Single(x => x.Id == Id && x.IsDeleted == false);
                    assembly.IsDeleted = true;

                    context.Entry<MST_Services>(assembly).State = System.Data.Entity.EntityState.Modified;
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return result;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Adds the range asynchronous.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public async Task<SaveResult> AddRangeAsync(IEnumerable<MSTServiceDto> entities)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_Services add = null;
                    foreach (var entity in entities)
                    {
                        add = context.MST_Services.Create();

                        add.Description = entity.Description;
                        add.IsDeleted = false;
                        add.Name = entity.Name;
                        add.LastUpdatedBy = entity.LastUpdatedBy;
                        add.LastUpdate = DateTime.Now;

                        context.Entry<MST_Services>(add).State = System.Data.Entity.EntityState.Added;
                    }
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(MSTServiceDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_Services add = context.MST_Services.Create();

                    add.Description = entity.Description;
                    add.IsDeleted = false;
                    add.Name = entity.Name;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

                    context.Entry<MST_Services>(add).State = System.Data.Entity.EntityState.Added;
                    result = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(MSTServiceDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var service = context.MST_Services.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    service.Name = entity.Name;
                    service.IsDeleted = entity.IsDeleted;
                    service.Description = entity.Description;
                    service.LastUpdatedBy = entity.LastUpdatedBy;
                    service.LastUpdate = DateTime.Now;

                    context.Entry<MST_Services>(service).State = System.Data.Entity.EntityState.Modified;
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return result;
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Gets all asynchronous.
 /// </summary>
 /// <returns></returns>
 public async Task<IEnumerable<MSTServiceDto>> GetAllAsync()
 {
     IEnumerable<MSTServiceDto> results = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             results = await (from item in context.MST_Services
                              where item.IsDeleted == false
                              select new MSTServiceDto()
                              {
                                  Id = item.Id,
                                  Name = item.Name,
                                  Description = item.Description,
                                  IsDeleted = item.IsDeleted,
                                  LastUpdatedBy = item.LastUpdatedBy,
                                  LastUpdate = item.LastUpdate,
                              }).ToListAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         return null;
     }
     return results;
 }
        /// <summary>
        /// Deletes the by.
        /// </summary>
        /// <param name="Id">The identifier.</param>
        /// <returns></returns>
        public SaveResult DeleteBy(int Id)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var assembly = context.LOG_FARInitialTarget.Single(x => x.Id == Id && x.IsDeleted == false);
                    assembly.IsDeleted = true;

                    context.Entry<LOG_FARInitialTarget>(assembly).State = System.Data.Entity.EntityState.Modified;
                    result = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return result;
        }
        /// <summary>
        /// Adds the range asynchronous.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public async Task<SaveResult> AddRangeAsync(IEnumerable<FARInitialTargetLogDto> entities)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    LOG_FARInitialTarget add = null;
                    foreach (var entity in entities)
                    {
                        add = context.LOG_FARInitialTarget.Create();

                        add.TargetDate = entity.TargetDate;
                        add.ReasonId = entity.ReasonId;
                        add.IsDeleted = false;
                        add.MasterId = entity.MasterId;
                        add.LastUpdatedBy = entity.LastUpdatedBy;
                        add.LastUpdate = DateTime.Now;

                        context.Entry<LOG_FARInitialTarget>(add).State = System.Data.Entity.EntityState.Added;
                    }
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(FARInitialTargetLogDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    LOG_FARInitialTarget add = context.LOG_FARInitialTarget.Create();

                    add.TargetDate = entity.TargetDate;
                    add.ReasonId = entity.ReasonId;
                    add.IsDeleted = false;
                    add.MasterId = entity.MasterId;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

                    context.Entry<LOG_FARInitialTarget>(add).State = System.Data.Entity.EntityState.Added;
                    result = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(FARInitialTargetLogDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var log = context.LOG_FARInitialTarget.Single(x => x.Id == entity.Id && x.IsDeleted == false);

                    log.MasterId = entity.MasterId;
                    log.ReasonId = entity.ReasonId;
                    log.IsDeleted = entity.IsDeleted;
                    log.TargetDate = entity.TargetDate;
                    log.LastUpdatedBy = entity.LastUpdatedBy;
                    log.LastUpdate = DateTime.Now;

                    context.Entry<LOG_FARInitialTarget>(log).State = System.Data.Entity.EntityState.Modified;
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

            return result;
        }
 /// <summary>
 /// Gets all asynchronous.
 /// </summary>
 /// <returns></returns>
 public async Task<IEnumerable<FARInitialTargetLogDto>> GetAllAsync()
 {
     IEnumerable<FARInitialTargetLogDto> results = null;
     try
     {
         using (FailureAnalysisEntities context = new FailureAnalysisEntities())
         {
             results = await (from item in context.LOG_FARInitialTarget
                              where item.IsDeleted == false
                              select new FARInitialTargetLogDto()
                              {
                                  Id = item.Id,
                                  MasterId = item.MasterId,
                                  ReasonId = item.ReasonId,
                                  TargetDate = item.TargetDate,
                                  IsDeleted = item.IsDeleted,
                                  LastUpdatedBy = item.LastUpdatedBy,
                                  LastUpdate = item.LastUpdate,
                                  
                                 
                              }).ToListAsync();
         }
     }
     catch (Exception ex)
     {
         _logService.Error(ex.Message, ex);
         return null;
     }
     return results;
 }