Thursday, 5 July 2012

Make XML file and get Value from XML Document


/****************** Make XML file  *********************************/


private void GetVat15XMLFile()
        {
            objDALVAT15 = new DALVAT15();
            var dicVat15Detail = objDALVAT15.GetVat15AllDetails(Common.Common.globalPartyTIN, 1, globalReturnedType);
            if (dicVat15Detail.Count > 0)
            {
                List<BLLVAT15> lstMainVat15Detail = dicVat15Detail[0];
                List<BLLVAT15> lstSubVat15Detail = dicVat15Detail[1];
                string fileName = "VAT15_File_" + Common.Common.globalPartyTIN + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString();
                string filePath = System.IO.Directory.GetParent(System.Windows.Forms.Application.ExecutablePath).Parent.Parent.FullName;
                filePath = filePath + "\\XML Files\\" + fileName + ".xml";
                XmlTextWriter xWriter = new XmlTextWriter(filePath, Encoding.UTF8);
                xWriter.WriteStartDocument();
                xWriter.WriteStartElement("VAT15Form");

                xWriter.WriteStartElement("CommonDetails");
                xWriter.WriteElementString("PartyTIN", Common.Common.globalPartyTIN);
                xWriter.WriteElementString("PartyName", globalPartyName);
                xWriter.WriteElementString("PartyAddress", globalPartyAddress);
                xWriter.WriteElementString("MonthID", DateTime.Now.Month.ToString());
                xWriter.WriteElementString("QuarterID", globalReturnedType.ToString());
                xWriter.WriteElementString("YearID", DateTime.Now.Year.ToString());
                xWriter.WriteEndElement();

                xWriter.WriteStartElement("VAT15Details");
                xWriter.WriteStartElement("Root");
                xWriter.WriteElementString("Vat15ID", lstMainVat15Detail[0].Vat15ID.ToString());
                xWriter.WriteElementString("SalesA", lstMainVat15Detail[0].SalesA.ToString("#.##"));
                xWriter.WriteElementString("SalesB", lstMainVat15Detail[0].SalesB.ToString("#.##"));
                xWriter.WriteElementString("SalesC", lstMainVat15Detail[0].SalesC.ToString("#.##"));
                xWriter.WriteElementString("SalesD", lstMainVat15Detail[0].SalesD.ToString("#.##"));
                xWriter.WriteElementString("SalesE", lstMainVat15Detail[0].SalesE.ToString("#.##"));
                xWriter.WriteElementString("SalesF", lstMainVat15Detail[0].SalesF.ToString("#.##"));
                xWriter.WriteElementString("SalesG", lstMainVat15Detail[0].SalesG.ToString("#.##"));
                xWriter.WriteElementString("SalesH", lstMainVat15Detail[0].SalesH.ToString("#.##"));
                xWriter.WriteElementString("PurchaseA", lstMainVat15Detail[0].PurchaseA.ToString("#.##"));
                xWriter.WriteElementString("PurchaseB", lstMainVat15Detail[0].PurchaseB.ToString("#.##"));
                xWriter.WriteElementString("PurchaseC", lstMainVat15Detail[0].PurchaseC.ToString("#.##"));
                xWriter.WriteElementString("PurchaseD", lstMainVat15Detail[0].PurchaseD.ToString("#.##"));
                xWriter.WriteElementString("PurchaseE", lstMainVat15Detail[0].PurchaseE.ToString("#.##"));
                xWriter.WriteElementString("PurchaseF", lstMainVat15Detail[0].PurchaseF.ToString("#.##"));
                xWriter.WriteElementString("PurchaseG", lstMainVat15Detail[0].PurchaseG.ToString("#.##"));
                xWriter.WriteElementString("PurchaseH", lstMainVat15Detail[0].PurchaseH.ToString("#.##"));
                xWriter.WriteElementString("PurchaseI", lstMainVat15Detail[0].PurchaseI.ToString("#.##"));
                xWriter.WriteElementString("OutputTaxA", lstMainVat15Detail[0].OutputTaxA.ToString("#.##"));
                xWriter.WriteElementString("OutputTaxB", lstMainVat15Detail[0].OutputTaxB.ToString("#.##"));
                xWriter.WriteElementString("OutputTaxC", lstMainVat15Detail[0].OutputTaxC.ToString("#.##"));
                xWriter.WriteElementString("OutputTaxD", lstMainVat15Detail[0].OutputTaxD.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisA", lstMainVat15Detail[0].ITConActBasisA.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisB", lstMainVat15Detail[0].ITConActBasisB.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisC", lstMainVat15Detail[0].ITConActBasisC.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisD", lstMainVat15Detail[0].ITConActBasisD.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisE", lstMainVat15Detail[0].ITConActBasisE.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisF", lstMainVat15Detail[0].ITConActBasisF.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisG", lstMainVat15Detail[0].ITConActBasisG.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisH", lstMainVat15Detail[0].ITConActBasisH.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisI", lstMainVat15Detail[0].ITConActBasisI.ToString("#.##"));
                xWriter.WriteElementString("ITConActBasisJ", lstMainVat15Detail[0].ITConActBasisJ.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisA", lstMainVat15Detail[0].ITConNatBasisA.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisB", lstMainVat15Detail[0].ITConNatBasisB.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisC", lstMainVat15Detail[0].ITConNatBasisC.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisD", lstMainVat15Detail[0].ITConNatBasisD.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisE", lstMainVat15Detail[0].ITConNatBasisE.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisF", lstMainVat15Detail[0].ITConNatBasisF.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisG", lstMainVat15Detail[0].ITConNatBasisG.ToString("#.##"));
                xWriter.WriteElementString("ITConNatBasisH", lstMainVat15Detail[0].ITConNatBasisH.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCA", lstMainVat15Detail[0].ExcessITCA.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCB", lstMainVat15Detail[0].ExcessITCB.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCC", lstMainVat15Detail[0].ExcessITCC.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCD", lstMainVat15Detail[0].ExcessITCD.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCE", lstMainVat15Detail[0].ExcessITCE.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCF", lstMainVat15Detail[0].ExcessITCF.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCG", lstMainVat15Detail[0].ExcessITCG.ToString("#.##"));
                xWriter.WriteElementString("ExcessITCH", lstMainVat15Detail[0].ExcessITCH.ToString("#.##"));

                xWriter.WriteEndElement();
                xWriter.WriteEndElement();

                xWriter.WriteStartElement("ChallanDetails");
                if (lstSubVat15Detail.Count > 0)
                {
                    for (int r = 0; r <= lstSubVat15Detail.Count - 1; r++)
                    {
                        xWriter.WriteStartElement("Root");
                        xWriter.WriteElementString("Vat15ID", lstSubVat15Detail[r].Vat15ID.ToString());
                        xWriter.WriteElementString("ChallanID", lstSubVat15Detail[r].ChallanID.ToString());
                        xWriter.WriteElementString("PaymentType", lstSubVat15Detail[r].PaymentType.ToString());
                        xWriter.WriteElementString("ChallanNo", lstSubVat15Detail[r].ChallanNo.ToString());
                        xWriter.WriteElementString("ChallanDate", lstSubVat15Detail[r].ChallanDate.ToString("MMddyy"));
                        xWriter.WriteElementString("BankTreasury", lstSubVat15Detail[r].BankTreasury.ToString());
                        xWriter.WriteElementString("BranchCode", lstSubVat15Detail[r].BranchCode.ToString());
                        xWriter.WriteElementString("ChallanAmount", lstSubVat15Detail[r].ChallanAmount.ToString("#.##"));
                        xWriter.WriteEndElement();
                    }
                }
                xWriter.WriteEndElement();
                xWriter.WriteEndElement();
                xWriter.WriteEndDocument();
                xWriter.Close();

                lstXmlName.Add(filePath);

            }
        }



/******************Get Data From XML *********************************/

 string appPath = HttpRuntime.AppDomainAppPath + "UploadedXMLFiles\\" + fileName;
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(appPath);


 using (var stringWriter = new StringWriter())
            using (var xmlTextWriter = XmlWriter.Create(stringWriter))
            {
                xmlDoc.WriteTo(xmlTextWriter);
                xmlTextWriter.Flush();
                XMLFile = stringWriter.GetStringBuilder().ToString();
            }
            string[] arrformName = fileName.Split('_');
            string formName = string.Empty;
            if (arrformName.Length > 0)
            {
                formName = arrformName[0].ToString();
                string selectNode = "/" + formName + "Form";
                if (formName.ToLower() == "vat15worksheetfile")
                    selectNode = "/Vat15WorksheetForm";
 GlobalDataForRFS(xmlDoc, selectNode);
}




 private void GlobalDataForRFS(XmlDocument xdXml, string selectNode)
    {
        XmlNodeList xnNodes = xdXml.SelectNodes(selectNode);
        foreach (XmlNode node in xnNodes)
        {
            XmlNodeList paerentChildNodes = node.ChildNodes;
            foreach (XmlNode parentchild in paerentChildNodes)
            {
                switch (parentchild.Name)
                {
                    case "CommonDetails":
                        XmlNodeList childNodes = parentchild.ChildNodes;
                        foreach (XmlNode child in childNodes)
                        {
                            switch (child.Name)
                            {
                                case "PartyTIN":
                                    globalPartyTIN = child.InnerText.ToString();
                                    break;
                                case "PartyName":
                                    child.InnerText.ToString();
                                    break;
                                case "PartyAddress":
                                    child.InnerText.ToString();
                                    break;
                                case "MonthID":
                                    globalMonthID = Convert.ToInt32(child.InnerText.ToString());
                                    break;
                                case "QuarterID":
                                    globalQuarterID = Convert.ToInt32(child.InnerText.ToString());
                                    break;
                                case "YearID":
                                    globalYearID = Convert.ToInt32(child.InnerText.ToString());
                                    break;
                            }
                        }
                        childNodes = null;
                        break;

                }
            }
        }
    }

Monday, 11 June 2012

Upload file from windows application to web application server


1. First upload a file
2. Upload a file on web server using web services . Call web services in window application .

private void btnBrowse_Click(object sender, EventArgs e)
        {
            openFileDialogXML.Title = "Open File";
            openFileDialogXML.Filter = "All Files|*.*";
            openFileDialogXML.FileName = "";

            try
            {
                openFileDialogXML.InitialDirectory = "C:\\Temp";
            }
            catch (Exception ex)
            {
                throw ex;
            }

            openFileDialogXML.ShowDialog();

            if (openFileDialogXML.FileName == "")
                return;
            else
                txtFileName.Text = openFileDialogXML.FileName;

        }

        private void btnUpload_Click(object sender, EventArgs e)
        {
            if (txtFileName.Text != string.Empty)
                UploadFile(txtFileName.Text);
            else
                MessageBox.Show("You must select a file first.", "No File Selected");
        }

        private void UploadFile(string filename)
        {
            try
            {

                String strFile = System.IO.Path.GetFileName(filename);
                FileUploader.Uploader srv = new FileUploader.Uploader();
                FileInfo fInfo = new FileInfo(filename);
                long numBytes = fInfo.Length;
                double dLen = Convert.ToDouble(fInfo.Length / 1000000);
                if (dLen < 4)
                {
                    FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
                    BinaryReader br = new BinaryReader(fStream);

                    byte[] data = br.ReadBytes((int)numBytes);
                    br.Close();
                    string sTmp = srv.UploadXMLFile(data, strFile);
                    fStream.Close();
                    fStream.Dispose();
                    MessageBox.Show("File Upload Status: " + sTmp, "File Upload");
                }
                else
                {
                    MessageBox.Show("The file selected exceeds the size limit for uploads.", "File Size");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Upload Error");
            }
        }



/********************************************************************

web services :>>>>>>>>>>>>


[WebMethod]
        public string UploadXMLFile(byte[] f, string fileName)
        {

            try
            {
                MemoryStream ms = new MemoryStream(f);
                FileStream fs = new FileStream(System.Web.Hosting.HostingEnvironment.MapPath("~/UploadedFile/") + fileName, FileMode.Create);
                ms.WriteTo(fs);
                ms.Close();
                fs.Close();
                fs.Dispose();


                string appPath = HttpRuntime.AppDomainAppPath + "UploadedFile\\" + fileName;
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(appPath);
                XMLDocReadVat24XMLFile(xmlDoc);
                return "OK";
            }
            catch (Exception ex)
            {
                return ex.Message.ToString();
            }
        }










Tuesday, 1 May 2012

Multiple Insert with XMLType in Oracle


http://riteshkk2000.blogspot.in/2008/09/sending-xml-string-as-input-parameter.html


create or replace PROCEDURE "INSERT_EMPLOYEE_DATA"

(

ip_emp_details IN XMLTYPE

)

IS


BEGIN


FOR i IN
(

SELECT XMLTYPE.EXTRACT (VALUE (a),

'/Root/Name/text()').getstringval() AS ipName,

XMLTYPE.EXTRACT (VALUE (a),

'/Root/Address/text()').getstringval() AS ipAddress

FROM TABLE

(XMLSEQUENCE (ip_emp_details.EXTRACT

('/EmployeeData/Root')

)

) a )


LOOP


INSERT INTO MULTIPLEUSER

(Name, Address)

VALUES

(i.ipName, i.ipAddress);


END LOOP;


END INSERT_EMPLOYEE_DATA;





Page ------------------------->





using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;


namespace UploadFile
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         
                GetDataFromXML();

        }

        protected void GetDataFromXML()
        {
            DataSet XNLDataSet = new DataSet();
            string rootPath = MappedApplicationPath();
            string filePath = rootPath + "UploadedFile\\Data.xml";
            XNLDataSet.ReadXml(filePath);
            grdDataXml.DataSource = XNLDataSet.Tables[0].DefaultView;
            grdDataXml.DataBind();

            InsertData(XNLDataSet.Tables[0]);
        }

        private void InsertData(DataTable dt)
        {

            StringBuilder XMLString = new StringBuilder();

            XMLString.Append("<?xml version='1.0' encoding='utf-8' ?>");

            XMLString.Append("<EmployeeData>");


            foreach (DataRow dtRows in dt.Rows)
            {

                XMLString.Append("<Root>");

                XMLString.Append("<Name>"+ dtRows["text"].ToString().Trim()+"</Name>");

                XMLString.Append("<Address>"+ dtRows["value"].ToString().Trim()+"</Address>");

                XMLString.Append("</Root>");

            }


            XMLString.Append("</EmployeeData>");

            //Create the connection String
            OracleConnection oraCon = new OracleConnection();
            OracleCommand oraCmd = new OracleCommand();
            oraCon.ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.50.90)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=sampark)));User Id=project1;Password=projectabc;";

            oraCon.Open();

            oraCmd.CommandType = CommandType.StoredProcedure;

            oraCmd.CommandText = "INSERT_EMPLOYEE_DATA";
            // Oracle SP Name

            oraCmd.Connection = oraCon;


            oraCmd.Parameters.Add("ip_emp_details", OracleDbType.XmlType, XMLString.ToString(), ParameterDirection.Input);
            // Oracle SP Input Parameter name

            //Execute the Stored Procedure

           int  recordEffected = oraCmd.ExecuteNonQuery();

            oraCon.Close();

            oraCon.Dispose();

        }

        private string MappedApplicationPath()
        {
            string APP_PATH = System.Web.HttpContext.Current.Request.ApplicationPath.ToLower();
            if (APP_PATH == "/")      //a site
                APP_PATH = "/";
            else if (!APP_PATH.EndsWith(@"/")) //a virtual
                APP_PATH += @"/";

            string it = System.Web.HttpContext.Current.Server.MapPath(APP_PATH);
            if (!it.EndsWith(@"\"))
                it += @"\";
            return it;

        }


    }
}


Oracle Helper.cs




<connectionStrings>
    <add name="ConStrng" connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.50.10)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=excise)));User Id=excise;Password=vat123$;"/>
</connectionStrings>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration.Assemblies;
using CommercialTaxMissionMode.ObjectModel;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

namespace CommercialTaxMissionMode.DAL
{
    public class OracleHelper
    {
        string constrg = System.Configuration.ConfigurationManager.ConnectionStrings["ConStrng"].ToString();

        #region Reader
        /// <summary>
        /// Returns a datareader for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <param name="prms"></param>
        /// <returns></returns>

        public OracleDataReader ExecuteReader(string cmdText, OracleParameter[] prms, CommandType Type)
        {
            try
            {
                OracleConnection conn = new OracleConnection(constrg);
                using (OracleCommand cmd = new OracleCommand(cmdText, conn))
                {
                    cmd.CommandType = Type;

                    if (prms != null)
                    {
                        foreach (OracleParameter p in prms)
                        {
                            cmd.Parameters.Add(p);
                        }
                    }
                    conn.Open();
                    return cmd.ExecuteReader(CommandBehavior.CloseConnection);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
           
        }


        /// <summary>
        /// Returns a datareader for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <returns></returns>
        public OracleDataReader ExecuteReader(string cmdText, CommandType Type)
        {
            return ExecuteReader(cmdText, null, Type);
        }
        #endregion

        #region DataSet
        /// <summary>
        /// Returns a dataset for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <param name="prms"></param>
        /// <returns></returns>


        public DataSet ExecuteDataSet(string cmdText, OracleParameter[] prms,CommandType Type)
        {
            try
            {
                using (OracleConnection conn = new OracleConnection(constrg))
                {
                    DataSet ds = new DataSet();
                    using (OracleCommand cmd = new OracleCommand(cmdText, conn))
                    {
                        cmd.CommandType = Type;
                        if (prms != null)
                        {
                            foreach (OracleParameter p in prms)
                            {
                                cmd.Parameters.Add(p);
                            }
                        }
                        OracleDataAdapter adpt = new OracleDataAdapter(cmd);
                        adpt.Fill(ds);
                        return ds;
                    }
                }
            }
            catch (Exception ex)
            {
               
                throw ex;
            }
         
        }



        /// <summary>
        /// Returns a dataset for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <returns></returns>
        public DataSet ExecuteDataSet(string cmdText, CommandType Type)
        {
            return ExecuteDataSet(cmdText, null, Type);
        }

        #endregion
       
        #region DataTable
        /// <summary>
        /// Returns a datatable for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <param name="prms"></param>
        /// <returns></returns>


        public DataTable ExecuteDataTable(string cmdText, OracleParameter[] prms, CommandType Type)
        {
            try
            {
                using (OracleConnection conn = new OracleConnection(constrg))
                {
                    DataTable dt = new DataTable();
                    using (OracleCommand cmd = new OracleCommand(cmdText, conn))
                    {
                        cmd.CommandType = Type;
                        if (prms != null)
                        {
                            foreach (OracleParameter p in prms)
                            {
                                cmd.Parameters.Add(p);
                            }
                        }
                        OracleDataAdapter adpt = new OracleDataAdapter(cmd);
                        adpt.Fill(dt);
                        return dt;
                    }
                }
            }
            catch (Exception ex)
            {
               
                throw ex;
            }

         
        }



        /// <summary>
        /// Returns a datatable for the oracle command
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <returns></returns>
        public DataTable ExecuteDataTable(string cmdText, CommandType Type)
        {
            return ExecuteDataTable(cmdText, null, Type);
        }

        #endregion
       
        #region NonQuery


        /// <summary>
        /// Executes a non query
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <param name="prms"></param>
        /// <returns></returns>
        public int ExecuteNonQuery(string cmdText, OracleParameter[] prms, CommandType Type)
        {
            try
            {
                using (OracleConnection conn = new OracleConnection(constrg))
                {
                    using (OracleCommand cmd = new OracleCommand(cmdText, conn))
                    {
                        cmd.CommandType = Type;
                        if (prms != null)
                        {
                            foreach (OracleParameter p in prms)
                            {
                                cmd.Parameters.Add(p);
                            }
                        }
                        conn.Open();
                        return cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
               
                throw ex;
            }
         
        }

        /// <summary>
        /// Executes a non query
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <returns></returns>


        public int ExecuteNonQuery(string cmdText, CommandType Type)
        {
            return ExecuteNonQuery(cmdText, null, Type);
        }
        #endregion

        #region Scalar
        /// <summary>
        /// Returns the scalar object of the query
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <param name="prms"></param>
        /// <returns></returns>


        public object ExecuteScalar(string cmdText, OracleParameter[] prms, CommandType Type)
        {
            try
            {
                using (OracleConnection conn = new OracleConnection(constrg))
                {
                    using (OracleCommand cmd = new OracleCommand(cmdText, conn))
                    {
                        cmd.CommandType = Type;
                        if (prms != null)
                        {
                            foreach (OracleParameter p in prms)
                            {
                                cmd.Parameters.Add(p);
                            }
                        }
                        conn.Open();
                        return cmd.ExecuteScalar();
                    }
                }
            }
            catch (Exception ex)
            {
               
                throw ex;
            }
         
        }




        /// <summary>
        /// Returns the scalar object of the query
        /// </summary>
        /// <param name="constrg"></param>
        /// <param name="cmdText"></param>
        /// <returns></returns>
        public object ExecuteScalar(string cmdText, CommandType Type)
        {
            return ExecuteScalar(cmdText, null, Type);
        }
        #endregion


    }
}

Wednesday, 4 April 2012

OOPS Concept -3 (Overloading and Overriding)

Overloading ---------->




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestOOPSConcept
{
    /// <summary>
    /// In Same class, u define funtion with same name,parameter then amniguity error comes.
    /// </summary>
    class TestOverloading
    {

        static void Foo(int x)
        {
            Console.WriteLine("Foo(int x)");
        }

        static void Foo(string y)
        {
            Console.WriteLine("Foo(string y)");
        }

        static void Foo(double z)
        {
            Console.WriteLine("Foo(double y)");
        }

        static void Foo(int x, int y = 5)
        {
            Console.WriteLine("Foo(int x, int y = 5)");
        }

   
        //static void Main()
        //{

        //    Foo(10, 5);
        //    Console.Read();
        //}

    }
}






Overriding ------------------->



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestOOPSConcept
{
    /// <summary>
    ///  /// overriding and Hiding
    /// The virtual keyword is used to modify a method, property, indexer or event declaration, and allow it to be overridden in a derived class.
    /// virtual or abstract members cannot be private
    /// You cannot use the virtual modifier with the static, abstract, private or override modifiers.
    /// </summary>
    class A
    {
        public void Foo()
        {
            Console.WriteLine("A::Foo()");
        }
    }

    class B : A
    {
        public new void Foo()
        {
            base.Foo();
            Console.WriteLine("B::Foo()");
        }
    }

    class Test
    {
        //static void Main(string[] args)
        //{
        //    A a;
        //    B b;

        //    a = new A();
        //    b = new B();
        //    a.Foo();  // output --> "A::Foo()"
        //    b.Foo();  // output --> "B::Foo()"

        //    a = new B();
        //    a.Foo();  // output --> "A::Foo()"
        //    Console.Read();
        //}
    }
}

OOPS Concept -2 (All about Constructor)

Constructor  ------------------------>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestOOPSConcept
{
    /// <summary>
    /// Private Constructor ***************
    /// It is generally used in classes that contain static members only
    /// If u don't declare the modifier with constructor, By Default costructor modifier are "private".
    /// If class contains only private constructor, its clear that the class can not be instantiated.
    /// If all the methods in the class are static, consider making the complete class static.
    /// </summary>

    public class Counter
    {
        private Counter() {
        }
        public static int currentCount;
        public static int IncrementCount()
        {
            return ++currentCount;
        }
     
    }
 
    class TestCounter
    {
        //static void Main()
        //{
        //    // If you uncomment the following statement, it will generate
        //    // an error because the constructor is inaccessible:
        //    // Counter aCounter = new Counter();   // Error    
       
        //    Counter.currentCount = 100;
        //    Counter.IncrementCount();
        //    Console.WriteLine("New count: {0}", Counter.currentCount);

        //    // Keep the console window open in debug mode.
        //    Console.WriteLine("Press any key to exit.");
        //    Console.ReadKey();
        //}
    }
}




OOPS Concept -1(Abstract and Interface)


Abstract Class - >>>>>>>>>>>>>>>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestOOPSConcept
{
    /// <summary>
    /// The purpose of an abstract class is to provide a common definition of a base class that multiple derived classes can share.
    /// we can call the non abstract method from inherited class using base keyword.
    /// if i don't declare any virtual or abstract with function, then inherited class shows warning with that function, then we can use New keyword for hiding
    /// We can't create the instance of abstract class or interface.
    /// we must implement abstract method in derived class.
    /// Abstract class may contain static method.
    /// </summary>
    abstract class ClassA
    {
        public int a = 100, b = 10, totalsum, totalsubtract, totalmultiply;
        public abstract int Sum();   // Abstract methods have no implementations  
        public  virtual int Subtract()
        {
            return totalsubtract = a - b;
        }
        public abstract int Multiply();
        public static void Test()
        {
            Console.WriteLine("Abstract class may contain static method");
        }
    }

    abstract class ClassB : ClassA
    {
        public override int Sum()
        {
            return totalsum = a + b;

        }

        public override int Subtract()
        {
         
            totalsubtract = base.Subtract();
            return totalsubtract - 40;
        }
     
   
    }

    class MyClass : ClassB
    {
        public override int Sum()
        {
            return totalsum = a + b + 50;
        }

        public override int Multiply()
        {
            return totalmultiply = a * b +80;
        }

    }

    class MainClass
    {
        //static void Main(string[] args)
        //{
        //    MyClass obj = new MyClass();
        //    int x = obj.Sum();
        //    Console.WriteLine("Sum: " + x);
        //    int y = obj.Subtract();
        //    Console.WriteLine("Sub: " + y);
        //    int z = obj.Multiply();
        //    Console.WriteLine("Multiply: " + z);
        //    ClassB.Test();
        //    Console.Read();

       // }
    }
}




Interface ------------------------------


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestOOPSConcept
{
    /// <summary>
    /// If you want your child classes to implement multiple unrelated functionalities in short multiple inheritance use interfaces.
    ///  if u declare public modifier with method in interface, then error comes: by default interface members are public.
    ///   We can't create the instance of abstract class or interface.
    ///   No need to override the interface methods.
    ///
    ///
    /// 1. ExampleClass ex = new ExampleClass(); - When we are instantiating the class by specifying the object as the class name,
    /// we will be able to call methods for the interface that is implicitely implemented. In this case IExampleClass2.
    ///
    ///
    /// 2. IExampleClass1 ex1 = new ExampleClass(); - If we want to call the method that is explicitely implemented,
    /// we need to specify the object as the interface name and instantiate the class then we will be able to call the method of this interface. In this case IExampleClass1.
    ///
    ///
    ///3. IExampleClass2 ex2 = new ExampleClass(); - You can call methods of the interface
    /// that is implicitely implemented by specifying the name of the Interface as the object name (The way we have done in the 2nd point).
    /// This will give the same result as the 1st point above.
    /// </summary>
    interface interfaceA
    {
        void Sum();
        void Subtract();
    }
    interface interfaceB
    {
        void Sum();
        void Sum(string abc);
    }
    interface interfaceC : interfaceA, interfaceB
    {
        void Multiply();

    }
    class interfaceClass : interfaceC
    {
     
        public void Sum()
        {
            Console.WriteLine("Implement sum1 function.");
        }
        public void Subtract()
        {
            Console.WriteLine("Implement Subtract function.");
        }
        public void Sum(string abc)
        {
            Console.WriteLine("Implement sum2 function.");
            //return abc;
        }
        void interfaceB.Sum() // Explicitally call
        {
            Console.WriteLine("Interface B call sum method");
        }
        public void Multiply()
        {
            Console.WriteLine("Implement multiply function.");
        }
    }

    class MaininterfaceClass
    {
        //static void Main(string[] args)
        //{
            //interfaceClass objinterfaceClass = new interfaceClass();
            //objinterfaceClass.Sum();
            //objinterfaceClass.Sum("123");
            //objinterfaceClass.Subtract();
            //objinterfaceClass.Multiply();
            //interfaceB objinterfaceB = new interfaceClass();
            //objinterfaceB.Sum();
            //Console.Read();

      //  }
    }




}

Monday, 26 March 2012

Image Generator


public static void ChangeImageColor(Hammond obj)
{
    using (Image image = Image.FromFile(HttpContext.Current.Server.MapPath(obj.StandardVerse)))
    {
        using (MemoryStream stream = new MemoryStream(ConvertImageToByteArray(image)))
        {
            using (Image image2 = Image.FromFile(HttpContext.Current.Server.MapPath(obj.StandardVerse)))
            {
                using ((Bitmap) image2)
                {
                    using (Image image3 = Image.FromStream(stream))
                    {
                        using (Bitmap bitmap2 = new Bitmap(new Bitmap(image3)))
                        {
                            List<Color> list = new List<Color>();
                            height = bitmap2.Height;
                            List<int> list2 = new List<int>();
                            List<int> list3 = new List<int>();
                            int num6 = bitmap2.Width - 1;
                            for (int i = 0; i <= num6; i++)
                            {
                                int num7 = bitmap2.Height - 1;
                                for (int k = 0; k <= num7; k++)
                                {
                                    if ((((((bitmap2.GetPixel(i, k).R != 0xff) && (bitmap2.GetPixel(i, k).G != 0xff)) && ((bitmap2.GetPixel(i, k).G != 0xfe) && (bitmap2.GetPixel(i, k).G != 0xfd))) && (((bitmap2.GetPixel(i, k).G != 0xfc) && (bitmap2.GetPixel(i, k).G != 0xfb)) && ((bitmap2.GetPixel(i, k).G != 250) && (bitmap2.GetPixel(i, k).G != 0xf9)))) && ((((bitmap2.GetPixel(i, k).G != 0xf8) && (bitmap2.GetPixel(i, k).G != 0xf7)) && ((bitmap2.GetPixel(i, k).G != 0xf6) && (bitmap2.GetPixel(i, k).G != 0xf5))) && (((bitmap2.GetPixel(i, k).G != 0xf4) && (bitmap2.GetPixel(i, k).G != 0xf3)) && ((bitmap2.GetPixel(i, k).G != 0xf2) && (bitmap2.GetPixel(i, k).G != 0xf1))))) && (((((bitmap2.GetPixel(i, k).G != 240) && (bitmap2.GetPixel(i, k).G != 0xef)) && ((bitmap2.GetPixel(i, k).G != 0xee) && (bitmap2.GetPixel(i, k).G != 0xed))) && (((bitmap2.GetPixel(i, k).G != 0xec) && (bitmap2.GetPixel(i, k).G != 0xeb)) && ((bitmap2.GetPixel(i, k).G != 0xea) && (bitmap2.GetPixel(i, k).G != 0xe9)))) && ((((bitmap2.GetPixel(i, k).G != 0xe8) && (bitmap2.GetPixel(i, k).G != 0xe7)) && ((bitmap2.GetPixel(i, k).G != 230) && (bitmap2.GetPixel(i, k).G != 0xe5))) && (((bitmap2.GetPixel(i, k).G != 0xe4) && (bitmap2.GetPixel(i, k).G != 0xe3)) && (((bitmap2.GetPixel(i, k).G != 0xe2) && (bitmap2.GetPixel(i, k).G != 0xe1)) && (bitmap2.GetPixel(i, k).B != 0xff))))))
                                    {
                                        list2.Add(i);
                                        list3.Add(k);
                                    }
                                }
                            }
                            int num8 = bitmap2.Width - 1;
                            for (int j = 0; j <= num8; j++)
                            {
                                int num9 = bitmap2.Height - 1;
                                for (int m = 0; m <= num9; m++)
                                {
                                    bitmap2.SetPixel(j, m, Color.White);
                                }
                            }
                            if (obj.StandardVerse.Substring(obj.StandardVerse.LastIndexOf("/") + 1) != "00000blank.jpg")
                            {
                                int num10 = list2.Count - 1;
                                for (int n = 0; n <= num10; n++)
                                {
                                    bitmap2.SetPixel(list2[n], list3[n], Color.FromName(obj.ImprintInk));
                                }
                            }
                            string filename = HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif");
                            bitmap2.Save(filename, ImageFormat.Tiff);
                        }
                    }
                }
            }
        }
    }
}

 /***************/


public static byte[] ConvertImageToByteArray(Image imageIn)
{
    using (MemoryStream stream = new MemoryStream())
    {
        imageIn.Save(stream, ImageFormat.Png);
        return stream.ToArray();
    }
}




End 

public static string CreateCardHighProof(Hammond obj)
{
    string str = Guid.NewGuid().ToString();
    string str3 = Guid.NewGuid().ToString();
    try
    {
        ColorMatrix newColorMatrix = new ColorMatrix(new float[][] { new float[] { 0.299f, 0.299f, 0.299f, 0f, 0f }, new float[] { 0.587f, 0.587f, 0.587f, 0f, 0f }, new float[] { 0.114f, 0.114f, 0.114f, 0f, 0f }, new float[] { 0f, 0f, 0f, 1f, 0f }, new float[] { 0f, 0f, 0f, 0f, 1f } }) {
            Matrix33 = 1f
        };
        using (ImageAttributes attributes = new ImageAttributes())
        {
            float num3;
            float num4;
            float num5;
            float num6;
            attributes.SetColorMatrix(newColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
            string str4 = obj.CardSize.Replace("X", "x").Replace("\"", "");
            if (str4.Substring(0, str4.IndexOf("x") - 1).Contains("/"))
            {
                string[] strArray = str4.Substring(0, str4.IndexOf("x") - 1).Split(new char[] { ' ' });
                num3 = Conversions.ToSingle(strArray[0]);
                string[] strArray2 = strArray[1].Split(new char[] { '/' });
                num4 = Conversions.ToSingle(strArray2[0]) / Conversions.ToSingle(strArray2[1]);
            }
            else
            {
                num3 = Conversions.ToSingle(str4.Substring(0, str4.IndexOf("x") - 1).Trim());
                num4 = 0f;
            }
            if (str4.Substring(str4.IndexOf("x") + 2).Contains("/"))
            {
                string[] strArray3 = str4.Substring(str4.IndexOf("x") + 2).Split(new char[] { ' ' });
                num5 = Conversions.ToSingle(strArray3[0]);
                string[] strArray4 = strArray3[1].Split(new char[] { '/' });
                num6 = Conversions.ToSingle(strArray4[0]) / Conversions.ToSingle(strArray4[1]);
            }
            else
            {
                num5 = Conversions.ToSingle(str4.Substring(str4.IndexOf("x") + 2).Trim());
                num6 = 0f;
            }
            int width = (int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle((float) ((num3 + num4) * 1440f)), obj.ResolutionType));
            int height = (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle((float) ((num5 + num6) * 1440f)), obj.ResolutionType));
            using (Bitmap bitmap = new Bitmap(width, height))
            {
                if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                {
                    bitmap.SetResolution(600f, 600f);
                }
                else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                {
                    bitmap.SetResolution(600f, 600f);
                }
                using (Graphics graphics = Graphics.FromImage(bitmap))
                {
                    string str10;
                    string str16;
                    Rectangle rectangle;
                    graphics.Clear(Color.White);
                    graphics.CompositingQuality = CompositingQuality.HighSpeed;
                    graphics.SmoothingMode = SmoothingMode.HighQuality;
                    graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                    Color color = Color.FromName("Black");
                    float num10 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseWidth, 1440M)), obj.ResolutionType);
                    float num9 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseHeight, 1440M)), obj.ResolutionType);
                    float num8 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextWidth, 1440M)), obj.ResolutionType);
                    float num7 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextHeight, 1440M)), obj.ResolutionType);
                    if (obj.VerseType == "Standard")
                    {
                        using (Image image = Image.FromFile(HttpContext.Current.Server.MapPath(obj.StandardVerse)))
                        {
                            float num11;
                            float num12;
                            RectangleF ef;
                            if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                            {
                                num11 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                                if (obj.CardLayout == "H")
                                {
                                    num12 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                                }
                                else
                                {
                                    num12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                                }
                                ef = new RectangleF(num11, num12, num10, num9);
                            }
                            else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                            {
                                rectangle = new Rectangle((int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType)), (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType)), (int) Math.Round((double) num10), (int) Math.Round((double) num9));
                                ef = rectangle;
                                num11 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                                num12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                            }
                            if ((Conversions.ToString(obj.VerseAlignmentX) == "T") & (Conversions.ToString(obj.VerseAlignmentY) == "C"))
                            {
                                graphics.DrawImage(image, num11 + ((num10 - image.Width) / 2f), num12, (float) image.Width, (float) image.Height);
                            }
                            else
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num11 + ((num10 - image.Width) / 2f))), (int) Math.Round((double) (num12 + ((num9 - image.Height) / 2f))), (int) Math.Round((double) image.Width), (int) Math.Round((double) image.Height));
                                graphics.DrawImage(image, rectangle, 0f, 0f, (float) image.Width, (float) image.Height, GraphicsUnit.Pixel, attributes);
                            }
                        }
                    }
                    else if (obj.VerseType == "Custom")
                    {
                        RectangleF ef2;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj2;
                            float x = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj2 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj2 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                            }
                            ef2 = new RectangleF(x, Conversions.ToSingle(obj2), num10, num9);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            rectangle = new Rectangle((int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType)), (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType)), (int) Math.Round((double) num10), (int) Math.Round((double) num9));
                            ef2 = rectangle;
                        }
                        string typeStyle = obj.TypeStyle;
                        using (PrivateFontCollection fonts = new PrivateFontCollection())
                        {
                            DirectoryInfo info = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                            if (info.Exists)
                            {
                                FileInfo[] files = info.GetFiles();
                                for (int i = 0; i < files.Length; i++)
                                {
                                    object obj3 = files[i];
                                    fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj3.ToString());
                                    if (fonts.Families[fonts.Families.Count<FontFamily>() - 1].Name == typeStyle)
                                    {
                                        fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj3.ToString());
                                        break;
                                    }
                                }
                                info = null;
                            }
                            using (Font font = new Font(fonts.Families[fonts.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.VerseFontSize)))
                            {
                                using (SolidBrush brush = new SolidBrush(color))
                                {
                                    using (StringFormat format = new StringFormat())
                                    {
                                        if ((Conversions.ToString(obj.VerseAlignmentX) == "T") & (Conversions.ToString(obj.VerseAlignmentY) == "C"))
                                        {
                                            format.Alignment = StringAlignment.Center;
                                            format.LineAlignment = StringAlignment.Near;
                                            format.Trimming = StringTrimming.Character;
                                            graphics.DrawString(obj.CustomVerseText, font, brush, ef2, format);
                                        }
                                        else
                                        {
                                            format.Alignment = StringAlignment.Center;
                                            format.LineAlignment = StringAlignment.Center;
                                            format.Trimming = StringTrimming.Character;
                                            graphics.DrawString(obj.CustomVerseText, font, brush, ef2, format);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!obj.LogoShow)
                    {
                        goto Label_478F;
                    }
                    if (obj.CardLogoLocation != "Below")
                    {
                        goto Label_29C0;
                    }
                    if (!((!(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType)) & !(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType))) & (Conversions.ToDouble(obj.CompanyID) == 3.0)))
                    {
                        goto Label_18A7;
                    }
                    string filename = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                    using (Image image2 = Image.FromFile(filename))
                    {
                        object obj4;
                        double num17;
                        double num18;
                        float num15 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconWidth, 1440M)), obj.ResolutionType);
                        float num14 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconHeight, 1440M)), obj.ResolutionType);
                        float num16 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType);
                        if (obj.CardLayout == "H")
                        {
                            obj4 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                        }
                        else
                        {
                            obj4 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                        }
                        RectangleF ef3 = new RectangleF(num16, Conversions.ToSingle(obj4), num15, num14);
                        if (!(image2.HorizontalResolution == 600f) | !(image2.VerticalResolution == 600f))
                        {
                            using (MemoryStream stream = new MemoryStream(ConvertImageToByteArray(image2)))
                            {
                                using (Image image3 = Image.FromStream(stream))
                                {
                                    using (Image image4 = SetResolution(image3, 600))
                                    {
                                        if ((image4.Width > num15) & (image4.Height > num14))
                                        {
                                            num17 = num15 / ((float) image4.Width);
                                            num18 = num14 / ((float) image4.Height);
                                        }
                                        else if ((image4.Width > num15) & (image4.Height < num14))
                                        {
                                            num17 = num15 / ((float) image4.Width);
                                            num18 = 1.0;
                                        }
                                        else if ((image4.Width < num15) & (image4.Height > num14))
                                        {
                                            num17 = 1.0;
                                            num18 = num14 / ((float) image4.Height);
                                        }
                                        else
                                        {
                                            num17 = 1.0;
                                            num18 = 1.0;
                                        }
                                        if (!(num17 == 1.0) | !(num18 == 1.0))
                                        {
                                            ResizeImage(image4, num17, num18, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                        }
                                        if ((num17 == 1.0) & (num18 == 1.0))
                                        {
                                            using (Image image5 = image4)
                                            {
                                                rectangle = new Rectangle((int) Math.Round((double) (num16 + ((num15 - image5.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj4, (num14 - image5.Height) / 2f)), image5.Width, image5.Height);
                                                graphics.DrawImage(image5, rectangle, 0f, 0f, (float) image5.Width, (float) image5.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                        }
                                        else
                                        {
                                            using (Image image6 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                            {
                                                rectangle = new Rectangle((int) Math.Round((double) (num16 + ((num15 - image6.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj4, (num14 - image6.Height) / 2f)), image6.Width, image6.Height);
                                                graphics.DrawImage(image6, rectangle, 0f, 0f, (float) image6.Width, (float) image6.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                        }
                                    }
                                    goto Label_1531;
                                }
                            }
                        }
                        if ((image2.Width > num15) & (image2.Height > num14))
                        {
                            num17 = num15 / ((float) image2.Width);
                            num18 = num14 / ((float) image2.Height);
                        }
                        else if ((image2.Width > num15) & (image2.Height < num14))
                        {
                            num17 = num15 / ((float) image2.Width);
                            num18 = 1.0;
                        }
                        else if ((image2.Width < num15) & (image2.Height > num14))
                        {
                            num17 = 1.0;
                            num18 = num14 / ((float) image2.Height);
                        }
                        else
                        {
                            num17 = 1.0;
                            num18 = 1.0;
                        }
                        if (!(num17 == 1.0) | !(num18 == 1.0))
                        {
                            ResizeImage(image2, num17, num18, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                        }
                        if ((num17 == 1.0) & (num18 == 1.0))
                        {
                            using (Image image7 = image2)
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num16 + ((num15 - image7.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj4, (num14 - image7.Height) / 2f)), image7.Width, image7.Height);
                                graphics.DrawImage(image7, rectangle, 0f, 0f, (float) image7.Width, (float) image7.Height, GraphicsUnit.Pixel, attributes);
                            }
                        }
                        else
                        {
                            using (Image image8 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num16 + ((num15 - image8.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj4, (num14 - image8.Height) / 2f)), image8.Width, image8.Height);
                                graphics.DrawImage(image8, rectangle, 0f, 0f, (float) image8.Width, (float) image8.Height, GraphicsUnit.Pixel, attributes);
                            }
                        }
                    }
                Label_1531:
                    if (obj.MessageShow)
                    {
                        RectangleF ef4;
                        string s = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj5;
                            float num19 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj5 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj5 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            ef4 = new RectangleF(num19, Conversions.ToSingle(obj5), num8, num7);
                        }
                        using (SolidBrush brush2 = new SolidBrush(color))
                        {
                            using (StringFormat format2 = new StringFormat())
                            {
                                if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                {
                                    format2.Alignment = StringAlignment.Center;
                                    format2.LineAlignment = StringAlignment.Near;
                                    format2.Trimming = StringTrimming.Character;
                                }
                                else
                                {
                                    format2.Alignment = StringAlignment.Center;
                                    format2.LineAlignment = StringAlignment.Center;
                                    format2.Trimming = StringTrimming.Character;
                                }
                                using (PrivateFontCollection fonts2 = new PrivateFontCollection())
                                {
                                    DirectoryInfo info2 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                    string messageTypeStyle = obj.MessageTypeStyle;
                                    if (info2.Exists)
                                    {
                                        FileInfo[] infoArray8 = info2.GetFiles();
                                        for (int j = 0; j < infoArray8.Length; j++)
                                        {
                                            object obj6 = infoArray8[j];
                                            fonts2.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj6.ToString());
                                            if (fonts2.Families[fonts2.Families.Count<FontFamily>() - 1].Name == messageTypeStyle)
                                            {
                                                fonts2.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj6.ToString());
                                                break;
                                            }
                                        }
                                        info2 = null;
                                    }
                                    using (Font font2 = new Font(fonts2.Families[fonts2.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                    {
                                        graphics.DrawString(s, font2, brush2, ef4, format2);
                                    }
                                }
                            }
                        }
                    }
                    goto Label_29C0;
                Label_18A7:
                    str10 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                    using (Image image9 = Image.FromFile(str10))
                    {
                        object obj7;
                        object obj8;
                        double num20;
                        double num21;
                        if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            obj7 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            obj8 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            obj7 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj8 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj8 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                        }
                        RectangleF ef5 = new RectangleF(Conversions.ToSingle(obj7), Conversions.ToSingle(obj8), num8, num7);
                        if (!(image9.HorizontalResolution == 600f) | !(image9.VerticalResolution == 600f))
                        {
                            using (MemoryStream stream2 = new MemoryStream(ConvertImageToByteArray(image9)))
                            {
                                using (Image image10 = Image.FromStream(stream2))
                                {
                                    using (Image image11 = SetResolution(image10, 600))
                                    {
                                        if (obj.MessageShow)
                                        {
                                            if ((image11.Width > num8) & (image11.Height > (num7 / 2f)))
                                            {
                                                num20 = num8 / ((float) image11.Width);
                                                num21 = (num7 / 2f) / ((float) image11.Height);
                                            }
                                            else if ((image11.Width > num8) & (image11.Height < (num7 / 2f)))
                                            {
                                                num20 = num8 / ((float) image11.Width);
                                                num21 = 1.0;
                                            }
                                            else if ((image11.Width < num8) & (image11.Height > (num7 / 2f)))
                                            {
                                                num20 = 1.0;
                                                num21 = (num7 / 2f) / ((float) image11.Height);
                                            }
                                            else
                                            {
                                                num20 = 1.0;
                                                num21 = 1.0;
                                            }
                                        }
                                        else if ((image11.Width > num8) & (image11.Height > num7))
                                        {
                                            num20 = num8 / ((float) image11.Width);
                                            num21 = num7 / ((float) image11.Height);
                                        }
                                        else if ((image11.Width > num8) & (image11.Height < num7))
                                        {
                                            num20 = num8 / ((float) image11.Width);
                                            num21 = 1.0;
                                        }
                                        else if ((image11.Width < num8) & (image11.Height > num7))
                                        {
                                            num20 = 1.0;
                                            num21 = num7 / ((float) image11.Height);
                                        }
                                        else
                                        {
                                            num20 = 1.0;
                                            num21 = 1.0;
                                        }
                                        if (!(num20 == 1.0) | !(num21 == 1.0))
                                        {
                                            ResizeImage(image11, num20, num21, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                        }
                                        if ((num20 == 1.0) & (num21 == 1.0))
                                        {
                                            using (Image image12 = image11)
                                            {
                                                if (!obj.MessageShow)
                                                {
                                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image12.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num7 - image12.Height) / 2f)), (int) Math.Round((double) image12.Width), (int) Math.Round((double) image12.Height));
                                                    graphics.DrawImage(image12, rectangle, 0f, 0f, (float) image12.Width, (float) image12.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                                else
                                                {
                                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image12.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num7 / 2f)), image12.Width, image12.Height);
                                                    graphics.DrawImage(image12, rectangle, 0f, 0f, (float) image12.Width, (float) image12.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                            }
                                            goto Label_261D;
                                        }
                                        using (Image image13 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                        {
                                            if (!obj.MessageShow)
                                            {
                                                rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image13.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num7 - image13.Height) / 2f)), (int) Math.Round((double) image13.Width), (int) Math.Round((double) image13.Height));
                                                graphics.DrawImage(image13, rectangle, 0f, 0f, (float) image13.Width, (float) image13.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                            else
                                            {
                                                rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image13.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num7 / 2f)), image13.Width, image13.Height);
                                                graphics.DrawImage(image13, rectangle, 0f, 0f, (float) image13.Width, (float) image13.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                            goto Label_261D;
                                        }
                                    }
                                }
                            }
                        }
                        if (obj.MessageShow)
                        {
                            if ((image9.Width > num8) & (image9.Height > (num7 / 2f)))
                            {
                                num20 = num8 / ((float) image9.Width);
                                num21 = (num7 / 2f) / ((float) image9.Height);
                            }
                            else if ((image9.Width > num8) & (image9.Height < (num7 / 2f)))
                            {
                                num20 = num8 / ((float) image9.Width);
                                num21 = 1.0;
                            }
                            else if ((image9.Width < num8) & (image9.Height > (num7 / 2f)))
                            {
                                num20 = 1.0;
                                num21 = (num7 / 2f) / ((float) image9.Height);
                            }
                            else
                            {
                                num20 = 1.0;
                                num21 = 1.0;
                            }
                        }
                        else if ((image9.Width > num8) & (image9.Height > num7))
                        {
                            num20 = num8 / ((float) image9.Width);
                            num21 = num7 / ((float) image9.Height);
                        }
                        else if ((image9.Width > num8) & (image9.Height < num7))
                        {
                            num20 = num8 / ((float) image9.Width);
                            num21 = 1.0;
                        }
                        else if ((image9.Width < num8) & (image9.Height > num7))
                        {
                            num20 = 1.0;
                            num21 = num7 / ((float) image9.Height);
                        }
                        else
                        {
                            num20 = 1.0;
                            num21 = 1.0;
                        }
                        if (!(num20 == 1.0) | !(num21 == 1.0))
                        {
                            ResizeImage(image9, num20, num21, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                        }
                        if ((num20 == 1.0) & (num21 == 1.0))
                        {
                            using (Image image14 = image9)
                            {
                                if (!obj.MessageShow)
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image14.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num7 - image14.Height) / 2f)), (int) Math.Round((double) image14.Width), (int) Math.Round((double) image14.Height));
                                    graphics.DrawImage(image14, rectangle, 0f, 0f, (float) image14.Width, (float) image14.Height, GraphicsUnit.Pixel, attributes);
                                }
                                else
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image14.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num7 / 2f)), image14.Width, image14.Height);
                                    graphics.DrawImage(image14, rectangle, 0f, 0f, (float) image14.Width, (float) image14.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                        }
                        else
                        {
                            using (Image image15 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                            {
                                if (!obj.MessageShow)
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image15.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num7 - image15.Height) / 2f)), (int) Math.Round((double) image15.Width), (int) Math.Round((double) image15.Height));
                                    graphics.DrawImage(image15, rectangle, 0f, 0f, (float) image15.Width, (float) image15.Height, GraphicsUnit.Pixel, attributes);
                                }
                                else
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num8 - image15.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num7 / 2f)), image15.Width, image15.Height);
                                    graphics.DrawImage(image15, rectangle, 0f, 0f, (float) image15.Width, (float) image15.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                        }
                    }
                Label_261D:
                    if (obj.MessageShow)
                    {
                        RectangleF ef6;
                        string str11 = obj.Personalize1;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj9;
                            float num22 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj9 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj9 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            ef6 = new RectangleF(num22, Conversions.ToSingle(obj9), num8, num7 / 2f);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            ef6 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType), num8, num7 / 2f);
                        }
                        using (PrivateFontCollection fonts3 = new PrivateFontCollection())
                        {
                            DirectoryInfo info3 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                            string str12 = obj.MessageTypeStyle;
                            if (info3.Exists)
                            {
                                FileInfo[] infoArray9 = info3.GetFiles();
                                for (int k = 0; k < infoArray9.Length; k++)
                                {
                                    object obj10 = infoArray9[k];
                                    fonts3.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj10.ToString());
                                    if (fonts3.Families[fonts3.Families.Count<FontFamily>() - 1].Name == str12)
                                    {
                                        fonts3.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj10.ToString());
                                        break;
                                    }
                                }
                                info3 = null;
                            }
                            using (Font font3 = new Font(fonts3.Families[fonts3.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                            {
                                using (SolidBrush brush3 = new SolidBrush(color))
                                {
                                    using (StringFormat format3 = new StringFormat())
                                    {
                                        if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                        {
                                            format3.Alignment = StringAlignment.Center;
                                            format3.LineAlignment = StringAlignment.Near;
                                            format3.Trimming = StringTrimming.Character;
                                        }
                                        else
                                        {
                                            format3.Alignment = StringAlignment.Center;
                                            format3.LineAlignment = StringAlignment.Center;
                                            format3.Trimming = StringTrimming.Character;
                                        }
                                        graphics.DrawString(str11, font3, brush3, ef6, format3);
                                    }
                                }
                            }
                        }
                    }
                Label_29C0:
                    if (obj.CardLogoLocation != "Above")
                    {
                        goto Label_478F;
                    }
                    if (!((!(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType)) & !(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType))) & (Conversions.ToDouble(obj.CompanyID) == 3.0)))
                    {
                        goto Label_369F;
                    }
                    string str13 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                    using (Image image16 = Image.FromFile(str13))
                    {
                        object obj11;
                        double num26;
                        double num27;
                        float num24 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconWidth, 1440M)), obj.ResolutionType);
                        float num23 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconHeight, 1440M)), obj.ResolutionType);
                        float num25 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType);
                        if (obj.CardLayout == "H")
                        {
                            obj11 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                        }
                        else
                        {
                            obj11 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                        }
                        RectangleF ef7 = new RectangleF(num25, Conversions.ToSingle(obj11), num24, num23);
                        if (!(image16.HorizontalResolution == 600f) | !(image16.VerticalResolution == 600f))
                        {
                            using (MemoryStream stream3 = new MemoryStream(ConvertImageToByteArray(image16)))
                            {
                                using (Image image17 = Image.FromStream(stream3))
                                {
                                    using (Image image18 = SetResolution(image17, 600))
                                    {
                                        if ((image18.Width > num24) & (image18.Height > num23))
                                        {
                                            num26 = num24 / ((float) image18.Width);
                                            num27 = num23 / ((float) image18.Height);
                                        }
                                        else if ((image18.Width > num24) & (image18.Height < num23))
                                        {
                                            num26 = num24 / ((float) image18.Width);
                                            num27 = 1.0;
                                        }
                                        else if ((image18.Width < num24) & (image18.Height > num23))
                                        {
                                            num26 = 1.0;
                                            num27 = num23 / ((float) image18.Height);
                                        }
                                        else
                                        {
                                            num26 = 1.0;
                                            num27 = 1.0;
                                        }
                                        if (!(num26 == 1.0) | !(num27 == 1.0))
                                        {
                                            ResizeImage(image18, num26, num27, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                        }
                                        if ((num26 == 1.0) & (num27 == 1.0))
                                        {
                                            using (Image image19 = image18)
                                            {
                                                rectangle = new Rectangle((int) Math.Round((double) (num25 + ((num24 - image19.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj11, (num23 - image19.Height) / 2f)), image19.Width, image19.Height);
                                                graphics.DrawImage(image19, rectangle, 0f, 0f, (float) image19.Width, (float) image19.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                        }
                                        else
                                        {
                                            using (Image image20 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                            {
                                                rectangle = new Rectangle((int) Math.Round((double) (num25 + ((num24 - image20.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj11, (num23 - image20.Height) / 2f)), image20.Width, image20.Height);
                                                graphics.DrawImage(image20, rectangle, 0f, 0f, (float) image20.Width, (float) image20.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                        }
                                    }
                                    goto Label_3329;
                                }
                            }
                        }
                        if ((image16.Width > num24) & (image16.Height > num23))
                        {
                            num26 = num24 / ((float) image16.Width);
                            num27 = num23 / ((float) image16.Height);
                        }
                        else if ((image16.Width > num24) & (image16.Height < num23))
                        {
                            num26 = num24 / ((float) image16.Width);
                            num27 = 1.0;
                        }
                        else if ((image16.Width < num24) & (image16.Height > num23))
                        {
                            num26 = 1.0;
                            num27 = num23 / ((float) image16.Height);
                        }
                        else
                        {
                            num26 = 1.0;
                            num27 = 1.0;
                        }
                        if (!(num26 == 1.0) | !(num27 == 1.0))
                        {
                            ResizeImage(image16, num26, num27, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                        }
                        if ((num26 == 1.0) & (num27 == 1.0))
                        {
                            using (Image image21 = image16)
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num25 + ((num24 - image21.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj11, (num23 - image21.Height) / 2f)), image21.Width, image21.Height);
                                graphics.DrawImage(image21, rectangle, 0f, 0f, (float) image21.Width, (float) image21.Height, GraphicsUnit.Pixel, attributes);
                            }
                        }
                        else
                        {
                            using (Image image22 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num25 + ((num24 - image22.Width) / 2f))), Conversions.ToInteger(Operators.AddObject(obj11, (num23 - image22.Height) / 2f)), image22.Width, image22.Height);
                                graphics.DrawImage(image22, rectangle, 0f, 0f, (float) image22.Width, (float) image22.Height, GraphicsUnit.Pixel, attributes);
                            }
                        }
                    }
                Label_3329:
                    if (obj.MessageShow)
                    {
                        RectangleF ef8;
                        string str14 = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj12;
                            float num28 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj12 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            ef8 = new RectangleF(num28, Conversions.ToSingle(obj12), num8, num7);
                        }
                        using (PrivateFontCollection fonts4 = new PrivateFontCollection())
                        {
                            DirectoryInfo info4 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                            string str15 = obj.MessageTypeStyle;
                            if (info4.Exists)
                            {
                                FileInfo[] infoArray10 = info4.GetFiles();
                                for (int m = 0; m < infoArray10.Length; m++)
                                {
                                    object obj13 = infoArray10[m];
                                    fonts4.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj13.ToString());
                                    if (fonts4.Families[fonts4.Families.Count<FontFamily>() - 1].Name == str15)
                                    {
                                        fonts4.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj13.ToString());
                                        break;
                                    }
                                }
                                info4 = null;
                            }
                            using (Font font4 = new Font(fonts4.Families[fonts4.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                            {
                                using (StringFormat format4 = new StringFormat())
                                {
                                    using (SolidBrush brush4 = new SolidBrush(color))
                                    {
                                        if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                        {
                                            format4.Alignment = StringAlignment.Center;
                                            format4.LineAlignment = StringAlignment.Near;
                                            format4.Trimming = StringTrimming.Character;
                                        }
                                        else
                                        {
                                            format4.Alignment = StringAlignment.Center;
                                            format4.LineAlignment = StringAlignment.Center;
                                            format4.Trimming = StringTrimming.Character;
                                        }
                                        graphics.DrawString(str14, font4, brush4, ef8, format4);
                                    }
                                }
                            }
                        }
                    }
                    goto Label_478F;
                Label_369F:
                    str16 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                    using (Image image23 = Image.FromFile(str16))
                    {
                        object obj14;
                        object obj15;
                        double num29;
                        double num30;
                        if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            obj14 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            obj15 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            obj14 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj15 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj15 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                        }
                        RectangleF ef9 = new RectangleF(Conversions.ToSingle(obj14), Conversions.ToSingle(obj15), num8, num7);
                        if (!(image23.HorizontalResolution == 600f) | !(image23.VerticalResolution == 600f))
                        {
                            using (MemoryStream stream4 = new MemoryStream(ConvertImageToByteArray(image23)))
                            {
                                using (Image image24 = Image.FromStream(stream4))
                                {
                                    using (Image image25 = SetResolution(image24, 600))
                                    {
                                        if (obj.MessageShow)
                                        {
                                            if ((image25.Width > num8) & (image25.Height > (num7 / 2f)))
                                            {
                                                num29 = num8 / ((float) image25.Width);
                                                num30 = (num7 / 2f) / ((float) image25.Height);
                                            }
                                            else if ((image25.Width > num8) & (image25.Height < (num7 / 2f)))
                                            {
                                                num29 = num8 / ((float) image25.Width);
                                                num30 = 1.0;
                                            }
                                            else if ((image25.Width < num8) & (image25.Height > (num7 / 2f)))
                                            {
                                                num29 = 1.0;
                                                num30 = (num7 / 2f) / ((float) image25.Height);
                                            }
                                            else
                                            {
                                                num29 = 1.0;
                                                num30 = 1.0;
                                            }
                                        }
                                        else if ((image25.Width > num8) & (image25.Height > num7))
                                        {
                                            num29 = num8 / ((float) image25.Width);
                                            num30 = num7 / ((float) image25.Height);
                                        }
                                        else if ((image25.Width > num8) & (image25.Height < num7))
                                        {
                                            num29 = num8 / ((float) image25.Width);
                                            num30 = 1.0;
                                        }
                                        else if ((image25.Width < num8) & (image25.Height > num7))
                                        {
                                            num29 = 1.0;
                                            num30 = num7 / ((float) image25.Height);
                                        }
                                        else
                                        {
                                            num29 = 1.0;
                                            num30 = 1.0;
                                        }
                                        if (!(num29 == 1.0) | !(num30 == 1.0))
                                        {
                                            ResizeImage(image25, num29, num30, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                        }
                                        if ((num29 == 1.0) & (num30 == 1.0))
                                        {
                                            using (Image image26 = image25)
                                            {
                                                if (!obj.MessageShow)
                                                {
                                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image26.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num7 - image26.Height) / 2f)), (int) Math.Round((double) image26.Width), (int) Math.Round((double) image26.Height));
                                                    graphics.DrawImage(image26, rectangle, 0f, 0f, (float) image26.Width, (float) image26.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                                else
                                                {
                                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image26.Width) / 2f)), Conversions.ToInteger(obj15), image26.Width, image26.Height);
                                                    graphics.DrawImage(image26, rectangle, 0f, 0f, (float) image26.Width, (float) image26.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                            }
                                            goto Label_43CD;
                                        }
                                        using (Image image27 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                        {
                                            if (!obj.MessageShow)
                                            {
                                                rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image27.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num7 - image27.Height) / 2f)), (int) Math.Round((double) image27.Width), (int) Math.Round((double) image27.Height));
                                                graphics.DrawImage(image27, rectangle, 0f, 0f, (float) image27.Width, (float) image27.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                            else
                                            {
                                                rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image27.Width) / 2f)), Conversions.ToInteger(obj15), image27.Width, image27.Height);
                                                graphics.DrawImage(image27, rectangle, 0f, 0f, (float) image27.Width, (float) image27.Height, GraphicsUnit.Pixel, attributes);
                                            }
                                            goto Label_43CD;
                                        }
                                    }
                                }
                            }
                        }
                        if (obj.MessageShow)
                        {
                            if ((image23.Width > num8) & (image23.Height > (num7 / 2f)))
                            {
                                num29 = num8 / ((float) image23.Width);
                                num30 = (num7 / 2f) / ((float) image23.Height);
                            }
                            else if ((image23.Width > num8) & (image23.Height < (num7 / 2f)))
                            {
                                num29 = num8 / ((float) image23.Width);
                                num30 = 1.0;
                            }
                            else if ((image23.Width < num8) & (image23.Height > (num7 / 2f)))
                            {
                                num29 = 1.0;
                                num30 = (num7 / 2f) / ((float) image23.Height);
                            }
                            else
                            {
                                num29 = 1.0;
                                num30 = 1.0;
                            }
                        }
                        else if ((image23.Width > num8) & (image23.Height > num7))
                        {
                            num29 = num8 / ((float) image23.Width);
                            num30 = num7 / ((float) image23.Height);
                        }
                        else if ((image23.Width > num8) & (image23.Height < num7))
                        {
                            num29 = num8 / ((float) image23.Width);
                            num30 = 1.0;
                        }
                        else if ((image23.Width < num8) & (image23.Height > num7))
                        {
                            num29 = 1.0;
                            num30 = num7 / ((float) image23.Height);
                        }
                        else
                        {
                            num29 = 1.0;
                            num30 = 1.0;
                        }
                        if (!(num29 == 1.0) | !(num30 == 1.0))
                        {
                            ResizeImage(image23, num29, num30, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                        }
                        if ((num29 == 1.0) & (num30 == 1.0))
                        {
                            using (Image image28 = image23)
                            {
                                if (!obj.MessageShow)
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image28.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num7 - image28.Height) / 2f)), (int) Math.Round((double) image28.Width), (int) Math.Round((double) image28.Height));
                                    graphics.DrawImage(image28, rectangle, 0f, 0f, (float) image28.Width, (float) image28.Height, GraphicsUnit.Pixel, attributes);
                                }
                                else
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image28.Width) / 2f)), Conversions.ToInteger(obj15), image28.Width, image28.Height);
                                    graphics.DrawImage(image28, rectangle, 0f, 0f, (float) image28.Width, (float) image28.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                        }
                        else
                        {
                            using (Image image29 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                            {
                                if (!obj.MessageShow)
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image29.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num7 - image29.Height) / 2f)), (int) Math.Round((double) image29.Width), (int) Math.Round((double) image29.Height));
                                    graphics.DrawImage(image29, rectangle, 0f, 0f, (float) image29.Width, (float) image29.Height, GraphicsUnit.Pixel, attributes);
                                }
                                else
                                {
                                    rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num8 - image29.Width) / 2f)), Conversions.ToInteger(obj15), image29.Width, image29.Height);
                                    graphics.DrawImage(image29, rectangle, 0f, 0f, (float) image29.Width, (float) image29.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                        }
                    }
                Label_43CD:
                    if (obj.MessageShow)
                    {
                        RectangleF ef10;
                        string str17 = obj.Personalize1;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj16;
                            float num31 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj16 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj16 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            ef10 = new RectangleF(num31, Conversions.ToSingle(Operators.AddObject(obj16, num7 / 2f)), num8, num7 / 2f);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            ef10 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType) + (num7 / 2f), num8, num7 / 2f);
                        }
                        using (StringFormat format5 = new StringFormat())
                        {
                            if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                            {
                                format5.Alignment = StringAlignment.Center;
                                format5.LineAlignment = StringAlignment.Near;
                                format5.Trimming = StringTrimming.Character;
                            }
                            else
                            {
                                format5.Alignment = StringAlignment.Center;
                                format5.LineAlignment = StringAlignment.Center;
                                format5.Trimming = StringTrimming.Character;
                            }
                            using (PrivateFontCollection fonts5 = new PrivateFontCollection())
                            {
                                DirectoryInfo info5 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                string str18 = obj.MessageTypeStyle;
                                if (info5.Exists)
                                {
                                    FileInfo[] infoArray11 = info5.GetFiles();
                                    for (int n = 0; n < infoArray11.Length; n++)
                                    {
                                        object obj17 = infoArray11[n];
                                        fonts5.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj17.ToString());
                                        if (fonts5.Families[fonts5.Families.Count<FontFamily>() - 1].Name == str18)
                                        {
                                            fonts5.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj17.ToString());
                                            break;
                                        }
                                    }
                                    info5 = null;
                                }
                                using (Font font5 = new Font(fonts5.Families[fonts5.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                {
                                    using (SolidBrush brush5 = new SolidBrush(color))
                                    {
                                        graphics.DrawString(str17, font5, brush5, ef10, format5);
                                    }
                                }
                            }
                        }
                    }
                Label_478F:
                    if (obj.MessageShow & !obj.LogoShow)
                    {
                        string str19 = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                        using (StringFormat format6 = new StringFormat())
                        {
                            RectangleF ef11;
                            if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                            {
                                object obj18;
                                float num32 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                if (obj.CardLayout == "H")
                                {
                                    obj18 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                }
                                else
                                {
                                    obj18 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                }
                                ef11 = new RectangleF(num32, Conversions.ToSingle(obj18), num8, num7);
                                if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                {
                                    format6.Alignment = StringAlignment.Center;
                                    format6.LineAlignment = StringAlignment.Near;
                                    format6.Trimming = StringTrimming.Character;
                                }
                                else
                                {
                                    format6.Alignment = StringAlignment.Center;
                                    format6.LineAlignment = StringAlignment.Center;
                                    format6.Trimming = StringTrimming.Character;
                                }
                            }
                            else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                            {
                                ef11 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType), num8, num7);
                                format6.Alignment = StringAlignment.Center;
                                format6.LineAlignment = StringAlignment.Near;
                                format6.Trimming = StringTrimming.Character;
                            }
                            using (PrivateFontCollection fonts6 = new PrivateFontCollection())
                            {
                                DirectoryInfo info6 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                string str20 = obj.MessageTypeStyle;
                                if (info6.Exists)
                                {
                                    FileInfo[] infoArray12 = info6.GetFiles();
                                    for (int num38 = 0; num38 < infoArray12.Length; num38++)
                                    {
                                        object obj19 = infoArray12[num38];
                                        fonts6.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj19.ToString());
                                        if (fonts6.Families[fonts6.Families.Count<FontFamily>() - 1].Name == str20)
                                        {
                                            fonts6.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj19.ToString());
                                            break;
                                        }
                                    }
                                    info6 = null;
                                }
                                using (Font font6 = new Font(fonts6.Families[fonts6.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                {
                                    using (SolidBrush brush6 = new SolidBrush(color))
                                    {
                                        graphics.DrawString(str19, font6, brush6, ef11, format6);
                                    }
                                }
                            }
                        }
                    }
                    string str5 = HttpContext.Current.Server.MapPath("~/ProofingTool/Production Files/" + str + ".tif");
                    using (EncoderParameters parameters = new EncoderParameters(2))
                    {
                        parameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 8L);
                        parameters.Param[1] = new EncoderParameter(Encoder.Compression, 2L);
                        bitmap.Save(str5, GetEncoderInfo("image/tiff"), parameters);
                    }
                    Process process = new Process();
                    Process process2 = process;
                    try
                    {
                        process2.StartInfo.FileName = HttpContext.Current.Server.MapPath("~/Bin/GetGrayScaleProof.exe");
                        process2.StartInfo.Arguments = " \"" + str5 + "\" \"" + HttpContext.Current.Server.MapPath("~/ProofingTool/Production Files/" + str3 + ".tif") + "\"";
                        process2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                        process2.StartInfo.CreateNoWindow = true;
                        process2.Start();
                        process2.WaitForExit(0xbb8);
                        process2.Kill();
                        process2.Dispose();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        process2.Kill();
                        process2.Dispose();
                        ProjectData.ClearProjectError();
                    }
                    process2 = null;
                }
            }
        }
    }
    catch (Exception exception3)
    {
        ProjectData.SetProjectError(exception3);
        Exception exception2 = exception3;
        if ((!string.IsNullOrEmpty(obj.LogoName) & !string.IsNullOrEmpty(obj.SessionID)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
        }
        GC.Collect();
        ProjectData.ClearProjectError();
    }
    finally
    {
        if ((!string.IsNullOrEmpty(obj.LogoName) & !string.IsNullOrEmpty(obj.SessionID)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
        }
    }
    return string.Format("{0}|{1}", str3, str);
}

 

 
End

public static void CreateCardLowProof(Hammond obj)
{
    try
    {
        float num7;
        float num8;
        float num9;
        float num10;
        string str = obj.CardSize.Replace("X", "x").Replace("\"", "");
        if (str.Substring(0, str.IndexOf("x") - 1).Contains("/"))
        {
            string[] strArray = str.Substring(0, str.IndexOf("x") - 1).Split(new char[] { ' ' });
            num7 = Conversions.ToSingle(strArray[0]);
            string[] strArray2 = strArray[1].Split(new char[] { '/' });
            num8 = Conversions.ToSingle(strArray2[0]) / Conversions.ToSingle(strArray2[1]);
        }
        else
        {
            num7 = Conversions.ToSingle(str.Substring(0, str.IndexOf("x") - 1).Trim());
            num8 = 0f;
        }
        if (str.Substring(str.IndexOf("x") + 2).Contains("/"))
        {
            string[] strArray3 = str.Substring(str.IndexOf("x") + 2).Split(new char[] { ' ' });
            num9 = Conversions.ToSingle(strArray3[0]);
            string[] strArray4 = strArray3[1].Split(new char[] { '/' });
            num10 = Conversions.ToSingle(strArray4[0]) / Conversions.ToSingle(strArray4[1]);
        }
        else
        {
            num9 = Conversions.ToSingle(str.Substring(str.IndexOf("x") + 2).Trim());
            num10 = 0f;
        }
        int width = (int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle((float) ((num7 + num8) * 1440f)), obj.ResolutionType));
        int height = (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle((float) ((num9 + num10) * 1440f)), obj.ResolutionType));
        float num6 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseWidth, 1440M)), obj.ResolutionType);
        float num5 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseHeight, 1440M)), obj.ResolutionType);
        float num4 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextWidth, 1440M)), obj.ResolutionType);
        float num3 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextHeight, 1440M)), obj.ResolutionType);
        using (Bitmap bitmap = new Bitmap(width, height))
        {
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                Rectangle rectangle;
                Color color = Color.FromName(obj.ImprintInk);
                graphics.Clear(Color.White);
                graphics.SmoothingMode = SmoothingMode.HighQuality;
                graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                if (obj.VerseType == "Standard")
                {
                    ChangeImageColor(obj);
                    using (Image image = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif")))
                    {
                        float num11;
                        float num12;
                        RectangleF ef;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            num11 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                num12 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                num12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                            }
                            ef = new RectangleF(num11, num12, num6, num5);
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            rectangle = new Rectangle((int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType)), (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType)), (int) Math.Round((double) num6), (int) Math.Round((double) num5));
                            ef = rectangle;
                            num11 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                            num12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                        }
                        if ((Conversions.ToString(obj.VerseAlignmentX) == "T") & (Conversions.ToString(obj.VerseAlignmentY) == "C"))
                        {
                            graphics.DrawImage(image, num11 + ((num6 - image.Width) / 2f), num12, (float) image.Width, (float) image.Height);
                        }
                        else
                        {
                            graphics.DrawImage(image, num11 + ((num6 - image.Width) / 2f), num12 + ((num5 - image.Height) / 2f), (float) image.Width, (float) image.Height);
                        }
                    }
                }
                else if (obj.VerseType == "Custom")
                {
                    RectangleF ef2;
                    if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                    {
                        object obj2;
                        float x = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType);
                        if (obj.CardLayout == "H")
                        {
                            obj2 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                        }
                        else
                        {
                            obj2 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType);
                        }
                        ef2 = new RectangleF(x, Conversions.ToSingle(obj2), num6, num5);
                    }
                    else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                    {
                        rectangle = new Rectangle((int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.VerseLeft, 1440M)), obj.ResolutionType)), (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.VerseTop, 1440M)), obj.ResolutionType)), (int) Math.Round((double) num6), (int) Math.Round((double) num5));
                        ef2 = rectangle;
                    }
                    string typeStyle = obj.TypeStyle;
                    using (PrivateFontCollection fonts = new PrivateFontCollection())
                    {
                        DirectoryInfo info = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                        if (info.Exists)
                        {
                            FileInfo[] files = info.GetFiles();
                            for (int i = 0; i < files.Length; i++)
                            {
                                object obj3 = files[i];
                                fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj3.ToString());
                                if (fonts.Families[fonts.Families.Count<FontFamily>() - 1].Name == typeStyle)
                                {
                                    fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj3.ToString());
                                    break;
                                }
                            }
                            info = null;
                        }
                        using (Font font = new Font(fonts.Families[fonts.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.VerseFontSize)))
                        {
                            using (SolidBrush brush = new SolidBrush(color))
                            {
                                using (StringFormat format = new StringFormat())
                                {
                                    if ((Conversions.ToString(obj.VerseAlignmentX) == "T") & (Conversions.ToString(obj.VerseAlignmentY) == "C"))
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Near;
                                        format.Trimming = StringTrimming.Character;
                                        graphics.DrawString(obj.CustomVerseText, font, brush, ef2, format);
                                    }
                                    else
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Center;
                                        format.Trimming = StringTrimming.Character;
                                        graphics.DrawString(obj.CustomVerseText, font, brush, ef2, format);
                                    }
                                }
                            }
                        }
                    }
                }
                if (obj.LogoShow)
                {
                    if (obj.CardLogoLocation == "Below")
                    {
                        if ((!(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType)) & !(TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType) == TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType))) & (Conversions.ToDouble(obj.CompanyID) == 3.0))
                        {
                            string str4 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                            using (Image image2 = Image.FromFile(str4))
                            {
                                object obj4;
                                double num17;
                                double num18;
                                float num15 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconWidth, 1440M)), obj.ResolutionType);
                                float num14 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconHeight, 1440M)), obj.ResolutionType);
                                float num16 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType);
                                if (obj.CardLayout == "H")
                                {
                                    obj4 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                                }
                                else
                                {
                                    obj4 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                                }
                                RectangleF ef3 = new RectangleF(num16, Conversions.ToSingle(obj4), num15, num14);
                                if ((image2.Width > num15) & (image2.Height > num14))
                                {
                                    num17 = num15 / ((float) image2.Width);
                                    num18 = num14 / ((float) image2.Height);
                                }
                                else if ((image2.Width > num15) & (image2.Height < num14))
                                {
                                    num17 = num15 / ((float) image2.Width);
                                    num18 = 1.0;
                                }
                                else if ((image2.Width < num15) & (image2.Height > num14))
                                {
                                    num17 = 1.0;
                                    num18 = num14 / ((float) image2.Height);
                                }
                                else
                                {
                                    num17 = 1.0;
                                    num18 = 1.0;
                                }
                                if (!(num17 == 1.0) | !(num18 == 1.0))
                                {
                                    ResizeImage(image2, num17, num18, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                }
                                if ((num17 == 1.0) & (num18 == 1.0))
                                {
                                    using (Image image3 = image2)
                                    {
                                        graphics.DrawImage(image3, num16 + ((num15 - image3.Width) / 2f), Conversions.ToSingle(Operators.AddObject(obj4, (num14 - image3.Height) / 2f)), (float) image3.Width, (float) image3.Height);
                                    }
                                }
                                else
                                {
                                    using (Image image4 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                    {
                                        graphics.DrawImage(image4, num16 + ((num15 - image4.Width) / 2f), Conversions.ToSingle(Operators.AddObject(obj4, (num14 - image4.Height) / 2f)), (float) image4.Width, (float) image4.Height);
                                    }
                                }
                            }
                            if (obj.MessageShow)
                            {
                                RectangleF ef4;
                                string s = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                                if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    object obj5;
                                    float num19 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj5 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj5 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    ef4 = new RectangleF(num19, Conversions.ToSingle(obj5), num4, num3);
                                }
                                if (obj.MessageShow)
                                {
                                    using (SolidBrush brush2 = new SolidBrush(color))
                                    {
                                        using (StringFormat format2 = new StringFormat())
                                        {
                                            if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                            {
                                                format2.Alignment = StringAlignment.Center;
                                                format2.LineAlignment = StringAlignment.Near;
                                                format2.Trimming = StringTrimming.Character;
                                            }
                                            else
                                            {
                                                format2.Alignment = StringAlignment.Center;
                                                format2.LineAlignment = StringAlignment.Center;
                                                format2.Trimming = StringTrimming.Character;
                                            }
                                            using (PrivateFontCollection fonts2 = new PrivateFontCollection())
                                            {
                                                DirectoryInfo info2 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                                string messageTypeStyle = obj.MessageTypeStyle;
                                                if (info2.Exists)
                                                {
                                                    FileInfo[] infoArray8 = info2.GetFiles();
                                                    for (int j = 0; j < infoArray8.Length; j++)
                                                    {
                                                        object obj6 = infoArray8[j];
                                                        fonts2.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj6.ToString());
                                                        if (fonts2.Families[fonts2.Families.Count<FontFamily>() - 1].Name == messageTypeStyle)
                                                        {
                                                            fonts2.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj6.ToString());
                                                            break;
                                                        }
                                                    }
                                                    info2 = null;
                                                }
                                                using (Font font2 = new Font(fonts2.Families[fonts2.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                                {
                                                    graphics.DrawString(s, font2, brush2, ef4, format2);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            string str7 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                            using (Image image5 = Image.FromFile(str7))
                            {
                                object obj7;
                                object obj8;
                                double num20;
                                double num21;
                                if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                                {
                                    obj7 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    obj8 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                }
                                else if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    obj7 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj8 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj8 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                }
                                RectangleF ef5 = new RectangleF(Conversions.ToSingle(obj7), Conversions.ToSingle(obj8), num4, num3);
                                if (obj.MessageShow)
                                {
                                    if ((image5.Width > num4) & (image5.Height > (num3 / 2f)))
                                    {
                                        num20 = num4 / ((float) image5.Width);
                                        num21 = (num3 / 2f) / ((float) image5.Height);
                                    }
                                    else if ((image5.Width > num4) & (image5.Height < (num3 / 2f)))
                                    {
                                        num20 = num4 / ((float) image5.Width);
                                        num21 = 1.0;
                                    }
                                    else if ((image5.Width < num4) & (image5.Height > (num3 / 2f)))
                                    {
                                        num20 = 1.0;
                                        num21 = (num3 / 2f) / ((float) image5.Height);
                                    }
                                    else
                                    {
                                        num20 = 1.0;
                                        num21 = 1.0;
                                    }
                                }
                                else if ((image5.Width > num4) & (image5.Height > num3))
                                {
                                    num20 = num4 / ((float) image5.Width);
                                    num21 = num3 / ((float) image5.Height);
                                }
                                else if ((image5.Width > num4) & (image5.Height < num3))
                                {
                                    num20 = num4 / ((float) image5.Width);
                                    num21 = 1.0;
                                }
                                else if ((image5.Width < num4) & (image5.Height > num3))
                                {
                                    num20 = 1.0;
                                    num21 = num3 / ((float) image5.Height);
                                }
                                else
                                {
                                    num20 = 1.0;
                                    num21 = 1.0;
                                }
                                if (!(num20 == 1.0) | !(num21 == 1.0))
                                {
                                    ResizeImage(image5, num20, num21, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                }
                                if ((num20 == 1.0) & (num21 == 1.0))
                                {
                                    using (Image image6 = image5)
                                    {
                                        if (!obj.MessageShow)
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num4 - image6.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num3 - image6.Height) / 2f)), (int) Math.Round((double) image6.Width), (int) Math.Round((double) image6.Height));
                                            graphics.DrawImage(image6, rectangle);
                                        }
                                        else
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num4 - image6.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num3 / 2f)), image6.Width, image6.Height);
                                            graphics.DrawImage(image6, rectangle);
                                        }
                                    }
                                }
                                else
                                {
                                    using (Image image7 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                    {
                                        if (!obj.MessageShow)
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num4 - image7.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, (num3 - image7.Height) / 2f)), (int) Math.Round((double) image7.Width), (int) Math.Round((double) image7.Height));
                                            graphics.DrawImage(image7, rectangle);
                                        }
                                        else
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj7, (num4 - image7.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj8, num3 / 2f)), image7.Width, image7.Height);
                                            graphics.DrawImage(image7, rectangle);
                                        }
                                    }
                                }
                            }
                            if (obj.MessageShow)
                            {
                                RectangleF ef6;
                                string str9 = obj.Personalize1;
                                if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    object obj9;
                                    float num22 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj9 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj9 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    ef6 = new RectangleF(num22, Conversions.ToSingle(obj9), num4, num3 / 2f);
                                }
                                else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                                {
                                    ef6 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType), num4, num3 / 2f);
                                }
                                DirectoryInfo info3 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                string str8 = obj.MessageTypeStyle;
                                using (PrivateFontCollection fonts3 = new PrivateFontCollection())
                                {
                                    if (info3.Exists)
                                    {
                                        FileInfo[] infoArray9 = info3.GetFiles();
                                        for (int k = 0; k < infoArray9.Length; k++)
                                        {
                                            object obj10 = infoArray9[k];
                                            fonts3.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj10.ToString());
                                            if (fonts3.Families[fonts3.Families.Count<FontFamily>() - 1].Name == str8)
                                            {
                                                fonts3.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj10.ToString());
                                                break;
                                            }
                                        }
                                        info3 = null;
                                    }
                                    using (Font font3 = new Font(fonts3.Families[fonts3.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                    {
                                        using (SolidBrush brush3 = new SolidBrush(color))
                                        {
                                            using (StringFormat format3 = new StringFormat())
                                            {
                                                if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                                {
                                                    format3.Alignment = StringAlignment.Center;
                                                    format3.LineAlignment = StringAlignment.Near;
                                                    format3.Trimming = StringTrimming.Character;
                                                }
                                                else
                                                {
                                                    format3.Alignment = StringAlignment.Center;
                                                    format3.LineAlignment = StringAlignment.Center;
                                                    format3.Trimming = StringTrimming.Character;
                                                }
                                                graphics.DrawString(str9, font3, brush3, ef6, format3);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (obj.CardLogoLocation == "Above")
                    {
                        if ((!(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType)) & !(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType) == TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType))) & (Conversions.ToDouble(obj.CompanyID) == 3.0))
                        {
                            string str10 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                            using (Image image8 = Image.FromFile(str10))
                            {
                                object obj11;
                                double num26;
                                double num27;
                                float num24 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconWidth, 1440M)), obj.ResolutionType);
                                float num23 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconHeight, 1440M)), obj.ResolutionType);
                                float num25 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.IconLeft, 1440M)), obj.ResolutionType);
                                if (obj.CardLayout == "H")
                                {
                                    obj11 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                                }
                                else
                                {
                                    obj11 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.IconTop, 1440M)), obj.ResolutionType);
                                }
                                RectangleF ef7 = new RectangleF(num25, Conversions.ToSingle(obj11), num24, num23);
                                if ((image8.Width > num24) & (image8.Height > num23))
                                {
                                    num26 = num24 / ((float) image8.Width);
                                    num27 = num23 / ((float) image8.Height);
                                }
                                else if ((image8.Width > num24) & (image8.Height < num23))
                                {
                                    num26 = num24 / ((float) image8.Width);
                                    num27 = 1.0;
                                }
                                else if ((image8.Width < num24) & (image8.Height > num23))
                                {
                                    num26 = 1.0;
                                    num27 = num23 / ((float) image8.Height);
                                }
                                else
                                {
                                    num26 = 1.0;
                                    num27 = 1.0;
                                }
                                if (!(num26 == 1.0) | !(num27 == 1.0))
                                {
                                    ResizeImage(image8, num26, num27, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                }
                                if ((num26 == 1.0) & (num27 == 1.0))
                                {
                                    using (Image image9 = image8)
                                    {
                                        graphics.DrawImage(image9, num25 + ((num24 - image9.Width) / 2f), Conversions.ToSingle(Operators.AddObject(obj11, (num23 - image9.Height) / 2f)), (float) image9.Width, (float) image9.Height);
                                    }
                                }
                                else
                                {
                                    using (Image image10 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                    {
                                        graphics.DrawImage(image10, num25 + ((num24 - image10.Width) / 2f), Conversions.ToSingle(Operators.AddObject(obj11, (num23 - image10.Height) / 2f)), (float) image10.Width, (float) image10.Height);
                                    }
                                }
                            }
                            if (obj.MessageShow)
                            {
                                RectangleF ef8;
                                string str12 = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                                if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    object obj12;
                                    float num28 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj12 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj12 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    ef8 = new RectangleF(num28, Conversions.ToSingle(obj12), num4, num3);
                                }
                                DirectoryInfo info4 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                string str11 = obj.MessageTypeStyle;
                                using (PrivateFontCollection fonts4 = new PrivateFontCollection())
                                {
                                    if (info4.Exists)
                                    {
                                        FileInfo[] infoArray10 = info4.GetFiles();
                                        for (int m = 0; m < infoArray10.Length; m++)
                                        {
                                            object obj13 = infoArray10[m];
                                            fonts4.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj13.ToString());
                                            if (fonts4.Families[fonts4.Families.Count<FontFamily>() - 1].Name == str11)
                                            {
                                                fonts4.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj13.ToString());
                                                break;
                                            }
                                        }
                                        info4 = null;
                                    }
                                    using (Font font4 = new Font(fonts4.Families[fonts4.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                    {
                                        using (StringFormat format4 = new StringFormat())
                                        {
                                            using (SolidBrush brush4 = new SolidBrush(color))
                                            {
                                                if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                                {
                                                    format4.Alignment = StringAlignment.Center;
                                                    format4.LineAlignment = StringAlignment.Near;
                                                    format4.Trimming = StringTrimming.Character;
                                                }
                                                else
                                                {
                                                    format4.Alignment = StringAlignment.Center;
                                                    format4.LineAlignment = StringAlignment.Center;
                                                    format4.Trimming = StringTrimming.Character;
                                                }
                                                graphics.DrawString(str12, font4, brush4, ef8, format4);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            string str13 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Card/" + obj.LogoName);
                            using (Image image11 = Image.FromFile(str13))
                            {
                                object obj14;
                                object obj15;
                                double num29;
                                double num30;
                                if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                                {
                                    obj14 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    obj15 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                }
                                else if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    obj14 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj15 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj15 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                }
                                RectangleF ef9 = new RectangleF(Conversions.ToSingle(obj14), Conversions.ToSingle(obj15), num4, num3);
                                if (obj.MessageShow)
                                {
                                    if ((image11.Width > num4) & (image11.Height > (num3 / 2f)))
                                    {
                                        num29 = num4 / ((float) image11.Width);
                                        num30 = (num3 / 2f) / ((float) image11.Height);
                                    }
                                    else if ((image11.Width > num4) & (image11.Height < (num3 / 2f)))
                                    {
                                        num29 = num4 / ((float) image11.Width);
                                        num30 = 1.0;
                                    }
                                    else if ((image11.Width < num4) & (image11.Height > (num3 / 2f)))
                                    {
                                        num29 = 1.0;
                                        num30 = (num3 / 2f) / ((float) image11.Height);
                                    }
                                    else
                                    {
                                        num29 = 1.0;
                                        num30 = 1.0;
                                    }
                                }
                                else if ((image11.Width > num4) & (image11.Height > num3))
                                {
                                    num29 = num4 / ((float) image11.Width);
                                    num30 = num3 / ((float) image11.Height);
                                }
                                else if ((image11.Width > num4) & (image11.Height < num3))
                                {
                                    num29 = num4 / ((float) image11.Width);
                                    num30 = 1.0;
                                }
                                else if ((image11.Width < num4) & (image11.Height > num3))
                                {
                                    num29 = 1.0;
                                    num30 = num3 / ((float) image11.Height);
                                }
                                else
                                {
                                    num29 = 1.0;
                                    num30 = 1.0;
                                }
                                if (!(num29 == 1.0) | !(num30 == 1.0))
                                {
                                    ResizeImage(image11, num29, num30, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
                                }
                                if ((num29 == 1.0) & (num30 == 1.0))
                                {
                                    using (Image image12 = image11)
                                    {
                                        if (!obj.MessageShow)
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num4 - image12.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num3 - image12.Height) / 2f)), (int) Math.Round((double) image12.Width), (int) Math.Round((double) image12.Height));
                                            graphics.DrawImage(image12, rectangle);
                                        }
                                        else
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num4 - image12.Width) / 2f)), Conversions.ToInteger(obj15), image12.Width, image12.Height);
                                            graphics.DrawImage(image12, rectangle);
                                        }
                                    }
                                }
                                else
                                {
                                    using (Image image13 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
                                    {
                                        if (!obj.MessageShow)
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num4 - image13.Width) / 2f)), Conversions.ToInteger(Operators.AddObject(obj15, (num3 - image13.Height) / 2f)), (int) Math.Round((double) image13.Width), (int) Math.Round((double) image13.Height));
                                            graphics.DrawImage(image13, rectangle);
                                        }
                                        else
                                        {
                                            rectangle = new Rectangle(Conversions.ToInteger(Operators.AddObject(obj14, (num4 - image13.Width) / 2f)), Conversions.ToInteger(obj15), image13.Width, image13.Height);
                                            graphics.DrawImage(image13, rectangle);
                                        }
                                    }
                                }
                            }
                            if (obj.MessageShow)
                            {
                                RectangleF ef10;
                                string str14 = obj.Personalize1;
                                if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                                {
                                    object obj16;
                                    float num31 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                                    if (obj.CardLayout == "H")
                                    {
                                        obj16 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    else
                                    {
                                        obj16 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                                    }
                                    ef10 = new RectangleF(num31, Conversions.ToSingle(Operators.AddObject(obj16, num3 / 2f)), num4, num3 / 2f);
                                }
                                else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                                {
                                    ef10 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType) + (num3 / 2f), num4, num3 / 2f);
                                }
                                using (StringFormat format5 = new StringFormat())
                                {
                                    if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                                    {
                                        format5.Alignment = StringAlignment.Center;
                                        format5.LineAlignment = StringAlignment.Near;
                                        format5.Trimming = StringTrimming.Character;
                                    }
                                    else
                                    {
                                        format5.Alignment = StringAlignment.Center;
                                        format5.LineAlignment = StringAlignment.Center;
                                        format5.Trimming = StringTrimming.Character;
                                    }
                                    DirectoryInfo info5 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                                    string str15 = obj.MessageTypeStyle;
                                    using (PrivateFontCollection fonts5 = new PrivateFontCollection())
                                    {
                                        if (info5.Exists)
                                        {
                                            FileInfo[] infoArray11 = info5.GetFiles();
                                            for (int n = 0; n < infoArray11.Length; n++)
                                            {
                                                object obj17 = infoArray11[n];
                                                fonts5.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj17.ToString());
                                                if (fonts5.Families[fonts5.Families.Count<FontFamily>() - 1].Name == str15)
                                                {
                                                    fonts5.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj17.ToString());
                                                    break;
                                                }
                                            }
                                            info5 = null;
                                        }
                                        using (Font font5 = new Font(fonts5.Families[fonts5.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                                        {
                                            using (SolidBrush brush5 = new SolidBrush(color))
                                            {
                                                graphics.DrawString(str14, font5, brush5, ef10, format5);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (obj.MessageShow & !obj.LogoShow)
                {
                    using (StringFormat format6 = new StringFormat())
                    {
                        RectangleF ef11;
                        string str16 = obj.Personalize1 + Environment.NewLine + obj.Personalize2 + Environment.NewLine + obj.Personalize3 + Environment.NewLine + obj.Personalize4;
                        if (Conversions.ToDouble(obj.CompanyID) == 3.0)
                        {
                            object obj18;
                            float num32 = width - TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType);
                            if (obj.CardLayout == "H")
                            {
                                obj18 = height - TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            else
                            {
                                obj18 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType);
                            }
                            ef11 = new RectangleF(num32, Conversions.ToSingle(obj18), num4, num3);
                            if ((Conversions.ToString(obj.TextAlignmentX) == "T") & (Conversions.ToString(obj.TextAlignmentY) == "C"))
                            {
                                format6.Alignment = StringAlignment.Center;
                                format6.LineAlignment = StringAlignment.Near;
                                format6.Trimming = StringTrimming.Character;
                            }
                            else
                            {
                                format6.Alignment = StringAlignment.Center;
                                format6.LineAlignment = StringAlignment.Center;
                                format6.Trimming = StringTrimming.Character;
                            }
                        }
                        else if (Conversions.ToDouble(obj.CompanyID) == 2.0)
                        {
                            ef11 = new RectangleF(TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.TextLeft, 1440M)), obj.ResolutionType), TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.TextTop, 1440M)), obj.ResolutionType), num4, num3);
                            format6.Alignment = StringAlignment.Center;
                            format6.LineAlignment = StringAlignment.Near;
                        }
                        using (PrivateFontCollection fonts6 = new PrivateFontCollection())
                        {
                            DirectoryInfo info6 = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                            string str17 = obj.MessageTypeStyle;
                            if (info6.Exists)
                            {
                                FileInfo[] infoArray12 = info6.GetFiles();
                                for (int num38 = 0; num38 < infoArray12.Length; num38++)
                                {
                                    object obj19 = infoArray12[num38];
                                    fonts6.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj19.ToString());
                                    if (fonts6.Families[fonts6.Families.Count<FontFamily>() - 1].Name == str17)
                                    {
                                        fonts6.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + obj19.ToString());
                                        break;
                                    }
                                }
                                info6 = null;
                            }
                            using (Font font6 = new Font(fonts6.Families[fonts6.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.MessageFontSize)))
                            {
                                using (SolidBrush brush6 = new SolidBrush(color))
                                {
                                    graphics.DrawString(str16, font6, brush6, ef11, format6);
                                }
                            }
                        }
                    }
                }
                string filename = HttpContext.Current.Server.MapPath("~/ProofingTool/Low Resolution Images/" + obj.SessionID + "_Card.gif");
                bitmap.Save(filename, ImageFormat.Gif);
            }
        }
    }
    catch (Exception exception1)
    {
        ProjectData.SetProjectError(exception1);
        Exception exception = exception1;
        if (!string.IsNullOrEmpty(obj.SessionID) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif"));
        }
        if ((!string.IsNullOrEmpty(obj.LogoName) & !string.IsNullOrEmpty(obj.SessionID)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
        }
        ProjectData.ClearProjectError();
    }
    finally
    {
        if (!string.IsNullOrEmpty(obj.SessionID) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_verse.tif"));
        }
        if ((!string.IsNullOrEmpty(obj.LogoName) & !string.IsNullOrEmpty(obj.SessionID)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.LogoName.Substring(0, obj.LogoName.LastIndexOf(".")) + "Scaled.tif"));
        }
    }
}

 

 
End 


public static string CreateEnvelopeHighProof(Hammond obj)
{
    string str2 = Guid.NewGuid().ToString();
    string str3 = Guid.NewGuid().ToString();
    try
    {
        int width = (int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeWidth, 1440M)), obj.ResolutionType));
        int height = (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeHeight, 1440M)), obj.ResolutionType));
        using (Bitmap bitmap = new Bitmap(width, height))
        {
            if (Conversions.ToDouble(obj.CompanyID) == 3.0)
            {
                bitmap.SetResolution(600f, 600f);
            }
            else if (true)
            {
                bitmap.SetResolution(600f, 600f);
            }
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                string str4;
                graphics.Clear(Color.White);
                graphics.CompositingQuality = CompositingQuality.HighSpeed;
                graphics.SmoothingMode = SmoothingMode.HighQuality;
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                Color color = Color.FromName("Black");
                if (obj.EnvelopeImprintShow)
                {
                    using (SolidBrush brush = new SolidBrush(color))
                    {
                        using (PrivateFontCollection fonts = new PrivateFontCollection())
                        {
                            DirectoryInfo info = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                            string envelopeTypeStyle = obj.EnvelopeTypeStyle;
                            if (info.Exists)
                            {
                                FileInfo[] files = info.GetFiles();
                                for (int i = 0; i < files.Length; i++)
                                {
                                    fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + files[i].ToString());
                                    if (fonts.Families[fonts.Families.Count<FontFamily>() - 1].Name == envelopeTypeStyle)
                                    {
                                        break;
                                    }
                                }
                                info = null;
                            }
                            using (Font font = new Font(fonts.Families[fonts.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.EnvelopeFontSize)))
                            {
                                string s = obj.EnvelopePersonalize1 + Environment.NewLine + obj.EnvelopePersonalize2 + Environment.NewLine + obj.EnvelopePersonalize3 + Environment.NewLine + obj.EnvelopePersonalize4;
                                float x = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintLeft, 1440M)), obj.ResolutionType);
                                float y = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintTop, 1440M)), obj.ResolutionType);
                                float num4 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintWidth, 1440M)), obj.ResolutionType);
                                float num3 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintHeight, 1440M)), obj.ResolutionType);
                                using (StringFormat format = new StringFormat())
                                {
                                    if ((Conversions.ToString(obj.EnvelopeImprintAlignmentX) == "T") & (Conversions.ToString(obj.EnvelopeImprintAlignmentY) == "C"))
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Near;
                                        format.Trimming = StringTrimming.Character;
                                    }
                                    else
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Center;
                                        format.Trimming = StringTrimming.Character;
                                    }
                                    if (obj.EnvelopeLogoShow)
                                    {
                                        RectangleF layoutRectangle = new RectangleF(x, y + num3, num4, num3);
                                        graphics.DrawString(s, font, brush, layoutRectangle, format);
                                    }
                                    else
                                    {
                                        RectangleF ef2 = new RectangleF(x, y, num4, num3);
                                        graphics.DrawString(s, font, brush, ef2, format);
                                    }
                                }
                            }
                        }
                    }
                }
                if (obj.EnvelopeLogoShow)
                {
                    ColorMatrix newColorMatrix = new ColorMatrix(new float[][] { new float[] { 0.299f, 0.299f, 0.299f, 0f, 0f }, new float[] { 0.587f, 0.587f, 0.587f, 0f, 0f }, new float[] { 0.114f, 0.114f, 0.114f, 0f, 0f }, new float[] { 0f, 0f, 0f, 1f, 0f }, new float[] { 0f, 0f, 0f, 0f, 1f } }) {
                        Matrix33 = 1f
                    };
                    using (ImageAttributes attributes = new ImageAttributes())
                    {
                        attributes.SetColorMatrix(newColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
                        string filename = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Envelope/" + obj.EnvelopeLogoName);
                        using (Image image = Image.FromFile(filename))
                        {
                            double num11;
                            double num12;
                            Rectangle rectangle;
                            float num9 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintLeft, 1440M)), obj.ResolutionType);
                            float num10 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintTop, 1440M)), obj.ResolutionType);
                            float num8 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintWidth, 1440M)), obj.ResolutionType);
                            float num7 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintHeight, 1440M)), obj.ResolutionType);
                            if (!(image.HorizontalResolution == 600f) | !(image.VerticalResolution == 600f))
                            {
                                using (MemoryStream stream = new MemoryStream(ConvertImageToByteArray(image)))
                                {
                                    using (Image image2 = Image.FromStream(stream))
                                    {
                                        using (Image image3 = SetResolution(image2, 600))
                                        {
                                            if ((image3.Width > num8) & (image3.Height > num7))
                                            {
                                                num11 = num8 / ((float) image3.Width);
                                                num12 = num7 / ((float) image3.Height);
                                            }
                                            else if ((image3.Width > num8) & (image3.Height < num7))
                                            {
                                                num11 = num8 / ((float) image3.Width);
                                                num12 = 1.0;
                                            }
                                            else if ((image3.Width < num8) & (image3.Height > num7))
                                            {
                                                num11 = 1.0;
                                                num12 = num7 / ((float) image3.Height);
                                            }
                                            else
                                            {
                                                num11 = 1.0;
                                                num12 = 1.0;
                                            }
                                            if (!(num11 == 1.0) | !(num12 == 1.0))
                                            {
                                                ResizeImage(image3, num11, num12, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
                                            }
                                            if ((num11 == 1.0) & (num12 == 1.0))
                                            {
                                                using (Image image4 = image3)
                                                {
                                                    rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image4.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image4.Height) / 2f))), (int) Math.Round((double) image4.Width), (int) Math.Round((double) image4.Height));
                                                    graphics.DrawImage(image4, rectangle, 0f, 0f, (float) image4.Width, (float) image4.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                            }
                                            else
                                            {
                                                using (Image image5 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
                                                {
                                                    rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image5.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image5.Height) / 2f))), (int) Math.Round((double) image5.Width), (int) Math.Round((double) image5.Height));
                                                    graphics.DrawImage(image5, rectangle, 0f, 0f, (float) image5.Width, (float) image5.Height, GraphicsUnit.Pixel, attributes);
                                                }
                                            }
                                        }
                                        goto Label_0E3C;
                                    }
                                }
                            }
                            if ((image.Width > num8) & (image.Height > num7))
                            {
                                num11 = num8 / ((float) image.Width);
                                num12 = num7 / ((float) image.Height);
                            }
                            else if ((image.Width > num8) & (image.Height < num7))
                            {
                                num11 = num8 / ((float) image.Width);
                                num12 = 1.0;
                            }
                            else if ((image.Width < num8) & (image.Height > num7))
                            {
                                num11 = 1.0;
                                num12 = num7 / ((float) image.Height);
                            }
                            else
                            {
                                num11 = 1.0;
                                num12 = 1.0;
                            }
                            if (!(num11 == 1.0) | !(num12 == 1.0))
                            {
                                ResizeImage(image, num11, num12, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
                            }
                            if ((num11 == 1.0) & (num12 == 1.0))
                            {
                                using (Image image6 = image)
                                {
                                    rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image6.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image6.Height) / 2f))), (int) Math.Round((double) image6.Width), (int) Math.Round((double) image6.Height));
                                    graphics.DrawImage(image6, rectangle, 0f, 0f, (float) image6.Width, (float) image6.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                            else
                            {
                                using (Image image7 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
                                {
                                    rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image7.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image7.Height) / 2f))), (int) Math.Round((double) image7.Width), (int) Math.Round((double) image7.Height));
                                    graphics.DrawImage(image7, rectangle, 0f, 0f, (float) image7.Width, (float) image7.Height, GraphicsUnit.Pixel, attributes);
                                }
                            }
                        }
                    }
                }
            Label_0E3C:
                str4 = HttpContext.Current.Server.MapPath("~/ProofingTool/Production Files/" + str2 + ".tif");
                using (EncoderParameters parameters = new EncoderParameters(2))
                {
                    parameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 8L);
                    parameters.Param[1] = new EncoderParameter(Encoder.Compression, 2L);
                    bitmap.Save(str4, GetEncoderInfo("image/tiff"), parameters);
                }
                Process process = new Process();
                Process process2 = process;
                try
                {
                    process2.StartInfo.FileName = HttpContext.Current.Server.MapPath("~/Bin/GetGrayScaleProof.exe");
                    process2.StartInfo.Arguments = " \"" + str4 + "\" \"" + HttpContext.Current.Server.MapPath("~/ProofingTool/Production Files/" + str3 + ".tif") + "\"";
                    process2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    process2.StartInfo.CreateNoWindow = true;
                    process2.Start();
                    process2.WaitForExit(0xbb8);
                    process2.Kill();
                    process2.Dispose();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    process2.Kill();
                    process2.Dispose();
                    ProjectData.ClearProjectError();
                }
                process2 = null;
            }
        }
    }
    catch (Exception exception2)
    {
        ProjectData.SetProjectError(exception2);
        if ((!string.IsNullOrEmpty(obj.SessionID) & !string.IsNullOrEmpty(obj.EnvelopeLogoName)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
        }
        GC.Collect();
        ProjectData.ClearProjectError();
    }
    finally
    {
        if ((!string.IsNullOrEmpty(obj.SessionID) & !string.IsNullOrEmpty(obj.EnvelopeLogoName)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
        }
    }
    return string.Format("{0}|{1}", str3, str2);
}


End


public static void CreateEnvelopeLowProof(Hammond obj)
{
    try
    {
        int width = (int) Math.Round((double) TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeWidth, 1440M)), obj.ResolutionType));
        int height = (int) Math.Round((double) TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeHeight, 1440M)), obj.ResolutionType));
        using (Bitmap bitmap = new Bitmap(width, height))
        {
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.Clear(Color.White);
                graphics.CompositingQuality = CompositingQuality.HighSpeed;
                graphics.SmoothingMode = SmoothingMode.HighQuality;
                graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
                if (obj.EnvelopeImprintShow)
                {
                    Color color = Color.FromName(obj.EnvelopeImprintInk);
                    using (SolidBrush brush = new SolidBrush(color))
                    {
                        DirectoryInfo info = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/"));
                        string envelopeTypeStyle = obj.EnvelopeTypeStyle;
                        using (PrivateFontCollection fonts = new PrivateFontCollection())
                        {
                            if (info.Exists)
                            {
                                FileInfo[] files = info.GetFiles();
                                for (int i = 0; i < files.Length; i++)
                                {
                                    fonts.AddFontFile(HttpContext.Current.Server.MapPath("~/ProofingTool/CustomFonts/") + files[i].ToString());
                                    if (fonts.Families[fonts.Families.Count<FontFamily>() - 1].Name == envelopeTypeStyle)
                                    {
                                        break;
                                    }
                                }
                                info = null;
                            }
                            using (Font font = new Font(fonts.Families[fonts.Families.Count<FontFamily>() - 1], Convert.ToSingle(obj.EnvelopeFontSize)))
                            {
                                string s = obj.EnvelopePersonalize1 + Environment.NewLine + obj.EnvelopePersonalize2 + Environment.NewLine + obj.EnvelopePersonalize3 + Environment.NewLine + obj.EnvelopePersonalize4;
                                float x = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintLeft, 1440M)), obj.ResolutionType);
                                float y = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintTop, 1440M)), obj.ResolutionType);
                                float num4 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintWidth, 1440M)), obj.ResolutionType);
                                float num3 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintHeight, 1440M)), obj.ResolutionType);
                                using (StringFormat format = new StringFormat())
                                {
                                    if ((Conversions.ToString(obj.EnvelopeImprintAlignmentX) == "T") & (Conversions.ToString(obj.EnvelopeImprintAlignmentY) == "C"))
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Near;
                                        format.Trimming = StringTrimming.Character;
                                    }
                                    else
                                    {
                                        format.Alignment = StringAlignment.Center;
                                        format.LineAlignment = StringAlignment.Center;
                                        format.Trimming = StringTrimming.Character;
                                    }
                                    if (obj.EnvelopeLogoShow)
                                    {
                                        RectangleF layoutRectangle = new RectangleF(x, y + num3, num4, num3);
                                        graphics.DrawString(s, font, brush, layoutRectangle, format);
                                    }
                                    else
                                    {
                                        RectangleF ef2 = new RectangleF(x, y, num4, num3);
                                        graphics.DrawString(s, font, brush, ef2, format);
                                    }
                                }
                            }
                        }
                    }
                }
                if (obj.EnvelopeLogoShow)
                {
                    string str4 = HttpContext.Current.Server.MapPath("~/Order/OrderLogos/Envelope/" + obj.EnvelopeLogoName);
                    using (Image image = Image.FromFile(str4))
                    {
                        double num11;
                        double num12;
                        Rectangle rectangle;
                        float num9 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintLeft, 1440M)), obj.ResolutionType);
                        float num10 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintTop, 1440M)), obj.ResolutionType);
                        float num8 = TwipsToPixelsX(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintWidth, 1440M)), obj.ResolutionType);
                        float num7 = TwipsToPixelsY(Convert.ToSingle(decimal.Multiply(obj.EnvelopeImprintHeight, 1440M)), obj.ResolutionType);
                        if ((image.Width > num8) & (image.Height > num7))
                        {
                            num11 = num8 / ((float) image.Width);
                            num12 = num7 / ((float) image.Height);
                        }
                        else if ((image.Width > num8) & (image.Height < num7))
                        {
                            num11 = num8 / ((float) image.Width);
                            num12 = 1.0;
                        }
                        else if ((image.Width < num8) & (image.Height > num7))
                        {
                            num11 = 1.0;
                            num12 = num7 / ((float) image.Height);
                        }
                        else
                        {
                            num11 = 1.0;
                            num12 = 1.0;
                        }
                        if (!(num11 == 1.0) | !(num12 == 1.0))
                        {
                            ResizeImage(image, num11, num12, HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
                        }
                        if ((num11 == 1.0) & (num12 == 1.0))
                        {
                            using (Image image2 = image)
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image2.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image2.Height) / 2f))), (int) Math.Round((double) image2.Width), (int) Math.Round((double) image2.Height));
                                graphics.DrawImage(image2, rectangle);
                            }
                        }
                        else
                        {
                            using (Image image3 = Image.FromFile(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
                            {
                                rectangle = new Rectangle((int) Math.Round((double) (num9 + ((num8 - image3.Width) / 2f))), (int) Math.Round((double) (num10 + ((num7 - image3.Height) / 2f))), (int) Math.Round((double) image3.Width), (int) Math.Round((double) image3.Height));
                                graphics.DrawImage(image3, rectangle);
                            }
                        }
                    }
                }
                string filename = HttpContext.Current.Server.MapPath("~/ProofingTool/Low Resolution Images/" + obj.SessionID + "_Envelope.gif");
                bitmap.Save(filename, ImageFormat.Gif);
            }
        }
    }
    catch (Exception exception1)
    {
        ProjectData.SetProjectError(exception1);
        if ((!string.IsNullOrEmpty(obj.SessionID) & !string.IsNullOrEmpty(obj.EnvelopeLogoName)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
        }
        ProjectData.ClearProjectError();
    }
    finally
    {
        if ((!string.IsNullOrEmpty(obj.SessionID) & !string.IsNullOrEmpty(obj.EnvelopeLogoName)) && File.Exists(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif")))
        {
            File.Delete(HttpContext.Current.Server.MapPath("~/ProofingTool/Temp/" + obj.SessionID + "_" + obj.EnvelopeLogoName.Substring(0, obj.EnvelopeLogoName.LastIndexOf(".")) + "ScaledE.tif"));
        }
    }
}

 

 
End 


public static void ResizeImage(Image srcImage, double scaleFactorX, double scaleFactorY, string toStream)
{
    try
    {
        using (srcImage)
        {
            using (MemoryStream stream = new MemoryStream(ConvertImageToByteArray(srcImage)))
            {
                using (Image image = Image.FromStream(stream))
                {
                    int height = (int) Math.Round((double) (image.Height * scaleFactorY));
                    double num = ((double) image.Width) / ((double) image.Height);
                    int width = (int) Math.Round((double) (height * num));
                    using (Bitmap bitmap = new Bitmap(width, height))
                    {
                        using (Graphics graphics = Graphics.FromImage(bitmap))
                        {
                            graphics.CompositingQuality = CompositingQuality.HighQuality;
                            graphics.SmoothingMode = SmoothingMode.HighQuality;
                            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                            Rectangle rect = new Rectangle(0, 0, width, height);
                            graphics.DrawImage(image, rect);
                            bitmap.Save(toStream, ImageFormat.Tiff);
                        }
                    }
                }
            }
        }
        srcImage.Dispose();
    }
    catch (Exception exception1)
    {
        ProjectData.SetProjectError(exception1);
        Exception exception = exception1;
        srcImage.Dispose();
        ProjectData.ClearProjectError();
    }
}

 

 
End


public static Image SetResolution(Image sourceImage, int resolution)
{
    double num = ((double) resolution) / ((double) ((int) Math.Round((double) sourceImage.HorizontalResolution)));
    using (Bitmap bitmap = new Bitmap(sourceImage.Width, sourceImage.Height))
    {
        bitmap.SetResolution((float) resolution, (float) resolution);
        Bitmap image = new Bitmap(sourceImage, (int) Math.Round((double) (sourceImage.Width * num)), (int) Math.Round((double) (sourceImage.Height * num)));
        using (Graphics graphics = Graphics.FromImage(bitmap))
        {
            graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            graphics.DrawImage(image, 0, 0);
        }
        return image;
    }
}

 

 
End


public static float TwipsToPixelsX(float twips, string resType)
{
    float num;
    if (resType.Split(new char[] { '|' })[0] == "low")
    {
        return (twips / 15f);
    }
    if (Conversions.ToDouble(resType.Split(new char[] { '|' })[1]) == 3.0)
    {
        return (twips / 2.4f);
    }
    if (Conversions.ToDouble(resType.Split(new char[] { '|' })[1]) == 2.0)
    {
        num = twips / 2.4f;
    }
    return num;
}

 
public class Hammond
{
    // Fields
    private bool _BlankStandardVerse;
    private string _CardHeight;
    private int _CardID;
    private string _CardLayout;
    private string _CardLogoLocation;
    private string _CardSize;
    private string _CardWidth;
    private string _CompanyCardID;
    private string _CompanyID;
    private string _CustomVerseText;
    private decimal _EnvelopeFontSize;
    private decimal _EnvelopeHeight;
    private char _EnvelopeImprintAlignmentX;
    private char _EnvelopeImprintAlignmentY;
    private decimal _EnvelopeImprintHeight;
    private string _EnvelopeImprintInk;
    private decimal _EnvelopeImprintLeft;
    private bool _EnvelopeImprintShow;
    private decimal _EnvelopeImprintTop;
    private decimal _EnvelopeImprintWidth;
    private char _EnvelopeLogoAlignmentX;
    private char _EnvelopeLogoAlignmentY;
    private decimal _EnvelopeLogoHeight;
    private decimal _EnvelopeLogoLeft;
    private string _EnvelopeLogoName;
    private bool _EnvelopeLogoShow;
    private decimal _EnvelopeLogoTop;
    private decimal _EnvelopeLogoWidth;
    private string _EnvelopePersonalize1;
    private string _EnvelopePersonalize2;
    private string _EnvelopePersonalize3;
    private string _EnvelopePersonalize4;
    private string _EnvelopeTypeStyle;
    private decimal _EnvelopeWidth;
    private char _IconAlignmentX;
    private char _IconAlignmentY;
    private decimal _IconHeight;
    private decimal _IconLeft;
    private decimal _IconTop;
    private decimal _IconWidth;
    private string _ImprintInk;
    private string _LogoName;
    private bool _LogoShow;
    private decimal _MessageFontSize;
    private bool _MessageShow;
    private string _MessageTypeStyle;
    private string _Personalize1;
    private string _Personalize2;
    private string _Personalize3;
    private string _Personalize4;
    private string _PTextSize;
    private string _restype;
    private string _SessionID;
    private string _StandardVerse;
    private char _TextAlignmentX;
    private char _TextAlignmentY;
    private decimal _TextHeight;
    private decimal _TextLeft;
    private decimal _TextTop;
    private decimal _TextWidth;
    private string _TypeStyle;
    private char _VerseAlignmentX;
    private char _VerseAlignmentY;
    private decimal _VerseFontSize;
    private decimal _VerseHeight;
    private string _VerseID;
    private decimal _VerseLeft;
    private string _VerseSize;
    private decimal _VerseTop;
    private string _VerseType;
    private decimal _VerseWidth;

    // Methods
    public Hammond();

    // Properties
    public bool BlankStandardVerse { get; set; }
    public decimal CardHeight { get; set; }
    public int CardID { get; set; }
    public string CardLayout { get; set; }
    public string CardLogoLocation { get; set; }
    public string CardSize { get; set; }
    public decimal CardWidth { get; set; }
    public string CompanyCardID { get; set; }
    public string CompanyID { get; set; }
    public string CustomVerseText { get; set; }
    public decimal EnvelopeFontSize { get; set; }
    public decimal EnvelopeHeight { get; set; }
    public char EnvelopeImprintAlignmentX { get; set; }
    public char EnvelopeImprintAlignmentY { get; set; }
    public decimal EnvelopeImprintHeight { get; set; }
    public string EnvelopeImprintInk { get; set; }
    public decimal EnvelopeImprintLeft { get; set; }
    public bool EnvelopeImprintShow { get; set; }
    public decimal EnvelopeImprintTop { get; set; }
    public decimal EnvelopeImprintWidth { get; set; }
    public char EnvelopeLogoAlignmentX { get; set; }
    public char EnvelopeLogoAlignmentY { get; set; }
    public decimal EnvelopeLogoHeight { get; set; }
    public decimal EnvelopeLogoLeft { get; set; }
    public string EnvelopeLogoName { get; set; }
    public bool EnvelopeLogoShow { get; set; }
    public decimal EnvelopeLogoTop { get; set; }
    public decimal EnvelopeLogoWidth { get; set; }
    public string EnvelopePersonalize1 { get; set; }
    public string EnvelopePersonalize2 { get; set; }
    public string EnvelopePersonalize3 { get; set; }
    public string EnvelopePersonalize4 { get; set; }
    public string EnvelopeTypeStyle { get; set; }
    public decimal EnvelopeWidth { get; set; }
    public char IconAlignmentX { get; set; }
    public char IconAlignmentY { get; set; }
    public decimal IconHeight { get; set; }
    public decimal IconLeft { get; set; }
    public decimal IconTop { get; set; }
    public decimal IconWidth { get; set; }
    public string ImprintInk { get; set; }
    public string LogoName { get; set; }
    public bool LogoShow { get; set; }
    public decimal MessageFontSize { get; set; }
    public bool MessageShow { get; set; }
    public string MessageTypeStyle { get; set; }
    public string Personalize1 { get; set; }
    public string Personalize2 { get; set; }
    public string Personalize3 { get; set; }
    public string Personalize4 { get; set; }
    public string PTextSize { get; set; }
    public string ResolutionType { get; set; }
    public string SessionID { get; set; }
    public string StandardVerse { get; set; }
    public char TextAlignmentX { get; set; }
    public char TextAlignmentY { get; set; }
    public decimal TextHeight { get; set; }
    public decimal TextLeft { get; set; }
    public decimal TextTop { get; set; }
    public decimal TextWidth { get; set; }
    public string TypeStyle { get; set; }
    public char VerseAlignmentX { get; set; }
    public char VerseAlignmentY { get; set; }
    public decimal VerseFontSize { get; set; }
    public decimal VerseHeight { get; set; }
    public string VerseID { get; set; }
    public decimal VerseLeft { get; set; }
    public string VerseSize { get; set; }
    public decimal VerseTop { get; set; }
    public string VerseType { get; set; }
    public decimal VerseWidth { get; set; }
}

 
Expand Methods
 


End

public class HammondDal
{
    // Fields
    public static int height;

    // Methods
    [DebuggerNonUserCode]
    public HammondDal();
    public static void ChangeImageColor(Hammond obj);
    public static byte[] ConvertImageToByteArray(Image imageIn);
    public static string CreateCardHighProof(Hammond obj);
    public static void CreateCardLowProof(Hammond obj);
    public static string CreateEnvelopeHighProof(Hammond obj);
    public static void CreateEnvelopeLowProof(Hammond obj);
    public static ImageCodecInfo GetEncoderInfo(string sMime);
    public static void ResizeImage(Image srcImage, double scaleFactorX, double scaleFactorY, string toStream);
    public static Image SetResolution(Image sourceImage, int resolution);
    public static float TwipsToPixelsX(float twips, string resType);
    public static float TwipsToPixelsY(float twips, string resType);

    // Nested Types
    public enum HammondCardSuppliers
    {
        Birchcraft = 3,
        CarlsonCraft = 10,
        Tatex = 2
    }
}

 
Expand Methods