예제 #1
0
 public override void GV_Main_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
 {
     base.GV_Main_CustomDrawCell(sender, e);
     if (e.Column.FieldName == "XR005")
     {
         if (GV_Main.GetRowCellValue(e.RowHandle, "XR005") != null)
         {
             Bitmap img    = new Bitmap(Properties.Resources.Grades0);
             Bitmap img2   = null;
             float  mGrade = float.Parse(GV_Main.GetRowCellValue(e.RowHandle, "XR005").ToString());
             if (mGrade >= 0)
             {
                 img2 = new Bitmap(Properties.Resources.Grades50);
             }
             else
             {
                 img2 = new Bitmap(Properties.Resources.Grades_50);
             }
             mGrade = Math.Abs(mGrade);
             int      mXR005 = (int)(mGrade / 5 * 160);
             Graphics g      = Graphics.FromImage(img);
             g.DrawImage(img2, new Rectangle(0, 0, mXR005, 32), new Rectangle(0, 0, mXR005, 32), GraphicsUnit.Pixel);
             e.Cache.Paint.DrawImage(e.Graphics, img, new Rectangle(e.Bounds.X, e.Bounds.Y, 160, 32));
             e.Handled = true;
         }
     }
 }
예제 #2
0
 private void GetResult()
 {
     DicMuity.Clear();
     if (GV_Main.RowCount > 0)
     {
         if (!IsMuity)
         {
             for (int i = 0; i < F2.RETURN.Count(); i++)
             {
                 ResutnValus[i] = GV_Main.GetRowCellValue(FocusRowIndex, F2.RETURN[i]).ToString();
             }
         }
         else
         {
             for (int i = 0; i < GV_Main.RowCount; i++)
             {
                 if (GV_Main.GetRowCellValue(i, "Select").ToString() == "Y")
                 {
                     List <string> ls = new List <string>();
                     for (int j = 0; j < F2.RETURN.Length; j++)
                     {
                         ls.Add(GV_Main.GetRowCellValue(i, F2.RETURN[j]).ToString());
                     }
                     DicMuity.Add(i, ls);
                 }
             }
         }
     }
 }
예제 #3
0
        private void btnAll_Click(object sender, EventArgs e)
        {
            bool     IsExist = false;
            F2Window f2      = new F2Window(this);

            f2.SetMI         = new string[] { "POSXM", "001" };
            f2.SetMuity      = true;
            f2.SetShowWindow = false;
            Dictionary <int, List <string> > muity = null;

            if (f2.GetMI)
            {
                muity = f2.GetMuity;
                DataTable dt = null;
                if (GC_Main.DataSource == null)
                {
                    dt = new DataTable();
                    dt.Columns.Add("Select");
                    dt.Columns.Add("XM001");
                    dt.Columns.Add("XM004");
                    dt.Columns.Add("XM002");
                    GC_Main.DataSource = dt;
                }
                else
                {
                    dt = (DataTable)GC_Main.DataSource;
                }

                foreach (KeyValuePair <int, List <string> > s in muity)
                {
                    for (int i = 0; i < GV_Main.RowCount; i++)
                    {
                        if (GV_Main.GetRowCellValue(i, "XM004").ToString() == s.Value[0])
                        {
                            IsExist = true;
                            break;
                        }
                    }
                    if (IsExist)
                    {
                        IsExist = false;
                        continue;
                    }
                    else
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = "N";
                        dr[1] = s.Value[0];
                        dr[2] = s.Value[1];
                        dr[3] = s.Value[2];
                        dt.Rows.Add(dr);
                    }
                }
            }
        }
예제 #4
0
        private void btnDelOne_Click(object sender, EventArgs e)
        {
            int i = 0;

            while (i < GV_Main.RowCount)
            {
                if (GV_Main.GetRowCellValue(i, "Select").ToString() == "Y")
                {
                    GV_Main.DeleteRow(i);
                }
                else
                {
                    i++;
                }
            }
        }
예제 #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < GV_Main.RowCount; i++)
     {
         if (GV_Main.GetRowCellValue(i, "Selected").ToString() == "Y")
         {
             List <string> ls = new List <string>()
             {
                 "T",
                 GV_Main.GetRowCellValue(i, "XB007").ToString(), GV_Main.GetRowCellValue(i, "XB007C").ToString(),
                 GV_Main.GetRowCellValue(i, "XB002").ToString(), GV_Main.GetRowCellValue(i, "XB003").ToString(),
                 GV_Main.GetRowCellValue(i, "XB004").ToString()
             };
             SelectList.Add(ls);
         }
     }
 }
예제 #6
0
        private void InitComboBoxEdit()
        {
            for (int i = 0; i < GV_Main.RowCount; i++)
            {
                int    idx    = GV_Main.GetRowHandle(i);
                string mXB007 = "[" + GV_Main.GetRowCellValue(idx, "XB007").ToString() + "] " + GV_Main.GetRowCellValue(idx, "XB007C").ToString();

                if (!cbo01.Properties.Items.Contains(mXB007))
                {
                    cbo01.Properties.Items.Add(mXB007);
                }
            }

            if (cbo01.Properties.Items.Count > 0)
            {
                cbo01.SelectedIndex = 0;
            }
        }
예제 #7
0
        private void GV_Main_MouseDown(object sender, MouseEventArgs e)
        {
            GridHitInfo hitInfo = GV_Main.CalcHitInfo(e.Location);

            if (hitInfo == null || hitInfo.Column == null)
            {
                return;
            }
            if (hitInfo.Column.FieldName == "XR006")
            {
                GV_Main.FocusedColumn    = hitInfo.Column;
                GV_Main.FocusedRowHandle = hitInfo.RowHandle;
                //GV_Main.ShowEditor();
                ShowBosxMemo sbm = new ShowBosxMemo();
                sbm.SetMemo = GV_Main.GetRowCellValue(hitInfo.RowHandle, "XR006").ToString();
                sbm.ShowDialog();
                DXMouseEventArgs.GetMouseArgs(e).Handled = true;
                //GV_Main.CloseEditor();
            }
        }
예제 #8
0
        private void GV_Main_MouseDown(object sender, MouseEventArgs e)
        {
            GridHitInfo hitInfo = GV_Main.CalcHitInfo(e.Location);

            if (hitInfo == null || hitInfo.Column == null)
            {
                return;
            }
            if (hitInfo.Column.FieldName == "XR005")
            {
                GridViewInfo info = (GridViewInfo)GV_Main.GetViewInfo();
                if (info != null)
                {
                    GridCellInfo cell = info.GetGridCellInfo(hitInfo.RowHandle, hitInfo.Column);
                    if (cell != null)
                    {
                        int mGrade = ((e.X - cell.Bounds.X) / 32) + 1;
                        if (e.Button == MouseButtons.Right)
                        {
                            mGrade = mGrade * -1;
                        }
                        GV_Main.SetRowCellValue(hitInfo.RowHandle, "XR005", mGrade);
                        DXMouseEventArgs.GetMouseArgs(e).Handled = true;
                    }
                }
            }
            else if (hitInfo.Column.FieldName == "XR006")
            {
                GV_Main.FocusedColumn    = hitInfo.Column;
                GV_Main.FocusedRowHandle = hitInfo.RowHandle;
                ShowBosxMemo sbm = new ShowBosxMemo();
                sbm.SetCanEdit = true;
                sbm.SetMemo    = GV_Main.GetRowCellValue(hitInfo.RowHandle, "XR006").ToString();
                if (sbm.ShowDialog() == DialogResult.OK)
                {
                    GV_Main.SetRowCellValue(hitInfo.RowHandle, "XR006", sbm.GetReturn);
                }
                DXMouseEventArgs.GetMouseArgs(e).Handled = true;
            }
        }
예제 #9
0
 private void XK006ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e)
 {
     //if (GetGridStatu() != BaseForm.GridStatu.gsBrowse)
     {
         int    mRowHandle = GV_Main.FocusedRowHandle;
         string mType      = GV_Main.GetFocusedRowCellValue("XK005").ToString();
         f2.SetMI = new string[] { "POSXH", "002" };
         //f2.SetMIParam = new string[] { GV_Main.GetFocusedRowCellValue("XK005").ToString(), FData[3], FData[4], FData[3], FData[4] };
         //f2.SetMIParam = new string[] { FData[3], FData[4], FData[5], FData[4], FData[5] };
         f2.SetMIParam = new string[] { mType, FData[3], FData[4], FData[5] };
         f2.SetMuity   = true;
         Dictionary <int, List <string> > muity = null;
         if (f2.GetMI)
         {
             muity = f2.GetMuity;
             bool IsExist = false;
             bool IsFirst = true;
             foreach (KeyValuePair <int, List <string> > s in muity)
             {
                 for (int i = 0; i < GV_Main.RowCount; i++)
                 {
                     int idx = GV_Main.GetRowHandle(i);
                     if ((GV_Main.GetRowCellValue(idx, "XK006") == null))
                     {
                         IsExist = false;
                         break;
                     }
                     if (GV_Main.GetRowCellValue(idx, "XK006").ToString() == s.Value[0])
                     {
                         if (GV_Main.GetRowCellValue(idx, "XK005").ToString() == mType)
                         {
                             if (idx == mRowHandle)
                             {
                                 IsFirst = false;
                             }
                             IsExist = true;
                             break;
                         }
                     }
                 }
                 if (IsExist)
                 {
                     IsExist = false;
                     continue;
                 }
                 else
                 {
                     if (IsFirst)
                     {
                         IsFirst = false;
                     }
                     else
                     {
                         GV_Main.AddNewRow();
                     }
                     int mIndex = GV_Main.RowCount;
                     GV_Main.SetFocusedRowCellValue("XK001", FData[0]);
                     GV_Main.SetFocusedRowCellValue("XK002", FData[1]);
                     GV_Main.SetFocusedRowCellValue("XK003", FData[2]);
                     GV_Main.SetFocusedRowCellValue("XK004", string.Format("{0:0000}", mIndex));
                     GV_Main.SetFocusedRowCellValue("XK005", mType);
                     GV_Main.SetFocusedRowCellValue("XK006", s.Value[0]);
                     GV_Main.SetFocusedRowCellValue("XK006C", s.Value[1]);
                     GV_Main.SetFocusedRowCellValue("XH004", s.Value[2]);
                     GV_Main.UpdateCurrentRow();
                 }
             }
         }
     }
 }
예제 #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string mNo    = "";
            string mSQL   = "";
            string mXR001 = "";

            try
            {
                using (SqlConnection conn = new SqlConnection(fc.makeConnectString(fc.FDBInfo)))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand("SELECT MAX(XR001) AS XR001 FROM POSXR ", conn))
                    {
                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            if (dr.Read())
                            {
                                mXR001 = dr["XR001"].ToString();
                            }
                        }
                    }


                    if (mXR001 != "")
                    {
                        mNo = "S" + DateTime.Now.ToString("yyyyMMdd") + fc.ZeroatFirst((Int32.Parse(mXR001.Substring(9, mXR001.Length - 9)) + 1), 4);
                    }
                    else
                    {
                        mNo = "S" + DateTime.Now.ToString("yyyyMMdd") + "0001";
                    }

                    mSQL = "SELECT XR001 FROM POSXR WHERE XR001='" + mNo + "'";
                    for (int i = 0; i < GV_Main.RowCount; i++)
                    {
                        while (!ValidMaxNo(mSQL))
                        {
                            mNo  = mNo.Substring(0, 9) + fc.ZeroatFirst((Int32.Parse(mNo.Substring(9, mNo.Length - 9)) + 1), 4);
                            mSQL = "SELECT XR001 FROM POSXR WHERE XR001='" + mNo + "'";
                        }
                        int   mHandle = GV_Main.GetRowHandle(i);
                        float mXR005  = 0;
                        float.TryParse(GV_Main.GetRowCellValue(mHandle, "XR005").ToString(), out mXR005);
                        if (mXR005 == 0)
                        {
                            continue;
                        }
                        string mSQL2 = "INSERT INTO POSXR (XR001,XR002,XR003,XR004,XR005,XR006) VALUES(@XR001,@XR002,@XR003,@XR004,@XR005,@XR006)";
                        using (SqlCommand cmd = new SqlCommand(mSQL2, conn))
                        {
                            cmd.Parameters.AddWithValue("@XR001", mNo);
                            cmd.Parameters.AddWithValue("@XR002", GV_Main.GetRowCellValue(mHandle, "XF002").ToString());
                            cmd.Parameters.AddWithValue("@XR003", GV_Main.GetRowCellValue(mHandle, "XG002").ToString());
                            cmd.Parameters.AddWithValue("@XR004", fc.FUser.ID);
                            cmd.Parameters.AddWithValue("@XR005", GV_Main.GetRowCellValue(mHandle, "XR005").ToString());
                            cmd.Parameters.AddWithValue("@XR006", GV_Main.GetRowCellValue(mHandle, "XR006").ToString());
                            cmd.ExecuteNonQuery();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                fc.ErrorLog(ex.Message);
            }
        }
예제 #11
0
        private void btnOldLList_Click(object sender, EventArgs e)
        {
            //string mXQ003 = "";
            Dictionary <int, List <string> > muity = new Dictionary <int, List <string> >();

            using (SqlConnection conn = new SqlConnection(fc.makeConnectString(fc.FDBInfo)))
            {
                conn.Open();
                try
                {
                    string SQL = " SELECT XQ003 XM001,XM004,XM002 FROM POSXQ " +
                                 " LEFT JOIN( " +
                                 " SELECT TOP 1 XP001,XP002 FROM POSXP " +
                                 " ORDER BY XP001 DESC,XP002 DESC) A ON XQ001=XP001 AND XQ002=XP002 " +
                                 " LEFT JOIN POSXM ON XQ003=XM001 " +
                                 " WHERE XP001 IS NOT NULL ";
                    using (SqlCommand cmd = new SqlCommand(SQL, conn))
                    {
                        SqlDataReader rd = cmd.ExecuteReader();
                        int           i  = 0;
                        while (rd.Read())
                        {
                            muity.Add(i++, new List <string>()
                            {
                                rd["XM001"].ToString(), rd["XM004"].ToString(), rd["XM002"].ToString()
                            });
                        }
                        rd.Close();
                        cmd.Cancel();
                    }
                    conn.Close();
                }
                catch (System.Exception ex)
                {
                    fc.ErrorLog(ex.Message);
                    conn.Close();
                }
            }

            bool      IsExist = false;
            DataTable dt      = null;

            if (GC_Main.DataSource == null)
            {
                dt = new DataTable();
                dt.Columns.Add("Select");
                dt.Columns.Add("XM001");
                dt.Columns.Add("XM004");
                dt.Columns.Add("XM002");
                GC_Main.DataSource = dt;
            }
            else
            {
                dt = (DataTable)GC_Main.DataSource;
            }

            foreach (KeyValuePair <int, List <string> > s in muity)
            {
                for (int i = 0; i < GV_Main.RowCount; i++)
                {
                    if (GV_Main.GetRowCellValue(i, "XM004").ToString() == s.Value[0])
                    {
                        IsExist = true;
                        break;
                    }
                }
                if (IsExist)
                {
                    IsExist = false;
                    continue;
                }
                else
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = "N";
                    dr[1] = s.Value[0];
                    dr[2] = s.Value[1];
                    dr[3] = s.Value[2];
                    dt.Rows.Add(dr);
                }
            }
        }
예제 #12
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (main == null)
            {
                (Parent.Parent as RESMain).SetMarqueeStr("正在傳送郵件");
                (Parent.Parent as RESMain).ShowMarqueeStr(true);
            }
            else
            {
                main.SetMarqueeStr("正在傳送郵件");
                main.ShowMarqueeStr(true);
            }
            string MailServer = "mail-tchdb1.digiwin.biz";

            //string MailServer = "mail-tch.digiwin.biz";
            if (FXM003 != XM003.Text)
            {
                XM003.Text = fc.FDes.EncryptString(XM003.Text, fc.FDes.GenerateKey());
            }
            string pw            = fc.FDes.DecryptString(XM003.Text, fc.FDes.GenerateKey());
            string MailtoDigiwin = "";
            string MailtoGMail   = "";

            for (int i = 0; i < GV_Main.RowCount; i++)
            {
                if (GV_Main.GetRowCellValue(i, "XM002").ToString().ToLower().Contains("digiwin.biz"))
                {
                    MailtoDigiwin += GV_Main.GetRowCellValue(i, "XM002") + ",";
                }
                else if (GV_Main.GetRowCellValue(i, "XM002").ToString().ToLower().Contains("gmail.com"))
                {
                    MailtoGMail += GV_Main.GetRowCellValue(i, "XM002") + ",";
                }
            }
            if (MailtoDigiwin.EndsWith(","))
            {
                MailtoDigiwin = MailtoDigiwin.Substring(0, MailtoDigiwin.Length - 1);
            }
            if (MailtoGMail.EndsWith(","))
            {
                MailtoGMail = MailtoGMail.Substring(0, MailtoGMail.Length - 1);
            }

            //DSC
            REPAR02 report = new REPAR02();

            report.SetFilter = " XA001 = '" + mXA001 + "'";
            report.SetDate   = mDate;
            //report.ShowPreviewDialog();

            // Create a new memory stream and export the report into it as PDF.
            MemoryStream mem = new MemoryStream();

            report.ExportToPdf(mem);

            // Create a new attachment and put the PDF report into it.
            mem.Seek(0, System.IO.SeekOrigin.Begin);
            System.Net.Mail.Attachment att = new System.Net.Mail.Attachment(mem, DateTime.Now.ToString("yyyyMMdd") + "_Menu.pdf", "application/pdf");

            System.Net.Mail.Attachment imageAttachment = null;
            if (buffer != null)
            {
                MemoryStream ms = new MemoryStream(buffer);
                System.Net.Mime.ContentType contentType = new System.Net.Mime.ContentType();
                contentType.MediaType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
                contentType.Name      = "menu.jpg";
                imageAttachment       = new System.Net.Mail.Attachment(ms, contentType);
            }

            if (MailtoDigiwin.Trim() != "")
            {
                SmtpClient client = new SmtpClient(MailServer);
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new NetworkCredential(XM002.Text, pw, MailServer);
                MailMessage message = new MailMessage();
                message.Attachments.Add(att);
                if (imageAttachment != null)
                {
                    message.Attachments.Add(imageAttachment);
                }
                message.From = new MailAddress(XM002.Text, mName);
                message.To.Add(MailtoDigiwin);
                message.Subject    = tb01.Text;
                message.Body       = rd01.HtmlText;
                message.IsBodyHtml = true;
                message            = rd01.CreateExporter(rd01.GetRC, message);
                //client.Send(message);
                client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);//回调函数
                string userState = "寄出郵件";
                client.SendAsync(message, userState);
            }
            //mem.Close();
            //mem.Flush();

            // Create a new attachment and put the PDF report into it.
            if (MailtoGMail.Trim() != "")
            {
                //GMAIL
                MailMessage mail = new MailMessage();

                mail.From = new MailAddress("*****@*****.**", "郭育宏");
                mail.To.Add(MailtoGMail);
                mail.Subject    = tb01.Text;
                mail.Body       = rd01.RCText;
                mail.IsBodyHtml = true;
                mail.Attachments.Add(att);
                if (imageAttachment != null)
                {
                    mail.Attachments.Add(imageAttachment);
                }
                NetworkCredential cred = new NetworkCredential("*****@*****.**", "zz10121205");
                SmtpClient        smtp = new SmtpClient("smtp.gmail.com", 587);
                //smtp.UseDefaultCredentials = false;
                smtp.EnableSsl   = true;
                smtp.Credentials = cred;
                //smtp.Send(mail);
                mail = rd01.CreateExporter(rd01.GetRC, mail);
                smtp.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback2);//回调函数
                string userState = "寄出郵件";
                smtp.SendAsync(mail, userState);
            }
            //mem.Close();
            //mem.Flush();

            if (mWriteData)
            {
                string mXP002 = "";
                using (SqlConnection conn = new SqlConnection(fc.makeConnectString(fc.FDBInfo)))
                {
                    conn.Open();
                    try
                    {
                        string SQL = "SELECT TOP 1 XP002 FROM POSXP WHERE XP001=@XP001 ORDER BY XP002 DESC";
                        using (SqlCommand cmd = new SqlCommand(SQL, conn))
                        {
                            cmd.Parameters.AddWithValue("@XP001", pdfName);
                            SqlDataReader rd = cmd.ExecuteReader();
                            if (rd.Read())
                            {
                                mXP002 = string.Format("{0:0000}", Int32.Parse(rd["XP002"].ToString()) + 1);
                            }
                            else
                            {
                                mXP002 = "0001";
                            }
                            rd.Close();
                            cmd.Cancel();
                        }

                        SQL = "INSERT INTO POSXP (XP001,XP002,XP003) VALUES(@XP001,@XP002,@XP003)";
                        using (SqlCommand cmd = new SqlCommand(SQL, conn))
                        {
                            cmd.Parameters.AddWithValue("@XP001", pdfName);
                            cmd.Parameters.AddWithValue("@XP002", mXP002);
                            cmd.Parameters.AddWithValue("@XP003", mID);
                            cmd.ExecuteNonQuery();
                        }
                        conn.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString());
                        fc.ErrorLog(ex.Message);
                    }
                }

                DataTable dt = new DataTable("POSXQ");
                dt.Columns.Add("XQ001", typeof(string));
                dt.Columns.Add("XQ002", typeof(string));
                dt.Columns.Add("XQ003", typeof(string));
                for (int i = 0; i < GV_Main.RowCount; i++)
                {
                    dt.Rows.Add(pdfName, mXP002, GV_Main.GetRowCellValue(i, "XM001"));
                }
                DataView  dv     = dt.DefaultView;
                DataTable dtsort = dv.ToTable();
                Stopwatch sw     = new Stopwatch();
                sw.Reset();
                sw.Start();
                InsertV4(dtsort); //using SqlBulkCopy
            }


            // Create a new memory stream and export the report into it as PDF.

            /*MemoryStream mem = new MemoryStream();
             * report.ExportToPdf(mem);
             * // Create a new attachment and put the PDF report into it.
             * mem.Seek(0, System.IO.SeekOrigin.Begin);
             * System.Net.Mail.Attachment att = new System.Net.Mail.Attachment(mem, "TestReport.pdf", "application/pdf");
             *
             * SmtpClient client = new SmtpClient("mail-tchdb1.digiwin.biz");
             * client.DeliveryMethod = SmtpDeliveryMethod.Network;
             *
             * client.UseDefaultCredentials = false;
             * client.Credentials = new NetworkCredential("erric", "zz10121205", "mail-tchdb1.digiwin.biz");
             *
             * MailMessage message = new MailMessage();
             * message.Attachments.Add(att);
             *
             * // Specify sender and recipient options for the e-mail message.
             * message.From = new MailAddress("*****@*****.**", "erricguo");
             * message.To.Add("[email protected],[email protected]");
             * // Specify other e-mail options.
             * message.Subject = "Subject";
             * message.Body = "This is a test e-mail message sent by an application.";
             * client.Send(message);
             * // Close the memory stream.
             * mem.Close();
             * mem.Flush();*/


            // Create a new report.

            /*RESAR02 report = new RESAR02();
             * report.SetFilter = " XA001 = '" + mXA001 + "'";
             * report.SetDate =  mDate;
             * report.ShowPreviewDialog();
             * //if (report.ShowPageSetupDialog() == DialogResult.OK)
             * {
             *  // Create a new memory stream and export the report into it as PDF.
             *  MemoryStream mem = new MemoryStream();
             *  report.ExportToPdf(mem);
             *
             *  // Create a new attachment and put the PDF report into it.
             *  mem.Seek(0, System.IO.SeekOrigin.Begin);
             *  System.Net.Mail.Attachment att = new System.Net.Mail.Attachment(mem, DateTime.Now.ToString("yyyyMMdd") + "_Menu.pdf", "application/pdf");
             *
             *  // Create a new message and attach the PDF report to it.
             *  MailMessage mail = new MailMessage();
             *  mail.Attachments.Add(att);
             *
             *  // Specify sender and recipient options for the e-mail message.
             *  mail.From = new MailAddress("*****@*****.**", "erricguo");
             *  mail.To.Add(Mailto);
             *  // Specify other e-mail options.
             *  mail.Subject = tb01.Text;
             *  mail.Body = rd01.Text;
             *
             *  //設定SMTP
             *  NetworkCredential cred = new NetworkCredential("*****@*****.**", pw);
             *  SmtpClient smtp = new SmtpClient("smtp.gmail.com");
             *  smtp.UseDefaultCredentials = false;
             *  smtp.EnableSsl = true;
             *  smtp.Credentials = cred;
             *  smtp.Port = 587;
             *  smtp.Send(mail);
             *
             *  // Close the memory stream.
             *  mem.Close();
             *  mem.Flush();
             * }*/
        }