private void RadioButton_Click(object sender, RoutedEventArgs e)
 {
     if (grdCustomerGroups.View.FocusedRow != null)
     {
         SAPCustomerGroup = grdCustomerGroups.GetFocusedRow() as CustomerGroup;
     }
 }
        public MergeCustomerGroup(CustomerGroup cg)
        {
            InitializeComponent();

            dummyCustomerGroup = cg;

            txtCustomerGroupName.Text = dummyCustomerGroup.Name;
            txtCustomerGroupCode.Text = dummyCustomerGroup.Code;                      

            this.DataContext = CustomerGroupManager.Instance.GetAll().Where(c => c.Manual == false);

            cboSalesAreas.ItemsSource = SalesAreaManager.Instance.GetAll();
        }
Exemple #3
0
        protected CustomerGroupItemType CreateCustomerGroupItemType(CustomerGroup group, ItemType itemType, bool isWarehouse)
        {
            CustomerGroupItemType customerGroupItemType = new CustomerGroupItemType();
            customerGroupItemType.CustomerGroup = group;
            customerGroupItemType.ItemType = itemType;
            customerGroupItemType.WarehouseAllocation = isWarehouse;

            return customerGroupItemType;
        }
Exemple #4
0
        protected CustomerGroupAllocation CreateCustomerGroupAllocation(CustomerGroup customerGroup, AnimationProductDetail animationProductDetail)
        {
            CustomerGroupAllocation groupAllocation = new CustomerGroupAllocation();
            groupAllocation.ID = Guid.NewGuid();
            groupAllocation.CustomerGroup = customerGroup;
            groupAllocation.AnimationProductDetail = animationProductDetail;
          

            return groupAllocation;
        }
Exemple #5
0
        protected Customer CreateCustomer(CustomerGroup customerGroup, string name, string code, SalesEmployee employee, Division division)
        {
            Customer customer = new Customer();
            customer.ID = Guid.NewGuid();
            customer.SalesEmployee = employee;
            customer.CustomerGroup = customerGroup;
            customer.AccountNumber = code;
            customer.Name = name;
            customer.IncludeInSystem = true;
            customer.Manual = false;

            return customer;
        }
Exemple #6
0
        protected CustomerGroup CreateCustomerGroup(SalesArea salesArea, string name, string code)
        {
            CustomerGroup customerGroup = new CustomerGroup();
            customerGroup.ID = Guid.NewGuid();
            customerGroup.SalesArea = salesArea;
            customerGroup.Name = name;
            customerGroup.Code = code;
            customerGroup.IncludeInSystem = true;
            customerGroup.ShowRBMInReporting = true;
            customerGroup.IncludeInSAPOrders = true;
            customerGroup.Manual = false;

            return customerGroup;
        }
Exemple #7
0
        protected CustomerGroupItemType CreateCustomerGroupItemType(CustomerGroup group, ItemType itemType, Customer customer)
        {
            CustomerGroupItemType customerGroupItemType = new CustomerGroupItemType();
            customerGroupItemType.ID = Guid.NewGuid();
            customerGroupItemType.CustomerGroup = group;
            customerGroupItemType.ItemType = itemType;
            customerGroupItemType.IDCustomer = customer.ID;
            customerGroupItemType.IncludeInSAPOrders = true;
            customerGroupItemType.WarehouseAllocation = true;

            return customerGroupItemType;
        }
Exemple #8
0
        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;
        }
        private void btnMerge_Click(object sender, RoutedEventArgs e)
        {
            if (SAPCustomerGroup == null)
            {
                MessageBox.Show(SystemMessagesManager.Instance.GetMessage("MergeCustomerGroupSelectCustomerGroup"));
                return;
            }

            if (SAPCustomerGroup.AnimationCustomerGroups.Any(acg => acg.Animation != null && acg.Animation.IsActive) == true)
            {
                MessageBox.Show(SystemMessagesManager.Instance.GetMessage("MergeCustomerGroupAttachedToLiveAnimation"));
                return;
            }


            // because of (Code,SalesArea)-unique property 
            string code = SAPCustomerGroup.Code;
            SAPCustomerGroup.Code += "merged";

            CustomerGroupManager manager = CustomerGroupManager.Instance;

            try
            {
                // first, upate the SAP customer group
                manager.InsertOrUpdate(SAPCustomerGroup);

                dummyCustomerGroup.Name = SAPCustomerGroup.Name;
                dummyCustomerGroup.Code = code; 
                dummyCustomerGroup.Manual = false;

                dummyCustomerGroup.CleanEntityRef("IDSalesArea");
                dummyCustomerGroup.SalesArea = SAPCustomerGroup.SalesArea;

                dummyCustomerGroup.IncludeInSystem = SAPCustomerGroup.IncludeInSystem;
                dummyCustomerGroup.ShowRBMInReporting = SAPCustomerGroup.ShowRBMInReporting;
                dummyCustomerGroup.IncludeInSAPOrders = SAPCustomerGroup.IncludeInSAPOrders;
                dummyCustomerGroup.SortOrder = SAPCustomerGroup.SortOrder;

                // move SAP Cg's customers to dummy
                for (int i = SAPCustomerGroup.Customers.Count - 1; i>=0; i--)
                    SAPCustomerGroup.Customers[i].CustomerGroup = dummyCustomerGroup;

                // change SAP cg's CustomerGroupItemTypes to dummy
                for (int i = SAPCustomerGroup.CustomerGroupItemTypes.Count - 1; i >= 0; i-- )
                    SAPCustomerGroup.CustomerGroupItemTypes[i].CustomerGroup = dummyCustomerGroup;
                
                // insert
                manager.InsertOrUpdate(dummyCustomerGroup);

                // delete
                removedSAPCustomerGroup = SAPCustomerGroup;
                manager.Delete(SAPCustomerGroup);

                MessageBox.Show(SystemMessagesManager.Instance.GetMessage("MergeCustomerGroupMerged"), "Merge Customer Group");

                btnClose.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            }
            catch (Exception exc)
            {
                removedSAPCustomerGroup = null;
                //MessageBox.Show("An error occured when replacing the dummy store with a SAP store: " + LorealOptimiseShared.Utility.GetExceptionsMessages(exc));
                MessageBox.Show(SystemMessagesManager.Instance.GetMessage("MergeCustomerGroupException", LorealOptimiseShared.Utility.GetExceptionsMessages(exc)));

                SAPCustomerGroup.Code = code;
                manager.InsertOrUpdate(SAPCustomerGroup);
            }
        }