Esempio n. 1
0
        private void CustomersXtraForm_Load(object sender, EventArgs e)
        {
            Cursor             = Cursors.WaitCursor;
            m_Customer         = new CustomersBLL();
            m_CustomersItems   = new ItemsBLL();
            m_Receiving        = new ReceivingsBLL();
            m_ReceivingDetails = new ReceivingDetailsBLL();
            m_Production       = new ProductionBLL();
            m_Shippings        = new ShippingsBLL();
            m_UserPermissions  = new UserPermissionsBLL();

            m_CustomersSession = new Session(MyDataLayers.SPGDataLayer);
            m_CustomersSession.TrackPropertiesModifications  = true;
            m_CustomersSession.OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException;

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_CustomersSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_CustomersSession;
                }
            }

            BindCustomerSearch();
            customerShiftsXpCollection.Criteria = new BinaryOperator(CustomerShifts.Fields.Customer, null, BinaryOperatorType.Equal);
            customerPlantsXpCollection.Criteria = new BinaryOperator(CustomerPlants.Fields.Customer, null, BinaryOperatorType.Equal);

            Utilities.MakeFormReadOnly(generalXtraTabPage, true);
            addRelatedCustomerGroupControl.Enabled          = false;
            customerPlantsGridView.OptionsBehavior.Editable = false;
            customerShiftsGridView.OptionsBehavior.Editable = false;
            deleteGridColumn.Visible = false;
            deleteCustomerPlantGridColumn.Visible = false;
            deleteCustomerShiftGridColumn.Visible = false;
            customerSearchGridControl.Enabled     = true;

            Cursor = Cursors.Default;
        }
Esempio n. 2
0
        private void ProductionXtraForm_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            m_ProductionSession = new Session(MyDataLayers.SPGDataLayer)
            {
                TrackPropertiesModifications  = true,
                OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.MergeCollisionThrowException
            };

            CheckPermissions();

            for (int i = 0; i < components.Components.Count; i++)
            {
                if ((components.Components[i]) is XPView)
                {
                    ((XPView)components.Components[i]).Session = m_ProductionSession;
                }
                else if ((components.Components[i]) is XPCollection)
                {
                    ((XPCollection)components.Components[i]).Session = m_ProductionSession;
                }
            }

            m_Items      = new ItemsBLL();
            m_Production = new ProductionBLL();
            m_Shift      = new ShiftsBLL();
            m_Machines   = new MachinesLinesBLL();
            m_Customers  = new CustomersBLL();

            LookUpColumnInfo shiftNameColumn = new LookUpColumnInfo()
            {
                Caption   = "Shift",
                FieldName = "ShiftName"
            };

            shiftLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftLookUpEdit.Properties.ValueMember   = "ShiftID";

            shiftFilterLookUpEdit.Properties.Columns.Add(shiftNameColumn);
            shiftFilterLookUpEdit.Properties.DisplayMember = "ShiftName";
            shiftFilterLookUpEdit.Properties.ValueMember   = "ShiftID";

            //Dim machineNameColumn As Controls.LookUpColumnInfo = New Controls.LookUpColumnInfo() With {.Caption = "Machine Line", .FieldName = "MachineLineName"}

            //Me.machineLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineLookUpEdit.Properties.ValueMember = "MachineLineID"

            //Me.machineFilterLookUpEdit.Properties.Columns.Add(machineNameColumn)
            //Me.machineFilterLookUpEdit.Properties.DisplayMember = "MachineLineName"
            //Me.machineFilterLookUpEdit.Properties.ValueMember = "MachineLineID"

            FillDropDowns();

            PrepareNewRecord();
            if (DateTime.Now.TimeOfDay < new TimeSpan(9, 0, 0))
            {
                productionDateEdit.DateTime = DateTime.Today.AddDays(-1);
            }
            else
            {
                productionDateEdit.DateTime = DateTime.Today;
            }

            SetDefaultViewFilter();
            FillProductionView();

            Cursor = Cursors.Default;
        }