private void pictureEmail_Click(object sender, EventArgs e)
 {
     //this.Visible = false;
     this.Close();
     frmEmailSend f = new frmEmailSend();
     f.ShowDialog();
 }
        public void SendMail(string allID)
        {
            //LiveFaceScan.userinfo.email = "*****@*****.**";
            //LiveFaceScan.userinfo.id = 16 + "";
            Boolean ret;
            ret =false;
            EbrochureDocumentLinqDB  eDocument = new EbrochureDocumentLinqDB();

            TransactionDB trans = new TransactionDB();
            //trans.CreateTransaction();
            string status;
            status = "false";
            string[] strId = allID.Split(',');

            //for (int i = 0; i < strId.Length; i++) {
               EbrochureSendMailJobLinqDB SendMailJob = new EbrochureSendMailJobLinqDB();

                //SendMailJob.CREATE_BY = "Admin";
                //SendMailJob.CREATE_ON = DateTime.Now;
                //SendMailJob.UPDATE_BY = "Admin";
                //SendMailJob.UPDATE_ON = DateTime.Now;
                SendMailJob.ERM_TS_PERSONAL_INFO_ID = Convert.ToInt32( LiveFaceScan.userinfo.id);
                SendMailJob.CUSTOMER_EMAIL = LiveFaceScan.userinfo.email;
                SendMailJob.IS_SEND_MAIL = 'N';
                ret = SendMailJob.InsertData("Admin", trans.Trans);

                if (ret == true)
                {
                    //DataTable dt;
                    //dt = eDocument.GetDataList("ebrochure_id=" + strId[0], "", trans.Trans);

                    //for (int j = 0; j < dt.Rows.Count; j++)
                    //{
                      for (int i = 0; i < strId.Length; i++) {
                        EbrochureSendMailJobItemLinqDB SendMailJobItem = new EbrochureSendMailJobItemLinqDB();
                        //SendMailJobItem.CREATE_BY = "Admin";
                        //SendMailJobItem.CREATE_ON = DateTime.Now;
                        //SendMailJob.UPDATE_BY = "Admin";
                        //SendMailJob.UPDATE_ON = DateTime.Now;
                        SendMailJobItem.EBROCHURE_SEND_MAIL_JOB_ID = SendMailJob.ID;
                        SendMailJobItem.EBROCHURE_ID = Convert.ToInt32(strId[i]);
                        ret = SendMailJobItem.InsertData("Admin", trans.Trans);

                        SendMailJobItem = null;
                        }
                }

                SendMailJob = null;
            //}

            if (ret == false)
            {
                trans.RollbackTransaction();
                MessageBox.Show("ไม่สามารถส่ง E-Mail ได้");
            }
            else {
                trans.CommitTransaction();
                this.Visible = false;
                this.Close();

               frmEmailSend f = new frmEmailSend();
                f.MailComplete();
                f.ShowDialog();

            }
        }