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


C# FailureAnalysisEntities.SaveChanges方法代码示例

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


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

示例1: Add

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(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.IsDeleted = false;
                    add.Name = entity.Name;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

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

示例2: AddRange

        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public SaveResult AddRange(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 = context.SaveChanges() > 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: AddRange

        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public SaveResult AddRange(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 = context.SaveChanges() > 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: DeleteBy

        /// <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_FARUpload.Single(x => x.Id == Id);

                    context.Entry<LOG_FARUpload>(assembly).State = System.Data.Entity.EntityState.Deleted;
                    result = context.SaveChanges() > 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: Add

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(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 = context.SaveChanges() > 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: AddRange

        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public SaveResult AddRange(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 = context.SaveChanges() > 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: Update

        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Update(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 = context.SaveChanges() > 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: Add

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(MSTProcessTypesDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    MST_ProcessTypes add = context.MST_ProcessTypes.Create();

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

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

示例9: DeleteBy

        /// <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 failureType = context.MST_FailureType.Single(x => x.Id == Id && x.IsDeleted == false);
                    failureType.IsDeleted = true;
                    failureType.LastUpdate = DateTime.Now;

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

示例10: Delete

        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Delete(MSTFarReportDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

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

示例11: Add

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(LOGProcessHistoryDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    LOG_ProcessHistory add = context.LOG_ProcessHistory.Create();

                    add.ProcessHisId = entity.ProcessHisId;
                    add.InsertedBy = entity.InsertedBy;
                    add.PlanTo = entity.PlanTo;
                    add.PlanFrom = entity.PlanFrom;
                    add.PlanType = (byte)entity.PlanType;
                    add.Description = entity.Description;
                    add.InsertedDate = DateTime.Now;

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

示例12: Update

        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Update(MSTFarReportDto entity)
        {
            SaveResult result = SaveResult.FAILURE;

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

                    report.OriginId = entity.OriginId;
                    report.ReportTypeId = entity.ReportTypeId;
                    report.Required = entity.Required;
                    report.Description = entity.Description;
                    report.LastUpdatedBy = entity.LastUpdatedBy;
                    report.LastUpdate = DateTime.Now;

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

示例13: AddRange

        /// <summary>
        /// Adds the range.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <returns></returns>
        public SaveResult AddRange(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 = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }
            return result;
        }
开发者ID:thientt,项目名称:FASTrack,代码行数:55,代码来源:FARMasterRepository.cs

示例14: Update

        /// <summary>
        /// Updates the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Update(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 = context.SaveChanges() > 0 ? SaveResult.SUCCESS : SaveResult.FAILURE;
                }
            }
            catch (Exception ex)
            {
                _logService.Error(ex.Message, ex);
                result = SaveResult.FAILURE;
            }

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

示例15: Add

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public SaveResult Add(FARAnalystReassignLogDto entity)
        {
            SaveResult result = SaveResult.FAILURE;
            try
            {
                using (FailureAnalysisEntities context = new FailureAnalysisEntities())
                {
                    LOG_FARAnalystReassign add = context.LOG_FARAnalystReassign.Create();

                    add.MasterId = entity.MasterId;
                    add.AnalystFrom = entity.AnalystFrom;
                    add.AnalystTo = entity.AnalystTo;
                    add.IsDeleted = entity.IsDeleted;
                    add.LastUpdatedBy = entity.LastUpdatedBy;
                    add.LastUpdate = DateTime.Now;

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


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