当前位置: 首页>>代码示例>>C#>>正文


C# FailureAnalysisEntities.SaveChangesAsync方法代码示例

本文整理汇总了C#中FASTrack.Model.Entities.FailureAnalysisEntities.SaveChangesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# FailureAnalysisEntities.SaveChangesAsync方法的具体用法?C# FailureAnalysisEntities.SaveChangesAsync怎么用?C# FailureAnalysisEntities.SaveChangesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FASTrack.Model.Entities.FailureAnalysisEntities的用法示例。


在下文中一共展示了FailureAnalysisEntities.SaveChangesAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateAsync

        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(MSTCustomerDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

                    cus.CustomerName = entity.CustomerName;
                    cus.EndCustomer = entity.EndCustomer;
                    cus.Location = entity.Location;
                    cus.Strategic = entity.Strategic;
                    cus.IsDeleted = entity.IsDeleted;
                    cus.LastUpdatedBy = entity.LastUpdatedBy;
                    cus.LastUpdate = DateTime.Now;

                    context.Entry<MST_Customer>(cus).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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:35,代码来源:MSTCustomerRepository.cs

示例2: AddRangeAsync

        /// <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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:36,代码来源:FARInitialTargetLogRepository.cs

示例3: AddRangeAsync

        /// <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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:35,代码来源:MSTServiceRepository.cs

示例4: DeleteAsync

        /// <summary>
        /// Deletes the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> DeleteAsync(FARUploadDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var assembly = context.LOG_FARUpload.Single(x => x.Id == entity.Id);

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

            return result;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:27,代码来源:FARUploadRepository.cs

示例5: AddAsync

        /// <summary>
        /// Adds the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> AddAsync(DelayReasonDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_ReasonINIReport add = context.MST_ReasonINIReport.Create();

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

                    context.Entry<MST_ReasonINIReport>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:30,代码来源:MSTReasonINIRepository.cs

示例6: AddRangeAsync

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

                        add.ProcessHistoryId = entity.ProcessHistoryId;
                        add.LockBy = entity.LockBy;
                        add.LockDate = entity.LockDate;
                        add.MasterId = entity.MasterId;
                        add.ReleaseDate = entity.ReleaseDate;
                        add.LastUpdatedBy = entity.LastUpdatedBy;
                        add.LastUpdate = DateTime.Now;

                        context.Entry<FAR_RecordLock>(add).State = System.Data.Entity.EntityState.Added;
                    }
                    result = await context.SaveChangesAsync() > 0 ? SaveResult.SUCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:36,代码来源:FARRecordLockRepository.cs

示例7: UpdateAsync

        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(FARUploadDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var upload = context.LOG_FARUpload.Single(x => x.Id == entity.Id);

                    upload.FileName = entity.FileName;
                    upload.MasterId = entity.MasterId;
                    upload.ReasonId = entity.ReasonId;
                    upload.FAType = entity.FAType;
                    upload.UploadedBy = entity.UploadedBy;
                    upload.UploadedDate = DateTime.Now;

                    context.Entry<LOG_FARUpload>(upload).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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:34,代码来源:FARUploadRepository.cs

示例8: AddRangeAsync

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

                        add.Number = entity.Number;
                        add.OriginId = entity.OriginId;
                        add.Requestor = entity.Requestor;
                        add.RefNo = entity.RefNo;
                        add.FailureTypeId = entity.FailureTypeId;
                        add.FailureOriginId = entity.FailureOriginId;
                        add.FailureRate = entity.FailureRate;
                        add.StatusId = entity.StatusId;
                        add.Analyst = entity.Analyst;
                        add.RequestDate = entity.RequestDate;
                        add.SamplesArriveDate = entity.SamplesArriveDate;
                        add.PriorityId = entity.PriorityId;
                        add.InitialReportTargetDate = entity.InitialReportTargetDate;
                        add.BUId = entity.BUId;
                        add.Product = entity.Product;
                        add.FailureDesc = entity.FailureDesc;
                        add.FinalReportTargetDate = entity.FinalReportTargetDate;
                        add.Submitted = entity.Submitted;
                        add.Customer = entity.Customer;
                        add.LabSiteId = entity.LabSiteId;
                        add.RatingId = entity.RatingId;
                        add.Comments = entity.Comments;
                        add.IsDeleted = entity.IsDeleted;
                        add.LastUpdatedBy = entity.LastUpdatedBy;
                        add.LastUpdate = DateTime.Now;

                        context.Entry<FAR_Master>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:55,代码来源:FARMasterRepository.cs

示例9: AddRangeAsync

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

                        add.OriginId = entity.OriginId;
                        add.ReportTypeId = entity.ReportTypeId;
                        add.Required = entity.Required;
                        add.Description = entity.Description;
                        add.LastUpdatedBy = entity.LastUpdatedBy;
                        add.LastUpdate = DateTime.Now;
                        context.Entry<MST_FARReport>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:34,代码来源:MSTFarReportRepository.cs

示例10: UpdateAsync

        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(LOGHistoryDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

                    assembly.Id = entity.Id;
                    assembly.MasterId = entity.MasterId;
                    assembly.StatusId = entity.StatusId;
                    assembly.ReasonId = entity.ReasonId;
                    assembly.LogDate = entity.LogDate;
                    assembly.IsDeleted = entity.IsDeleted;
                    assembly.ReasonId = entity.ReasonId;
                    assembly.LastUpdatedBy = entity.LastUpdatedBy;
                    assembly.LastUpdate = DateTime.Now;

                    context.Entry<LOG_FARHistory>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:37,代码来源:FARHistoryRepository.cs

示例11: UpdateAsync

        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(FARMasterDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

                    entry.Number = entity.Number;
                    entry.OriginId = entity.OriginId;
                    entry.Requestor = entity.Requestor;
                    entry.RefNo = entity.RefNo;
                    entry.FailureTypeId = entity.FailureTypeId;
                    entry.FailureOriginId = entity.FailureOriginId;
                    entry.FailureRate = entity.FailureRate;
                    entry.StatusId = entity.StatusId;
                    entry.Analyst = entity.Analyst;
                    entry.RequestDate = entity.RequestDate;
                    entry.SamplesArriveDate = entity.SamplesArriveDate;
                    entry.PriorityId = entity.PriorityId;
                    entry.InitialReportTargetDate = entity.InitialReportTargetDate;
                    entry.BUId = entity.BUId;
                    entry.Product = entity.Product;
                    entry.FailureDesc = entity.FailureDesc;
                    entry.FinalReportTargetDate = entity.FinalReportTargetDate;
                    entry.Submitted = entity.Submitted;
                    entry.Customer = entity.Customer;
                    entry.LabSiteId = entity.LabSiteId;
                    entry.RatingId = entity.RatingId;
                    entry.Comments = entity.Comments;
                    entry.IsDeleted = entity.IsDeleted;
                    entry.LastUpdatedBy = entity.LastUpdatedBy;
                    entry.LastUpdate = DateTime.Now;

                    context.Entry<FAR_Master>(entry).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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:53,代码来源:FARMasterRepository.cs

示例12: AddAsync

        /// <summary>
        /// Adds the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> AddAsync(MSTProductDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_Product add = context.MST_Product.Create();

                    add.Description = entity.Description;
                    add.MainPerson = entity.MainPerson;
                    add.SecondaryPerson = entity.SecondaryPerson;
                    add.TertiaryPerson = entity.TertiaryPerson;
                    add.LabSiteId = entity.LabSiteId;
                    add.Name = entity.Name;
                    add.IsDeleted = false;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

                    context.Entry<MST_Product>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:35,代码来源:MSTProductRepository.cs

示例13: UpdateAsync

        /// <summary>
        /// Updates the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> UpdateAsync(MSTProductDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

                    product.Name = entity.Name;
                    product.MainPerson = entity.MainPerson;
                    product.SecondaryPerson = entity.SecondaryPerson;
                    product.TertiaryPerson = entity.TertiaryPerson;
                    product.LabSiteId = entity.LabSiteId;
                    product.IsDeleted = entity.IsDeleted;
                    product.Description = entity.Description;
                    product.LastUpdatedBy = entity.LastUpdatedBy;
                    product.LastUpdate = DateTime.Now;

                    context.Entry<MST_Product>(product).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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:37,代码来源:MSTProductRepository.cs

示例14: AddAsync

        /// <summary>
        /// Adds the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> AddAsync(MSTCustomerDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_Customer add = context.MST_Customer.Create();

                    add.CustomerName = entity.CustomerName;
                    add.EndCustomer = entity.EndCustomer;
                    add.Location = entity.Location;
                    add.Strategic = entity.Strategic;
                    add.IsDeleted = entity.IsDeleted;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

                    context.Entry<MST_Customer>(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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:33,代码来源:MSTCustomerRepository.cs

示例15: DeleteAsync

        /// <summary>
        /// Deletes the asynchronous.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task<SaveResult> DeleteAsync(FARAnalystReassignLogDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    var reassign = context.LOG_FARAnalystReassign.Single(x => x.Id == entity.Id && x.IsDeleted == false);
                    reassign.IsDeleted = true;
                    reassign.LastUpdate = DateTime.Now;
                    reassign.LastUpdatedBy = entity.LastUpdatedBy;

                    context.Entry<LOG_FARAnalystReassign>(reassign).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;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:30,代码来源:FARAnalystReassignLogRepository.cs


注:本文中的FASTrack.Model.Entities.FailureAnalysisEntities.SaveChangesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。