Exemplo n.º 1
0
        /// <summary>
        /// バッチ送信
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBatch_Click(object sender, EventArgs e)
        {
            ArrayList         list = new ArrayList();
            NdnPublicFunction func = new NdnPublicFunction();

            for (int idx = 0; idx < dgvData.Rows.Count; idx++)
            {
                string mail      = dgvData.Rows[idx].Cells[12].Value.ToString();
                string Subscript = dgvData.Rows[idx].Cells[16].Value.ToString();
                if (func.IsMail(mail, false) && Subscript == "Y")
                {
                    string[] data = new string[18];
                    for (int i = 0; i < 18; i++)
                    {
                        data[i] = dgvData.Rows[idx].Cells[i].Value.ToString();
                    }
                    list.Add(data);
                }
            }
            if (list.Count > 0)
            {
                FormBatchMail form = new FormBatchMail(list, db);
                if (form.ShowDialog() == DialogResult.OK)
                {
                }
            }
            else
            {
                MessageBox.Show("No data Selected!");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 邮件服务器测试
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTest_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         String            name        = txtName.Text;
         String            address     = txtAddress.Text;
         String            port        = txtPort.Text;
         String            user        = txtUser.Text;
         String            password    = txtPassword.Text;
         String            from        = txtSender.Text;
         String            servertype  = cmbType.Text.Trim();
         String            attachement = cmbAttachment.Text.Trim();
         String            isHtml      = cmbISHtml.Text.Trim();
         String            to          = txtTestTo.Text;
         NdnPublicFunction function    = new NdnPublicFunction();
         if (!function.IsMail(to, false))
         {
             string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0066I", db.Language);
             MessageBox.Show(msg);
             return;
         }
         String subject  = "这是测试" + " by " + name;
         String pdffile  = "http://www.chojogakuin.com/weekly/20130907.pdf";
         String body     = "测试内容\r\n收到邮件说明测试成功\r\nURL=" + pdffile;
         String htmlbody = "<html><head></head><body>测试内容<br>收到邮件说明测试成功</body></html>";
         String picfile  = @"c:\test.jpg";
         if (isHtml != "Y")
         {
             htmlbody = null;
         }
         if (attachement != "Y")
         {
             picfile = null;
         }
         if (NCMail.SendEmail(subject, body, htmlbody, picfile, address, user, password, from, to, servertype))
         {
             string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0067I", db.Language);
             MessageBox.Show(msg);
         }
         else
         {
             string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0068I", db.Language);
             MessageBox.Show(msg);
         }
     }
     else
     {
         string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0059I", db.Language);
         MessageBox.Show(msg);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// RFID导入
 /// </summary>
 /// <param name="csvFile"></param>
 private void importRFIDFile(String rfidFile)
 {
     using (StreamReader reader =
                new StreamReader(rfidFile, Encoding.GetEncoding("UTF-8")))
     {
         String            line = reader.ReadLine();
         NdnPublicFunction func = new NdnPublicFunction();
         while ((line = reader.ReadLine()) != null)
         {
             if (func.IsNumeric(line.Trim()))
             {
                 string company = reader.ReadLine().Trim();
                 string name    = reader.ReadLine().Trim();
                 string mail    = reader.ReadLine().Trim().Replace("&", "@");
                 if (!func.IsMail(mail, false))
                 {
                     continue;
                 }
                 int    id        = 0;
                 String valueList = "'" + company + "','" + name + "','','','','','RFID','电子电器','','','" + ""
                                    + "','" + mail + "','','','" + System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "','Y','" + db.UserID + "'";
                 if (db.SetRFIDCustomer(0, 0, "Cname,name,postcode,address,tel,fax,kind,format,scale,CYMD,other,mail,web,jCNAME,createtime,subscripted,UserID",
                                        "", valueList, out id))
                 {
                     //string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0001I", db.Language);
                     //MessageBox.Show(msg);
                 }
                 else
                 {
                     //string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0002I", db.Language);
                     //MessageBox.Show(msg);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 客户数据检查
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublish_Click(object sender, EventArgs e)
        {
            Hashtable         ht       = getInvalidCustomer();
            DataSet           ds       = new DataSet();
            NdnPublicFunction function = new NdnPublicFunction();
            int newid = 0;

            if (db.GetCustomer(0, 0, "*", "", "", ref ds))
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    String id          = row["id"].ToString();
                    String mail        = row["mail"].ToString();
                    String subscripted = row["subscripted"].ToString().Trim();
                    if (!function.IsMail(mail, false) || ht[mail] != null)
                    {
                        db.SetCustomer(0, 1, "", "id=" + id, "subscripted='N'", out newid);
                    }
                    else
                    {
                        if (subscripted != "T")
                        {
                            db.SetCustomer(0, 1, "", "id=" + id, "subscripted='Y'", out newid);
                        }
                    }
                }
                string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0007I", db.Language);
                MessageBox.Show(msg);
                init("", "", "");
            }
            else
            {
                string msg = NCMessage.GetInstance(db.Language).GetMessageById("CM0008I", db.Language);
                MessageBox.Show(msg);
            }
        }