// ja - new way ....
        // TODO: ja - move to new class?
        private void AssignLabelTypesFromDataBase()
        {
            string ConnectionString = ConfigValues.GetConnectionString();

            SqlDataReader myReader      = null;
            SqlConnection TheConnection = null;

            try
            {
                TheConnection = new SqlConnection(ConnectionString);

                TheConnection.Open();

                // ja - get the label information from the database view
                SqlCommand myCommand = new SqlCommand("select * from label_Data where Part_Number = '" + PartNumber + "' and Part_Version = '" + PartVersion + "'", TheConnection);
                myReader = myCommand.ExecuteReader();

                // ja - loop through all of the assigned label types
                while (myReader.Read())
                {
                    // ja - get the information from the database
                    string sLocation     = myReader["Location_Name"].ToString();
                    string sType         = myReader["Label_Type_Name"].ToString();
                    string sQty          = myReader["Print_Qty"].ToString();
                    string sCustomerName = myReader["Customer_Name"].ToString();

                    LabelTypes  type = (LabelTypes)Enum.Parse(typeof(LabelTypes), sType);
                    PrinterArea area = (PrinterArea)Enum.Parse(typeof(PrinterArea), sLocation);

                    // ja - if the printer area matches the passed in area (Physical Printer) add to queue
                    if (area == ePrinterArea)
                    {
                        LabelProperitys lp = new LabelProperitys
                        {
                            CustomerName  = sCustomerName,
                            LabelQuanity  = Convert.ToInt32(sQty),
                            AssingedLabel = type
                        };

                        AssignedLabels.Add(lp);
                    }
                }

                myReader.Close();
                TheConnection.Close();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                myReader.Close();
                TheConnection.Close();
            }
        }
Beispiel #2
0
        // ja - constructor for generic PM column names
        public bool AddPrintJobForPM(PrinterArea eArea, string sWorkCode)
        {
            bool bFoundPart = false;

            WorkCodeLabel wc = new WorkCodeLabel(sWorkCode);

            string sFomattedVer = ConfigValues.ConvertIntVersion(wc.GetWorkCodeData().nVersion);

            // TODO: ja - test for no version

            AssignedLabelTypes lt;

            // ja - read from Label Codes from the Database
            if (ConfigValues.UseNewLabelCodes)
            {
                lt = new AssignedLabelTypes(eArea, wc.GetWorkCodeData().PartNumber, sFomattedVer);
            }
            else // ja - read from LabelsCode in Workcode Table
            {
                lt = new AssignedLabelTypes(wc.GetLabelsCode(), eArea, wc.GetWorkCodeData().PartNumber);
            }

            // ja - need to fill the data for all labels type to print
            foreach (var LabelProperty in lt.AssignedLabels)
            {
                DropFileData df = new DropFileData(eArea, LabelProperty.AssingedLabel);

                df.SetPrintQuanity(LabelProperty.LabelQuanity);

                df.SetCustomerName(LabelProperty.CustomerName);

                // ja - add the data to the job
                df.SetWorkCodeData(wc);

                // ja - add the column names
                df.SetColumnNames(PMLabelData.GetPMColumnHeaders());

                // ja - add the job
                DropFileDataList.Add(df);

                bFoundPart = true;
            }

            return(bFoundPart);
        }
        // TODO: ja- temp for final
        //         public LabelGen(LabelOverrides Override)
        //         {
        //             ConfigValues.ReadSettingsFromRegistry();
        //             ConfigValues.LabelOverride = Override;
        //         }

        public LabelGen(string sConfigFileName, bool bUseNew)
        {
            ConfigValues.ReadSettingsFromRegistry();
            ConfigValues.ConfigLabelName = sConfigFileName;
        }
 // TODO: ja- temp
 public LabelGen(string sTableName)
 {
     ConfigValues.ReadSettingsFromRegistry();
     ConfigValues.TableName = sTableName;
 }
 public LabelGen()
 {
     ConfigValues.ReadSettingsFromRegistry();
 }