Detect Slot Change Input then Change Equipped/UnEquipped Items
Наследование: Action
Пример #1
0
 protected void OnListChanged(T item, ChangeAction action)
 {
     if (_ListChanged != null)
     {
         _ListChanged(this, new ChangeEventArgs <T>(item, action));
     }
 }
Пример #2
0
 // <Snippet1>
 void OnValidate(ChangeAction action)
 {
     if (action == ChangeAction.Insert)
     {
         Console.WriteLine("Notify billing office.");
     }
 }
Пример #3
0
 public void OnValidate(ChangeAction action)
 {
     if (!IsValid(action))
     {
         throw new ApplicationException("User object not in a valid state.");
     }
 }
Пример #4
0
 public void Move(int id, ChangeAction action)
 {
     using (var conn = new SqlConnection(connectString))
     {
         conn.Query("usp_ProductBrand", new { type = action.ToString().ToLower(), id = id }, null, true, null, CommandType.StoredProcedure);
     }
 }
Пример #5
0
 partial void OnValidate(ChangeAction action)
 {
     if (!IsValid)
     {
         throw new ApplicationException("Rule violations prevent saving");
     }
 }
Пример #6
0
        /// <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");
                }
            }
        }
Пример #7
0
 public void ChangeAdCountByGeneral(string strID, ChangeAction action)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@strID", SqlDbType.NVarChar), new SqlParameter("@action", SqlDbType.NVarChar) };
     pt[0].Value = strID;
     pt[1].Value = action.ToString();
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeAdCountByGeneral", pt);
 }
Пример #8
0
 public void ChangeAdCount(int id, ChangeAction action)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@action", SqlDbType.NVarChar) };
     pt[0].Value = id;
     pt[1].Value = action.ToString();
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeAdCount", pt);
 }
Пример #9
0
 public void ChangeFlashPhotoOrder(ChangeAction action, int id)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@action", SqlDbType.NVarChar), new SqlParameter("@id", SqlDbType.Int) };
     pt[0].Value = action.ToString();
     pt[1].Value = id;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeFlashPhotoOrder", pt);
 }
Пример #10
0
 public void Move(int id, ChangeAction action)
 {
     using (var conn = new SqlConnection(connectString))
     {
         conn.Query("usp_ArticleClass", new { type = action.ToString().ToLower(), id = id }, commandType: CommandType.StoredProcedure);
     }
 }
Пример #11
0
        /// <summary>
        /// Starts the instance of the <see cref="kOS.Screen.ListPickerDialog"/> class.
        /// Because Monobehaviour doesn't like setting up things in the constructor, you call this
        /// after the constructor:
        /// </summary>
        /// <param name="leftX">position of upper left x coord</param>
        /// <param name="topY">position of upper left y coord</param>
        /// <param name="minWidth">force Unity to render the window at least this wide.</param>">
        /// <param name="title">Title text.</param>
        /// <param name="current">Current string value.</param>
        /// <param name="choices">Choices.</param>
        /// <param name="callWhenChanged">The dialog box will call this when a new pick has been made.</param>
        public void Summon(
            float leftX,
            float topY,
            float minWidth,
            string title,
            string subTitle,
            string current,
            IEnumerable <string> choices,
            ChangeAction callWhenChanged,
            CloseAction callWhenClosed)
        {
            this.choices         = new List <string>(choices);
            this.current         = current;
            this.title           = title;
            this.subTitle        = subTitle;
            this.callWhenChanged = callWhenChanged;
            this.callWhenClosed  = callWhenClosed;
            MakeStyles();
            outerWindowRect.x = leftX;
            outerWindowRect.y = topY;
            this.minWidth     = minWidth;
            running           = true;

            // For calculating the rectangle size, what's the biggest string we'll need to fit?
            longestString = (subTitle != null && subTitle.Length > title.Length) ? subTitle : title;
            foreach (string str in choices)
            {
                if (str.Length > longestString.Length)
                {
                    longestString = str;
                }
            }
        }
Пример #12
0
 partial void OnValidate(ChangeAction action)
 {
     if (!IsValid)
     {
         throw new ApplicationException("Violação das regras, registro não salvo.");
     }
 }
Пример #13
0
 partial void OnValidate(ChangeAction action)
 {
     if (!IsValid)
     {
         throw new ApplicationException("Zapisz niemo¿liwy - nie wszystkie warunki walidacyjne spe³nione");
     }
 }
Пример #14
0
        public static void Post(ChangeAction action, string table, string reference)
        {
            var actionStr = "Unknown";
            var eventId   = EventidInit;
            var refId     = reference;

            switch (action)
            {
            case ChangeAction.Update:
                actionStr = "Update";
                eventId   = EventidTableUpdate;
                break;

            case ChangeAction.Insert:
                actionStr = "Insert";
                eventId   = EventidTableInsert;
                refId     = "";
                break;

            case ChangeAction.Delete:
                actionStr = "Delete";
                eventId   = EventidTableDelete;
                break;
            }

            Post(eventId, actionStr, "Data", table, refId, "");
        }
Пример #15
0
 partial void OnValidate(ChangeAction action)
 {
     if (!IsValid)
     {
         throw new ApplicationException("Invalid Transaction");
     }
 }
Пример #16
0
 public void ChangeProductSendCountByOrder(int orderID, ChangeAction changeAction)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@orderID", SqlDbType.Int), new SqlParameter("@changeAction", SqlDbType.NVarChar) };
     pt[0].Value = orderID;
     pt[1].Value = changeAction;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeProductSendCountByOrder", pt);
 }
Пример #17
0
        private bool ApplyDnsChange(HostedZone zone, ResourceRecordSet recordSet, ChangeAction action)
        {
            // Prepare change as Batch
            Change changeDetails = new Change()
            {
                ResourceRecordSet = recordSet,
                Action            = action
            };

            ChangeBatch changeBatch = new ChangeBatch()
            {
                Changes = new List <Change> {
                    changeDetails
                }
            };

            // Prepare zone's resource record sets
            var recordsetRequest = new ChangeResourceRecordSetsRequest()
            {
                HostedZoneId = zone.Id,
                ChangeBatch  = changeBatch
            };

            logger.Debug($"Route53 :: ApplyDnsChange : ChangeResourceRecordSets: {recordsetRequest.ChangeBatch} ");

            var recordsetResponse = route53Client.ChangeResourceRecordSets(recordsetRequest);

            logger.Debug($"Route53 :: ApplyDnsChange : ChangeResourceRecordSets Response: {recordsetResponse} ");

            logger.Info("DNS change completed.");

            return(true);
        }
Пример #18
0
        /// <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);
        }
 public CollectionChangedEventArgs(int index, ChangeAction action, T item, T change)
 {
     Index   = index;
     Action  = action;
     Item    = item;
     Changed = change;
 }
Пример #20
0
        protected override void TrackChange(EntityEntry entityEntry, ChangeAction action)
        {
            var entity     = (T)entityEntry.Entity;
            var entityType = entity.GetType();
            var from       = action != ChangeAction.Add ?
                             JsonSerializer.Serialize(entityEntry.OriginalValues.ToObject(), JsonSerializerHelper.JsonSerializerOptions) :
                             "";
            var to = action != ChangeAction.Delete ?
                     JsonSerializer.Serialize(entityEntry.CurrentValues.ToObject(), JsonSerializerHelper.JsonSerializerOptions) :
                     "";
            var change = new EntityChange()
            {
                EntityName     = entityType.Name,
                EntityId       = entity.Id,
                Action         = action,
                From           = from,
                To             = to,
                CreationDate   = DateTime.UtcNow,
                CreationUserId = UserId,
            };

            if (action == ChangeAction.Add)
            {
                Context.Database.ExecuteSqlRaw("insert into [EntityChanges] ([EntityName], [EntityId], [Action], [From], [To], [CreationDate], [CreationUserId]) " +
                                               "values ({0}, {1}, {2}, {3}, {4}, {5}, {6})",
                                               entityType.Name, entity.Id, action, from, to, DateTime.UtcNow, UserId);
            }
            else
            {
                Context.Set <EntityChange>().Add(change);
            }
        }
 public CollectionChangedEventArgs(ChangeAction action, List <object> newItems, int newIndex, List <object> oldItems, int oldIndex)
 {
     this.Action   = action;
     this.NewItems = newItems;
     this.OldItems = oldItems;
     this.NewIndex = newIndex;
     this.OldIndex = oldIndex;
 }
Пример #22
0
partial         void OnValidate(ChangeAction action)
        {
            if (!IsValid)
            {
                RuleViolation first = GetRuleViolations().First();
                throw new RuleViolationException(first.ErrorMessage);
            }
        }
Пример #23
0
 public void ChangeProductCommentCountAndRank(int id, int rank, ChangeAction action)
 {
     SqlParameter[] pt = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int), new SqlParameter("@rank", SqlDbType.Int), new SqlParameter("@action", SqlDbType.NVarChar) };
     pt[0].Value = id;
     pt[1].Value = rank;
     pt[2].Value = action.ToString();
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeProductCommentCountAndRank", pt);
 }
Пример #24
0
 /// <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);
     }
 }
Пример #25
0
        /// <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 });
        }
 protected void RaiseComponentsChanged( ComponentModel componentModel, ChangeAction action )
 {
     var handler = ComponentsChanged;
      if ( handler != null )
      {
     handler( this, new ComponentsChangedEventArgs( componentModel, action ) );
      }
 }
Пример #27
0
        /// <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 });
        }
Пример #28
0
        /// <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 });
        }
Пример #29
0
        /// <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 });
		}
Пример #30
0
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;
            }
        }
        private static ChangeAction[] GenerateChangeActions(int count)
        {
            var entries = new ChangeAction[count];

            for (var i = 0; i < count; i++)
            {
                entries[i] = new ChangeAction(path: "Path" + i, action: "Action" + i);
            }
            return(entries);
        }
Пример #32
0
 partial void OnValidate(ChangeAction action)
 {
     if (action == ChangeAction.Insert || action == ChangeAction.Update)
     {
         if (Resource != null)
         {
             Resource.LastChange = DateTime.UtcNow;
         }
     }
 }
Пример #33
0
 public void ChangeCountByGeneral(int[] adminIds, ChangeAction action)
 {
     using (var conn = new SqlConnection(connectString))
     {
         conn.Execute(
             "SocoShop_ChangeAdminGroupCountByGeneral",
             new { strID = string.Join(",", adminIds), action = action.ToString() },
             commandType: CommandType.StoredProcedure);
     }
 }
Пример #34
0
 public void Validate(ChangeAction action)
 {
     if (action == ChangeAction.Insert)
     {
         if (Schedule.Reservations.Count(r => r.ReservationId != ReservationId && r.Passenger == this.Passenger) > 0)
         {
             throw new InvalidOperationException("Reservation for the passenger already exists");
         }
     }
 }
Пример #35
0
 partial void OnValidate(ChangeAction action)
 {
     if (action != ChangeAction.Delete)
     {
         if (!IsShortcutValid(Shortcut))
         {
             throw new ApplicationException("Invalid shortcut - can only contain numbers and letters and must be at least one character long");
         }
     }
 }
        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();
        }
Пример #37
0
        partial void OnValidate(ChangeAction action)
        {
            // Validate the URL
            if (Website != null && !Website.ToLower().StartsWith("http://"))
            {
                Website = "http://" + Website;
            }

            CentralLibrary.Post(action, "Fleet", FleetID);
        }
Пример #38
0
        /// <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);

            NotificationReady.SafeInvoke(null, new NotificationArgs(name, Common.Languages[ca, file]));
        }
Пример #39
0
        /// <summary>
        /// Shows a notification of how many items were deleted.
        /// </summary>
        /// <param name="n"># of deleted items</param>
        /// <param name="c">ChangeAction, should be ChangeAction.deleted</param>
        public static void Show(int n, ChangeAction c)
        {
            if (c != ChangeAction.deleted || !Settings.General.Notifications)
            {
                return;
            }

            string body = string.Format(Common.Languages[MessageType.ItemsDeleted], n);

            NotificationReady.SafeInvoke(null, new NotificationArgs(body));
        }
            public ChangeSet(DataGridViewRow row, ChangeAction action, int index = -2)
            {
                this.Row = (DataGridViewRow)row.Clone();
                for (int i = 0; i < row.Cells.Count; i++)
                {
                    this.Row.Cells[i].Value = row.Cells[i].Value;
                }

                this.Index  = (index == -2 ? row.Index : index);
                this.Action = action;
            }
Пример #41
0
 /// <summary>
 /// 移动数据排序
 /// </summary>
 /// <param name="action">改变动作,向上:ChangeAction.Up;向下:ChangeActon.Down</param>
 /// <param name="id">当前记录的主键值</param>
 public void ChangeLinkOrder(ChangeAction action, int id)
 {
     SqlParameter[] parameters =
     {
         new SqlParameter("@action", SqlDbType.NVarChar),
         new SqlParameter("@id",     SqlDbType.Int)
     };
     parameters[0].Value = action.ToString();
     parameters[1].Value = id;
     ShopMssqlHelper.ExecuteNonQuery(ShopMssqlHelper.TablePrefix + "ChangeLinkOrder", parameters);
 }
Пример #42
0
 /// <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");
         }
     }
 }
Пример #43
0
        /// <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)
            {
            }
        }
Пример #44
0
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("это значение уже есть в списке");
                }
            }
        }
Пример #45
0
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 +
                            "' уже существует");
                }
            }
        }
Пример #46
0
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 +
                            "' уже существует");
                }
            }
        }
Пример #47
0
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");
        }
Пример #48
0
		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));
			}
		}
Пример #49
0
        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;
        }
        /// <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);
            }
        }
Пример #51
0
        /// <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 = EntityHelper.GetUserStaffId();
            }
        }
Пример #52
0
partial         void OnValidate(ChangeAction action)
        {
            using (CmsDataContext dc = new CmsDataContext())
                {
                    try
                    {
                        if (this.ManufacturerId == null)
                            this.ManufacturerId = dc.TireBrands.SingleOrDefault(m => m.Name == this.Manufacturer).Id;
                        this.Manufacturer = dc.TireBrands.SingleOrDefault(m => m.Id == this.ManufacturerId).Name;
                    }
                    catch
                    { }
                    finally
                    {

                    }
                }
        }
Пример #53
0
        /// <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.ReportGenerationQueueOutputId);
            }

            if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
            {
                //// if (this.ReportGenerationQueueId == null)
                //// {
                ////     this.Errors.Add("The report generation queue cannot be empty");
                //// }

                this.ValidateStringNotEmpty(() => this.SharePointTargetUrl);
            }
        }
Пример #54
0
        /// <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.ReportId);
            }

            if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
            {
                if (!Enum.IsDefined(typeof(Enums.ReportType), this.ReportTypeId))
                {
                    this.Errors.Add("The Report Type is invalid.");
                }

                this.ValidateStringNotEmpty(() => this.Name);
                this.ValidateStringLength(() => this.Name, 1, 255);
            }
        }
Пример #55
0
partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert || action == ChangeAction.Update)
            {
                if (!string.IsNullOrEmpty(RgCodeSpec) && !string.IsNullOrEmpty(PartNumber))
                    throw new ValidationException("может быть задан либо 'RG код', либо 'номер'");
                if ((!string.IsNullOrEmpty(RgCodeSpec) || !string.IsNullOrEmpty(PartNumber)) &&
                    string.IsNullOrEmpty(Manufacturer))
                    throw new ValidationException("для указания 'RG кода' или 'номера' необходимо выбрать производителя");

                using (var dc = new DCFactory<StoreDataContext>())
                {
                    if (dc.DataContext.PricingMatrixEntries.SingleOrDefault(
                        e => e.SupplierID == SupplierID &&
                            e.Manufacturer == Manufacturer &&
                            e.PartNumber == PartNumber &&
                            e.RgCode == RgCodeSpec) != null)
                        throw new ValidationException("ценовые коэффициенты уже заданы для данной комбинации 'поставщик-производитель-RG-номер'");
                }
            }
        }
Пример #56
0
partial         void OnValidate(ChangeAction action)
        {
            if( action == ChangeAction.Insert || action == ChangeAction.Update )
            {
                string errorMessage = null;
                using (var dc = new DCFactory<StoreDataContext>())
                {
                    if (dc.DataContext.Users.Any(u => (u.Username == Username && u.UserID != UserID) && !string.IsNullOrEmpty(Username)))
                        errorMessage = "логин уже используется";

                    if (Role == SecurityRole.Manager)
                    {
                        if (dc.DataContext.Users.Any(u =>
                            u.AcctgID == AcctgID &&
                            u.Role == SecurityRole.Manager
                            && u.UserID != UserID ) )
                            errorMessage = "логин уже создан для данного сотрудника";
                    }
                }
                if (errorMessage != null)
                    throw new ValidationException(errorMessage);
            }
        }
partial         void OnValidate(ChangeAction action);
Пример #58
0
        private static void SendOnValidate(MetaType type, TrackedObject item, ChangeAction changeAction) {
            if (type != null) {
                SendOnValidate(type.InheritanceBase, item, changeAction);

                if (type.OnValidateMethod != null) {
                    try {
                        type.OnValidateMethod.Invoke(item.Current, new object[] { changeAction });
                    } catch (TargetInvocationException tie) {
                        if (tie.InnerException != null) {
                            throw tie.InnerException;
                        }

                        throw;
                    }
                }
            }
        }
Пример #59
0
 void StatePanel_MouseUp(object sender, MouseEventArgs e)
 {
     changingTransition = null;
     chaningTransitionAction = ChangeAction.None;
 }
Пример #60
0
 void StatePanel_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         Point clickPoint = new Point(e.X, e.Y);
         foreach (TransitionControl transition in transitions.Values)
         {
             if (around(transition.StartLocation, clickPoint))
             {
                 changingTransition = transition;
                 changingTransition.Parent = this;   // I do not know why...
                 chaningTransitionAction = ChangeAction.InitialState;
                 break;
             }
             if (around(transition.TargetLocation, clickPoint))
             {
                 changingTransition = transition;
                 changingTransition.Parent = this;   // I do not know why...
                 chaningTransitionAction = ChangeAction.TargetState;
                 break;
             }
         }
     }
 }