Exemple #1
0
 public void loadTakeoffItems(pswift.IItem itm, List <string> lst)
 {
     for (int idx = 0; idx <= itm.ChildCount() - 1; idx++)
     {
         pswift.IItem citm = itm[idx];
         if (citm.GetProperty("Type").ResultAsString() == "Folder")
         {
             loadTakeoffItems(citm, lst);
         }
         else
         {
             Boolean isItem = citm.GetPropertyResultAsBoolean("IsItem", false);
             if (isItem)
             {
                 lst.Add(citm.GUID());
             }
             if (citm.ChildCount() != 0)
             {
                 loadTakeoffItems(citm, lst);
             }
         }
     }
 }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 RForm = new Form2();

            RForm.ShowDialog();
            if (RForm.DialogResult != DialogResult.OK)
            {
                RForm.Dispose();

                return;
            }
            Object template = Directory.GetCurrentDirectory() + "\\Includes\\Word_Template.dotx";

            Console.WriteLine(template.ToString());
            Object oMissing  = System.Reflection.Missing.Value;
            Object isvisible = true;

            Word._Application oWord = new Word.Application();
            try
            {
                Word._Document oDoc       = oWord.Documents.Add(template, oMissing, oMissing, isvisible);
                Word.Table     otable     = oDoc.Tables[2];
                String         ReportType = RForm.ReportCBX.Text;
                if (ReportType == "Digitizer Items Only")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm         = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        Boolean      isDigitizer = false;
                        if (itm.GetPropertyResultAsBoolean("isArea", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isLinear", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isSegment", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isCount", false) == true)
                        {
                            isDigitizer = true;
                        }

                        if (isDigitizer)
                        {
                            rowidx++;
                            itmtoword(itm, otable, rowidx, "Digitizer");
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Parts Only")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            rowidx++;
                            itmtoword(itm, otable, rowidx, "Part");
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Digitizer Items w/Parts")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);

                        rowidx++;
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            itmtoword(itm, otable, rowidx, "Part");
                        }
                        else
                        {
                            itmtoword(itm, otable, rowidx, "Digitizer");
                        }

                        this.progressBar1.Value = idx;
                    }
                }
            }
            finally
            {
                this.progressBar1.Value = 0;
                oWord.Visible           = true;
                oWord = null;
                RForm.Dispose();
            }
        }
Exemple #3
0
        public string createMailBody(string RT)
        {
            char   quo  = (char)34;
            string body = "<body>";

            body = body + "<h1>Report Type: " + RT + "</h1>" + "\r\n";
            body = body + "<table style=" + quo + "width:auto; font-weight:Bold; font-family:Tahoma; font-size:14px;" + quo + ">" + "\r\n";
            body = body + "<tr>" + "\r\n";
            body = body + "<td style=" + quo + "width:200px; font-weight:Bold; font-family:Tahoma; font-size:14px;" + quo + ">";
            body = body + "Name";
            body = body + "</td>" + "\r\n";
            body = body + "<td style=" + quo + "width:100px; font-weight:Bold; font-family:Tahoma; font-size:14px;" + quo + ">";
            body = body + "Qty";
            body = body + "</td>" + "\r\n";
            body = body + "<td style=" + quo + "width:100px; font-weight:Bold; font-family:Tahoma; font-size:14px;" + quo + ">";
            body = body + "Price Each";
            body = body + "</td>" + "\r\n";
            body = body + "<td style=" + quo + "width:100px; font-weight:Bold; font-family:Tahoma;font-size:14px;" + quo + ">";
            body = body + "Price Total";
            body = body + "</td>" + "\r\n";
            body = body + "</tr>" + "\r\n";
            if (RT == "Digitizer Items Only")
            {
                for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                {
                    pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                    if (itm.GetPropertyResultAsBoolean("isPart", false) == false)
                    {
                        body = body + "<tr><td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.Name + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Qty", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Price Each", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Price Total", "") + "</td>";
                        body = body + "</tr>";
                    }
                }
            }
            if (RT == "Parts Only")
            {
                for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                {
                    pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                    if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                    {
                        body = body + "<tr><td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.Name + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Qty", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Price Each", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal;" + quo + ">" + itm.GetPropertyResultAsString("Price Total", "") + "</td>";
                        body = body + "</tr>";
                    }
                }
            }
            if (RT == "Digitizer Items w/Parts")
            {
                for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                {
                    pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                    if (itm.GetPropertyResultAsBoolean("isPart", false) == false)
                    {
                        body = body + "<tr><td style=" + quo + "font-size:12px; font-weight:normal; color:#007dc3;" + quo + ">" + itm.Name + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#007dc3;" + quo + ">" + itm.GetPropertyResultAsString("Qty", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#007dc3;" + quo + ">" + itm.GetPropertyResultAsString("Price Each", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#007dc3;" + quo + ">" + itm.GetPropertyResultAsString("Price Total", "") + "</td>";
                        body = body + "</tr>";
                    }
                    if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                    {
                        body = body + "<tr><td style=" + quo + "font-size:12px; font-weight:normal; color:#0000FF;" + quo + ">" + itm.Name + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#0000FF;" + quo + ">" + itm.GetPropertyResultAsString("Qty", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#0000FF;" + quo + ">" + itm.GetPropertyResultAsString("Price Each", "") + "</td>";
                        body = body + "<td style=" + quo + "font-size:12px; font-weight:normal; color:#0000FF;" + quo + ">" + itm.GetPropertyResultAsString("Price Total", "") + "</td>";
                        body = body + "</tr>";
                    }
                }
            }
            return(body);
        }
Exemple #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 RForm = new Form2();

            RForm.ShowDialog();
            if (RForm.DialogResult != DialogResult.OK)
            {
                RForm.Dispose();

                return;
            }
            Object template = Directory.GetCurrentDirectory() + "\\Includes\\Excel_Template.XLT";

            Console.WriteLine(template.ToString());
            Object oMissing  = System.Reflection.Missing.Value;
            Object isvisible = true;

            Excel._Application oExcel = new Excel.Application();
            try
            {
                Excel._Workbook  oBook      = oExcel.Workbooks.Add(template);
                Excel._Worksheet oSheet     = oExcel.Worksheets[1];
                String           ReportType = RForm.ReportCBX.Text;
                if (ReportType == "Digitizer Items Only")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm         = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        Boolean      isDigitizer = false;
                        if (itm.GetPropertyResultAsBoolean("isArea", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isLinear", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isSegment", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isCount", false) == true)
                        {
                            isDigitizer = true;
                        }

                        if (isDigitizer)
                        {
                            rowidx++;
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Parts Only")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            rowidx++;
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Digitizer Items w/Parts")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);

                        rowidx++;
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        else
                        {
                            itmtoexcel(itm, rowidx, oSheet);
                        }

                        this.progressBar1.Value = idx;
                    }
                }
            }
            finally
            {
                this.progressBar1.Value = 0;
                oExcel.Visible          = true;
                oExcel = null;
                RForm.Dispose();
            }
        }