Пример #1
0
        public string GetPrintDecorationText(PrintDecoration printDecoration)
        {
            string firstString = "[---]";

            string fieldName = printDecoration == PrintDecoration.HEADER ? "header" : "footer";
            try
            {

                string HeaderContent = HeaderFooterDataset().Tables["PrintStyle"].Select("style_name = 'normal'")[0][fieldName].ToString();
                StringTokenizer tempStringTokenizer = new StringTokenizer(HeaderContent, "\r\n");
                firstString = tempStringTokenizer.NextToken();

                while (tempStringTokenizer.HasMoreTokens())
                {
                    firstString += "\r\n" + tempStringTokenizer.NextToken();

                }
            }
            catch (Exception esx)
            {

            }

            return firstString;
        }
Пример #2
0
        public string GetPrintDecorationText(PrintDecoration printDecoration)
        {
            string firstString = "[---]";

            string fieldName = printDecoration == PrintDecoration.HEADER ? "header" : "footer";
            try
            {

                string HeaderContent = HeaderFooterDataset().Tables["PrintStyle"].Select("style_name = 'normal'")[0][fieldName].ToString();
                StringTokenizer tempStringTokenizer = new StringTokenizer(HeaderContent, "\r\n");
                firstString = tempStringTokenizer.NextToken();

                while (tempStringTokenizer.HasMoreTokens())
                {
                    firstString += "\r\n" + tempStringTokenizer.NextToken();

                }
            }
            catch (Exception esx)
            {

            }

            string[] lines = null;
            char[] param = { '\n' };
            if (firstString != null && firstString.Length > 0)
                lines = firstString.Split(param);
            int i = 0;
            char[] trimParam = { '\r' };

            string TotalHader = "";

            if (lines != null && lines.Length > 0)
                foreach (string s in lines)
                {
                    TotalHader += stringPrintFormater.CenterTextWithWhiteSpace(s.TrimEnd(trimParam)) + "\r\n";
                }
            TotalHader += "\r\n\r\n\r\n\r\n";

            return TotalHader;
        }
Пример #3
0
        public void SerialPrintHeader()
        {
            try
            {
                Debug.WriteLine("printing header");

                //Get Header From DataBase
                CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>();
                string tempConnectionString = oConstants.DBConnection;
                string sSql = SqlQueries.GetQuery(Query.GetPrintStyles);
                SqlDataAdapter tempSqlAdapter = new SqlDataAdapter(sSql, tempConnectionString);
                DataSet tempDataSet = new DataSet();
                tempSqlAdapter.Fill(tempDataSet, "PrintStyle");

                string HeaderContent = tempDataSet.Tables["PrintStyle"].Select("style_name = 'normal'")[0]["header"].ToString();
                StringTokenizer tempStringTokenizer = new StringTokenizer(HeaderContent, "\r\n");
                string firstString = tempStringTokenizer.NextToken();

                m_pSerialPort.Write(m_oCommonConstants.BoldOnCode, 0, m_oCommonConstants.BoldOnCode.Length);
               // m_pSerialPort.Write(m_oCommonConstants.PrintItalicCodeOn, 0, m_oCommonConstants.PrintItalicCodeOn.Length); //Ne at 11.06.2009
                m_pSerialPort.WriteLine(CentreAlign(firstString, 40));
                m_pSerialPort.Write(m_oCommonConstants.BoldOffCode, 0, m_oCommonConstants.BoldOffCode.Length); //Ne at 11.06.2009

               // m_pSerialPort.Write(m_oCommonConstants.PrintItalicCodeOff, 0, m_oCommonConstants.PrintItalicCodeOff.Length);

               // m_pSerialPort.Write(m_oCommonConstants.DoubleOffCode, 0, m_oCommonConstants.DoubleOffCode.Length);//New for testing

                while (tempStringTokenizer.HasMoreTokens())
                {
                    string nextString = tempStringTokenizer.NextToken();
                    m_pSerialPort.WriteLine(CentreAlign(nextString, 40));
                }

                Debug.WriteLine("header print ended");
            }
            catch (Exception eee)
            {
                Debug.WriteLine("Error in SerialPrintHeader");
                Debug.WriteLine(eee.ToString());
            }
        }
Пример #4
0
        public void SerialPrintFooter()
        {
            try
            {
                Debug.WriteLine("printing footer");

                //Get Footer From DataBase
                CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>();
                string tempConnectionString = oConstants.DBConnection;
                string sqlCommand = SqlQueries.GetQuery(Query.GetPrintStyles);
                SqlDataAdapter tempSqlAdapter = new SqlDataAdapter(sqlCommand, tempConnectionString);
                DataSet tempDataSet = new DataSet();
                tempSqlAdapter.Fill(tempDataSet, "PrintStyle");

                string HeaderContent ="\r\n\t"+ tempDataSet.Tables["PrintStyle"].Select("style_name = 'normal'")[0]["footer"].ToString();
                StringTokenizer tempStringTokenizer = new StringTokenizer(HeaderContent, "\r\n");
                string firstString = tempStringTokenizer.NextToken();

                m_pSerialPort.WriteLine(CentreAlign(firstString, 40));

                while (tempStringTokenizer.HasMoreTokens())
                {
                    string nextString = tempStringTokenizer.NextToken();
                    m_pSerialPort.WriteLine(CentreAlign(nextString, 40));
                }

                m_pSerialPort.Write("\r\n");
                Debug.WriteLine("footer print ended");
            }
            catch (Exception eee)
            {
                Debug.WriteLine("Error in SerialPrintFooter");
                Debug.WriteLine(eee.ToString());
            }
        }