• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ChangeAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ChangeAction的典型用法代码示例。如果您正苦于以下问题:C# ChangeAction类的具体用法?C# ChangeAction怎么用?C# ChangeAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChangeAction类属于命名空间,在下文中一共展示了ChangeAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddToQueue

        /// <summary>
        /// Creates the SyncQueueItem from the given data and adds it to the sync queue
        /// </summary>
        private void AddToQueue(FileSystemEventArgs e, ChangeAction action)
        {
            var isFile = Common.PathIsFile(e.FullPath);
            // ignore directory changes
            if (!isFile && action == ChangeAction.changed) return;

            var queueItem = new SyncQueueItem(controller)
                {
                    Item = new ClientItem
                        {
                            Name = e.Name,
                            FullPath = e.FullPath,
                            Type = isFile ? ClientItemType.File : ClientItemType.Folder,
                            Size = (isFile && action != ChangeAction.deleted) ? new FileInfo(e.FullPath).Length : 0x0,
                            LastWriteTime = File.GetLastWriteTime(e.FullPath)
                        },
                    SyncTo = SyncTo.Remote,
                    ActionType = action
                };

            if (action == ChangeAction.renamed)
            {
                var args = e as RenamedEventArgs;
                queueItem.Item.FullPath = args.OldFullPath;
                queueItem.Item.NewFullPath = args.FullPath;
            }
            // Send to the sync queue
            controller.SyncQueue.Add(queueItem);
        }
开发者ID:BroneKot,项目名称:FTPbox,代码行数:32,代码来源:FolderWatcher.cs


示例2: Validate

        /// <summary>
        /// Validates this instance.
        /// </summary>
        /// <param name="dao">The DAO for additional data validation.</param>
        /// <param name="changeAction">The change action.</param>
        internal override void Validate(GenericDao dao, ChangeAction changeAction)
        {
            // Perform custom validation
            if (changeAction == ChangeAction.Update)
            {
                this.ValidateGreaterThanZero(() => this.ReportGenerationQueueId);
            }

            if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
            {
                //// If (Enum.IsDefined(typeof(Enums.ReportStatus), this.ReportGenerationStatus))
                ////{
                ////    this.Errors.Add("The report generation status is invalid");
                ////}

                Regex periodRegex = new Regex(@"^\d{6,6}$");

                if (!periodRegex.IsMatch(this.Period.ToString()))
                {
                    this.Errors.Add("The report period is not a valid period");
                }

                Regex quarterNameRegex = new Regex("^Q[0-3]$");

                if (this.ReforecastQuarterName == null)
                {
                    this.Errors.Add("The reforecast quarter cannot be empty");
                }
                else if (!quarterNameRegex.IsMatch(this.ReforecastQuarterName))
                {
                    this.Errors.Add("The reforecast quarter is not a valid period");
                }
            }
        }
开发者ID:rsdgjb,项目名称:GRP,代码行数:39,代码来源:ReportGenerationQueue.cs


示例3: Show

        /// <summary>
        /// Shows a notification regarding an action on one file OR folder
        /// </summary>
        /// <param name="name">The name of the file or folder</param>
        /// <param name="ca">The ChangeAction</param>
        /// <param name="file">True if file, False if Folder</param>
        public static void Show(string name, ChangeAction ca, bool file)
        {
            if (!Settings.General.Notifications) return;

            name = Common._name(name);

            InvokeNotificationReady(null, new NotificationArgs { Title = Common.Languages[ca, file], Text = name });
        }
开发者ID:pstagner,项目名称:FTPbox,代码行数:14,代码来源:Notifications.cs


示例4: RaiseComponentsChanged

 protected void RaiseComponentsChanged( ComponentModel componentModel, ChangeAction action )
 {
     var handler = ComponentsChanged;
      if ( handler != null )
      {
     handler( this, new ComponentsChangedEventArgs( componentModel, action ) );
      }
 }
开发者ID:FINESCE,项目名称:ComponentCompositionFramework,代码行数:8,代码来源:ComponentComposerBase.cs


示例5: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (!IsValid)
            {
                RuleViolation first = GetRuleViolations().First();
                throw new RuleViolationException(first.ErrorMessage);
            }
        }
开发者ID:robperson,项目名称:AssessTrack,代码行数:8,代码来源:File.cs


示例6: Validate

 /// <summary>
 /// Validates this instance.
 /// </summary>
 /// <param name="dao">The DAO for additional data validation.</param>
 /// <param name="changeAction">The change action.</param>
 internal override void Validate(GenericDao dao, ChangeAction changeAction)
 {
     // Perform custom validation
     if (changeAction == ChangeAction.Update)
     {
         this.ValidateGreaterThanZero(() => this.ReportParameterActivityTypeId);
     }
 }
开发者ID:rsdgjb,项目名称:GRP,代码行数:13,代码来源:ReportParameterActivityType.cs


示例7: Show

        /// <summary>
        /// Shows a notification that a file or folder was renamed.
        /// </summary>
        /// <param name="name">The old name of the file/folder</param>
        /// <param name="ca">file/folder ChangeAction, should be ChangeAction.renamed</param>
        /// /// <param name="newname">The new name of the file/folder</param>
		public static void Show(string name, ChangeAction ca, string newname)
		{					
			if (!Settings.General.Notifications) return;

            name = Common._name(name);
            newname = Common._name(newname);
            string body = string.Format(Common.Languages[ChangeAction.renamed, true], name, newname);
            NotificationReady.SafeInvoke(null, new NotificationArgs { Text = body });
		}
开发者ID:bakern,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs


示例8: Show

        /// <summary>
        /// Shows a notification that a file or folder was renamed.
        /// </summary>
        /// <param name="name">The old name of the file/folder</param>
        /// <param name="ca">file/folder ChangeAction, should be ChangeAction.renamed</param>
        /// /// <param name="newname">The new name of the file/folder</param>
        public static void Show(string name, ChangeAction ca, string newname)
        {
            if (!Settings.settingsGeneral.Notifications) return;

            name = Common._name(name);
            newname = Common._name(newname);
            string body = string.Format(Get_Message(ChangeAction.renamed, true), name, newname);
            InvokeNotificationReady(null, new NotificationArgs { Text = body });
        }
开发者ID:jiangguang5201314,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs


示例9: Show

        /// <summary>
        /// Shows a notification regarding an action on one file OR folder
        /// </summary>
        /// <param name="name">The name of the file or folder</param>
        /// <param name="ca">The ChangeAction</param>
        /// <param name="file">True if file, False if Folder</param>
        public static void Show(string name, ChangeAction ca, bool file)
        {
            if (!Settings.settingsGeneral.Notifications) return;

            name = Common._name(name);
            string body = string.Format(Get_Message(ca, file), name);

            NotificationReady(null, new NotificationArgs { Text = body });
        }
开发者ID:nelsont,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs


示例10: ChangesetPath

        public ChangesetPath(ChangeAction action, string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentOutOfRangeException("path", path, "Path cannot be null or empty.");
            }

            _action = action;
            _path = path.Trim();
        }
开发者ID:davidsidlinger,项目名称:ccnet-hg-nosuck,代码行数:10,代码来源:ChangesetPath.cs


示例11: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            using (CmsDataContext dc = new CmsDataContext())
            {
                if (this.ManufaturerId == null)
                    this.ManufaturerId = dc.DiscBrands.SingleOrDefault(m => m.Name == this.Manufacturer).Id;
                if (this.ManufaturerId != null)
                    this.Manufacturer = dc.DiscBrands.SingleOrDefault(m => m.Id == this.ManufaturerId).Name;
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:10,代码来源:Disc.cs


示例12: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (var dc = new TecdocStoreDataContext())
                {
                    if (dc.NameCorrections.SingleOrDefault(
                         m => m.OriginalName == OriginalName) != null)
                        throw new ValidationException("это значение уже есть в списке");
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:12,代码来源:NameCorrection.cs


示例13: Validate

        /// <summary>
        /// Validates this instance.
        /// </summary>
        /// <param name="dao">The DAO for additional data validation.</param>
        /// <param name="changeAction">The change action.</param>
        internal override void Validate(GenericDao dao, ChangeAction changeAction)
        {
            // Perform custom validation
            if (changeAction == ChangeAction.Update)
            {
                this.ValidateGreaterThanZero(() => this.ReportGenerationBatchId);
            }

            if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
            {
            }
        }
开发者ID:rsdgjb,项目名称:GRP,代码行数:17,代码来源:ReportGenerationBatch.cs


示例14: Validate

 /// <summary>
 /// Validates this instance.
 /// </summary>
 /// <param name="dao">The DAO for additional data validation.</param>
 /// <param name="changeAction">The change action.</param>
 internal override void Validate(GenericDao dao, ChangeAction changeAction)
 {
     // Perform custom validation
     if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
     {
         Regex currencyRegex = new Regex("^[A-Z]{3}$");
         if (!currencyRegex.IsMatch(this.CurrencyCode))
         {
             this.Errors.Add("The currency code is invalid");
         }
     }
 }
开发者ID:rsdgjb,项目名称:GRP,代码行数:17,代码来源:ReportParameterCurrency.cs


示例15: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (CmsDataContext dc = new CmsDataContext())
                {
                    if (dc.Brands.SingleOrDefault(
                        m => m.Name == Name && m.VehicleType == VehicleType ) != null )
                        throw new ValidationException("марка с названием '" +
                            Name +
                            "' уже существует");
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:14,代码来源:Brand.cs


示例16: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (CmsDataContext dc = new CmsDataContext())
                {
                    if (dc.Manufacturers.SingleOrDefault(
                        m => m.Name == Name) != null)
                        throw new ValidationException("производитель с названием '" +
                            Name +
                            "' уже существует");
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:14,代码来源:Manufacturer.cs


示例17: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (var dc = new TecdocStoreDataContext())
                {
                    if (dc.CountryVisibilities.SingleOrDefault(
                         c => c.CountryID == CountryID) != null)
                        throw new ValidationException("эта страна уже есть в списке видимых");
                }
            }
            if (HttpContext.Current.Cache["visibleCountries"] != null)
                HttpContext.Current.Cache.Remove("visibleCountries");
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:14,代码来源:CountryVisibility.cs


示例18: OnValidate

		partial void OnValidate(ChangeAction action)
		{
			if (action == ChangeAction.Update || action == ChangeAction.Insert) {
				if (ModelProgress < 0) ModelProgress = 0;
				if (ModelProgress > 100) ModelProgress = 100;

				if (TextureProgress < 0) TextureProgress = 0;
				if (TextureProgress > 100) TextureProgress = 100;

				if (ScriptProgress < 0) ScriptProgress = 0;
				if (ScriptProgress > 100) ScriptProgress = 100;


				OverallProgress = (int) (40*(ModelProgress/100.0) + 40*(TextureProgress/100.0) + 20*(ScriptProgress/100.0));
			}
		}
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:16,代码来源:Model.cs


示例19: Committing

        /// <summary>
        /// Method is called before entity is persisted to the datastore.
        /// </summary>
        /// <param name="action">The action.</param>
        internal override void Committing(ChangeAction action)
        {
            DateTime auditDate = DateTime.Now;

            // If EntityState is New, then Set the Inserted audit information
            if (EntityState == EntityState.New)
            {
                this._InsertedDate = auditDate;
            }

            // Set the Update audit information
            if (EntityState != EntityState.Deleted)
            {
                this._UpdatedDate = auditDate;
                this._UpdatedByStaffId = Convert.ToInt32(BusinessUser.Current.UserKey);
            }
        }
开发者ID:rsdgjb,项目名称:GRP_PERFICIENT,代码行数:21,代码来源:ReportParameterShowMRISourceForPayroll.cs


示例20: GetBusinessRuleViolations

        public IList<BusinessRuleViolation> GetBusinessRuleViolations(ChangeAction action)
        {
            var violations = new List<BusinessRuleViolation>();

            if (Login.IsNullOrEmpty())
                violations.Add(new BusinessRuleViolation("Login name is required.", "Login"));

            if ((action == ChangeAction.Insert) || (action == ChangeAction.Update))
            {
                if (Current.DB.Query<int>("select 1 from Users where Login = @Login and Id <> @Id", new { Login, Id }).Any())
                {
                    violations.Add(new BusinessRuleViolation("Login name must be unique.", "Login"));
                }
            }

            return violations;
        }
开发者ID:jddcef,项目名称:StackExchange.DataExplorer,代码行数:17,代码来源:User.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ChangePasswordModel类代码示例发布时间:2022-05-24
下一篇:
C# ChampionTitleInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap