104 lines
3.3 KiB
C#
104 lines
3.3 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace AutoPekage
|
|||
|
{
|
|||
|
public partial class frmAddSender : Form
|
|||
|
{
|
|||
|
public frmAddSender()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
cbStmpAll.DataSource = LiteDbHelper.GetAllStmpServer();
|
|||
|
cbStmpAll.DisplayMember = "ServerName";
|
|||
|
cbStmpAll.ValueMember = "Stmp";
|
|||
|
lbSender.DataSource = LiteDbHelper.GetAllSender();
|
|||
|
lbSender.DisplayMember = "Name";
|
|||
|
//lbSender.ValueMember = "Id";
|
|||
|
if (lbSender.SelectedIndex == -1)
|
|||
|
{
|
|||
|
btnModify.Enabled = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void cbStmpAll_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void btnAddStmpServer_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (new frmStmpServer().ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|||
|
{
|
|||
|
cbStmpAll.DataSource = LiteDbHelper.GetAllStmpServer();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void cbShowPwd_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (cbShowPwd.Checked)
|
|||
|
{
|
|||
|
txtPassword.PasswordChar = '\0';
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
txtPassword.PasswordChar = '*';
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void btnAdd_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//LiteDbHelper.AddSender(txtName.Text, txtMailAddr.Text, txtPassword.Text, txtNickName.Text, cbStmpAll.SelectedValue.ToString());
|
|||
|
var mailSender = lbSender.SelectedValue as SenderDao;
|
|||
|
mailSender.Name = txtName.Text;
|
|||
|
mailSender.UserName = txtMailAddr.Text;
|
|||
|
mailSender.NickName = txtNickName.Text;
|
|||
|
mailSender.Password = txtPassword.Text;
|
|||
|
mailSender.StmpServer = cbStmpAll.SelectedValue.ToString();
|
|||
|
LiteDbHelper.AddSender(mailSender);
|
|||
|
lbSender.DataSource = LiteDbHelper.GetAllSender();
|
|||
|
}
|
|||
|
|
|||
|
private void btnCencel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Close();
|
|||
|
}
|
|||
|
|
|||
|
private void btnAd_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
LiteDbHelper.AddSender("新建发件人");
|
|||
|
lbSender.DataSource = LiteDbHelper.GetAllSender();
|
|||
|
btnModify.Enabled = true;
|
|||
|
}
|
|||
|
|
|||
|
private void lbSender_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var mailSender = lbSender.SelectedValue as SenderDao;
|
|||
|
txtName.Text = mailSender.Name;
|
|||
|
txtMailAddr.Text = mailSender.UserName;
|
|||
|
txtNickName.Text = mailSender.NickName;
|
|||
|
txtPassword.Text = mailSender.Password;
|
|||
|
if (mailSender.StmpServer != null)
|
|||
|
{
|
|||
|
cbStmpAll.SelectedValue = mailSender.StmpServer;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void btnDel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
LiteDbHelper.DelSender(lbSender.SelectedValue as SenderDao);
|
|||
|
lbSender.DataSource = LiteDbHelper.GetAllSender();
|
|||
|
if (lbSender.SelectedIndex == -1)
|
|||
|
{
|
|||
|
btnModify.Enabled = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|