Exemple #1
0
        private static bool VerifyLPNSettings(Customers customer)
        {
            if (string.IsNullOrEmpty(customer.LPNPrefix))
            {
                MessageBox.Show(string.Format("There's no LPN Prefix set up for {0}.{1}You must set up all the LPN settings for {0} before generating an LPN Label.", customer.CustomerName, Environment.NewLine));
                return(false);
            }

            if (customer.FirstLPNNumber.HasValue == false || customer.LastLPNNumber.HasValue == false || customer.FirstLPNNumber.Value < 1)
            {
                MessageBox.Show(string.Format("The number range for LPN numbers is not set up for {0}.{1}You must set up all the LPN settings for {0} before generating an LPN Label.", customer.CustomerName, Environment.NewLine));
                return(false);
            }

            if (string.IsNullOrEmpty(customer.PlantCode))
            {
                MessageBox.Show(string.Format("There's no Plant Code set up for {0}.{1}You must set up all the LPN settings for {0} before generating an LPN Label.", customer.CustomerName, Environment.NewLine));
                return(false);
            }

            if (string.IsNullOrEmpty(CompanySettingsBLL.GetLPNPrinter()))
            {
                MessageBox.Show(string.Format("There's no LPN Printer set up.{0}You must set up all the LPN settings before generating an LPN Label.", Environment.NewLine));
                return(false);
            }

            return(true);
        }
Exemple #2
0
        public static bool IsDefaultLocation(Locations location)
        {
            if (CompanySettingsBLL.GetDefaultLocation() != null)
            {
                return(location.Oid == CompanySettingsBLL.GetDefaultLocation().Oid);
            }

            return(false);
        }
Exemple #3
0
        public static Locations GetUsersLocalLocation(Session session, string UserName)
        {
            Locations localLocation = GetUserByName(session, UserName).DefaultLocation;

            if (localLocation == null)
            {
                return(CompanySettingsBLL.GetDefaultLocation());
            }
            else
            {
                return(localLocation);
            }
        }
Exemple #4
0
        public static string CreateLPNLabel(Session session, Inventory inventoryRecord, bool shortLPN)
        {
            bool addMForMultiple = false;

            if (VerifyLPNSettings(inventoryRecord.InventoryItemID.ItemCustomerID))
            {
                int             LPNBaseNumber = 0;
                CompanySettings LPNSettings   = CompanySettingsBLL.GetSettings();

                if (inventoryRecord.LPNNumber.HasValue && inventoryRecord.LPNNumber.Value > 0)
                {
                    LPNBaseNumber = inventoryRecord.LPNNumber.Value;
                }
                else
                {
                    LPNBaseNumber                 = GetNextLPNNumber(inventoryRecord.InventoryItemID.ItemCustomerID);
                    inventoryRecord.LPNNumber     = LPNBaseNumber;
                    inventoryRecord.FullLPNNumber = inventoryRecord.InventoryItemID.ItemCustomerID.LPNPrefix + ("0000000000" + LPNBaseNumber.ToString()).Substring(("0000000000" + LPNBaseNumber.ToString()).Length - inventoryRecord.InventoryItemID.ItemCustomerID.LastLPNNumber.ToString().Length);
                    inventoryRecord.Save();
                }

                if (shortLPN == false && InventoryBLL.IsMultiLPN(session, LPNBaseNumber, inventoryRecord.InventoryItemID.ItemCustomerID.CustomerID, inventoryRecord.InventoryDate))
                {
                    addMForMultiple = true;
                }

                string largeCode = GetLPNLargeCode(session, inventoryRecord, addMForMultiple);
                string LPNSuffix = ("0000000000" + LPNBaseNumber.ToString()).Substring(("0000000000" + LPNBaseNumber.ToString()).Length - inventoryRecord.InventoryItemID.ItemCustomerID.LastLPNNumber.ToString().Length);
                string LPNNumber = inventoryRecord.InventoryItemID.ItemCustomerID.LPNPrefix + LPNSuffix;

                if (LPNBaseNumber == 0)
                {
                    return(string.Empty);
                }

                if (shortLPN)
                {
                    CreateShortLPNLabel(session, LPNSettings.LPNHorizontalAdjustment, LPNSettings.LPNVerticalAdjustment, inventoryRecord, LPNBaseNumber, LPNSettings.LPNPrintCopies, largeCode, LPNNumber);
                }
                else
                {
                    CreateLargeLPNLabel(session, LPNSettings.LPNHorizontalAdjustment, LPNSettings.LPNVerticalAdjustment, inventoryRecord, LPNBaseNumber, LPNSettings.LPNPrintCopies, largeCode, LPNNumber);
                }

                return(lpnTextLabel);
            }

            return(string.Empty);
        }
Exemple #5
0
        private void SettingsXtraForm_Load(System.Object sender, EventArgs e)
        {
            if (FinancialTabs == "NONE" || FinancialTabs == "EDIT ASSIGNED" || FinancialTabs == "VIEW ASSIGNED")
            {
                MessageBox.Show("You don't have permission to view this form.", "Access Denied", MessageBoxButtons.OK);
                Close();
                return;
            }

            m_Settings = new CompanySettingsBLL();
            BindSettingControls();

            customerLookUpEdit.Properties.DataSource = (new CustomersBLL()).GetCustomerNameAndIDS(false);
            customerLookUpEdit.Properties.Columns.Add(new LookUpColumnInfo());
            customerLookUpEdit.Properties.Columns[0].Caption   = "Customer Name";
            customerLookUpEdit.Properties.Columns[0].FieldName = "CustomerName";
            customerLookUpEdit.Properties.DisplayMember        = "CustomerName";
            customerLookUpEdit.Properties.ValueMember          = "CustomerID";
        }
Exemple #6
0
        public static XPView GetItemCodeAndIDsByTypesAndCustomerID(int?customerID, string types, bool universal, Session DXSession)
        {
            XPView ItemCodesXPView = new XPView(Session.DefaultSession, typeof(Items));

            ItemCodesXPView.Properties.AddRange(new ViewProperty[]
            {
                new ViewProperty("ItemID", SortDirection.None, "[ItemID]", false, true),
                new ViewProperty("ItemCode", SortDirection.Ascending, "[ItemCode]", false, true),
                new ViewProperty("ItemCustomerID", SortDirection.None, "[ItemCustomerID]", false, true),
                new ViewProperty("ItemType", SortDirection.None, "[ItemType]", false, true)
            });
            if (universal == true)
            {
                int universalCustomer = CompanySettingsBLL.GetUniversalCustomer();
                if (customerID.HasValue)
                {
                    ItemCodesXPView.Criteria = CriteriaOperator.And(CriteriaOperator.Or(new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal), new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, universalCustomer, BinaryOperatorType.Equal), new InOperator(Items.Fields.ItemCustomerID.PropertyName, CustomersBLL.GetRelatedCustomerIDs(CustomersBLL.GetCustomer(customerID.Value, DXSession)))), new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|')));
                }
                else
                {
                    ItemCodesXPView.Criteria = new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|'));
                }
            }
            else
            {
                if (customerID.HasValue)
                {
                    ItemCodesXPView.Criteria = CriteriaOperator.And(new BinaryOperator(Items.Fields.ItemCustomerID.PropertyName, customerID.Value, BinaryOperatorType.Equal), new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|')));
                }
                else
                {
                    ItemCodesXPView.Criteria = new InOperator(Items.Fields.ItemType.PropertyName, types.Split('|'));
                }
            }

            return(ItemCodesXPView);
        }