protected AnimationProduct CreateAnimationProduct(Division division, Animation animation, int normalMultiple, int warehouseMultiple, Signature signature) { AnimationProduct animationProduct = new AnimationProduct(); animationProduct.ID = Guid.NewGuid(); animationProduct.Animation = animation; animationProduct.ItemType = CreateItemType(division); animationProduct.ItemGroup = CreateItemGroup(division); animationProduct.Product = CreateProduct(division); animationProduct.Signature = signature; if (normalMultiple == warehouseMultiple) { Multiple multiple = CreateMultiple(animationProduct.Product, normalMultiple); animationProduct.Multiple = multiple; animationProduct.Multiple1 = multiple; } else { animationProduct.Multiple = CreateMultiple(animationProduct.Product, normalMultiple); animationProduct.Multiple1 = CreateMultiple(animationProduct.Product, warehouseMultiple); } animationProduct.OnCAS = true; animationProduct.ConfirmedMADMonth = DateTime.Now; animationProduct.StockRisk = true; animationProduct.DeliveryRisk = true; animationProduct.SortOrder = 1; return animationProduct; }
protected AnimationCustomerGroup CreateAnimationCustomerGroup(Animation animation, CustomerGroup group, Division division) { AnimationCustomerGroup animationGroup = new AnimationCustomerGroup(); animationGroup.ID = Guid.NewGuid(); animationGroup.Animation = animation; animationGroup.CustomerGroup = group; animationGroup.IncludeInAllocation = true; animationGroup.OnCounterDate = DateTime.Now; animationGroup.PLVComponentDate = DateTime.Now; animationGroup.PLVDeliveryDate = DateTime.Now; animationGroup.StockDate = DateTime.Now; animationGroup.RetailerType = CreateRetailerType(division); return animationGroup; }
protected Animation CreateAnimation(Division division, DistributionChannel channel, AnimationType animationType, Priority priority) { Animation animation = new Animation(); animation.ID = Guid.NewGuid(); animation.AnimationType = animationType; animation.Code = "01234"; animation.Name = "Animation1"; animation.DateClosed = null; animation.DateSAPOrderCreated = null; animation.SAPDespatchCode = "6454"; animation.DefaultCustomerReference = "1234"; animation.DistributionChannel = channel; animation.Priority = priority; animation.SalesDrive = CreateSalesDrive(division); animation.Status = 1; animation.RequestedDeliveryDate = DateTime.Now; animation.OnCounterDate = DateTime.Now; animation.PLVDeliveryDate = DateTime.Now; animation.PLVComponentDate = DateTime.Now; animation.StockDate = DateTime.Now; return animation; }
void ucAnimationList_EditAnimation(object sender, Animation animation) { LongTaskExecutor animationOpener = new LongTaskExecutor("Opening the animation - " + animation.Name); animationOpener.DoWork += new DoWorkEventHandler(animationOpener_DoWork); animationOpener.Run(animation); }
public void Delete(Animation entity) { if (entity.AnimationCustomerGroups != null) { Db.AnimationCustomerGroups.DeleteAllOnSubmit(entity.AnimationCustomerGroups); entity.AnimationCustomerGroups.Clear(); } if (entity.AnimationProducts != null) { Db.AnimationProducts.DeleteAllOnSubmit(entity.AnimationProducts); entity.AnimationProducts.Clear(); } Db.Animations.DeleteOnSubmit(entity); Db.SubmitChanges(); }
public void InsertOrUpdate(Animation entity) { bool isNewAnimation = false; Animation originalAnimation = null; if (entity.ID == Guid.Empty) { isNewAnimation = true; entity.IDDivision = LoggedUser.Division.ID; Db.Animations.InsertOnSubmit(entity); } else { originalAnimation = Db.Animations.GetOriginalEntityState(entity); } DbDataContext.GetInstance().CommandTimeout = Utility.RunAllocationCommandTimeOut; try { Db.SubmitChanges(); } finally { DbDataContext.GetInstance().CommandTimeout = Utility.SqlCommandTimeOut; } if (isNewAnimation == false && originalAnimation != null) { if (originalAnimation.IDPriority != entity.IDPriority || originalAnimation.IDAnimationType != entity.IDAnimationType) { DbDataContext.MakeNewInstance(); this.Animation = GetByID(entity.ID); } else { // still need to get changes from database for non-changed values and update UI Db.Refresh(RefreshMode.OverwriteCurrentValues, Animation); } } else { // still need to get changes from database for non-changed values and update UI Db.Refresh(RefreshMode.OverwriteCurrentValues, Animation); } // still need to get changes from database for non-changed values and update UI //Db.Refresh(RefreshMode.OverwriteCurrentValues, Animation); PropertyChanged(this, new PropertyChangedEventArgs("Animation")); if (isNewAnimation) { PropertyChanged(this, new PropertyChangedEventArgs("AnimationEntity")); } }