public MainForm() { InitializeComponent(); modelRecord = new Model(); this.logInfo = new LogInfo(); this.address = new AddressList(); this.userName = new UserNameList(); this.mailInfo = new List<string>(); Control.CheckForIllegalCrossThreadCalls = false; skinGalleryHelper = new RibbonDemos.SkinGalleryHelper(ribbonGallerySkins); ((DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit)ReceiveNameEdit.Edit).ButtonClick+=new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(ImportNameButton_Click); ((DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup)MailCollectionType.Edit).SelectedIndexChanged += new EventHandler(CollectionRadioGroup_SelectIndexChanged); ((DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit)AddCommuRecord.Edit).CheckedChanged += new EventHandler(AutoAddCommuRecord_CheckedChanged); ((DevExpress.XtraEditors.Repository.RepositoryItemCheckEdit)AddSendMailLog.Edit).CheckedChanged += new EventHandler(AutoAddSendMailLog_CheckedChanged); ((DevExpress.XtraEditors.Repository.RepositoryItemComboBox)FliterUsersComboBox.Edit).SelectedIndexChanged+=new EventHandler(FliterUsers_SelectedIndexChanged); this.CookieMailPanel.Visible = true; //this.PopMailPanel.Visible = false; // this.MailEditorPanel.Visible = true; }
public void BindTreeView() { try { this.trvLogList.ExpandAll(); this.trvListInfo.ExpandAll(); this.trvLogList.Nodes.Clear(); this.trvListInfo.Nodes.Clear(); TreeNode node = new TreeNode(); TreeNode node2 = new TreeNode(); TreeNode node3 = new TreeNode(); node.Text = "������־"; node2.Text = "�����ռ���"; node3.Text = "�����û���"; node.Tag = "0"; node2.Tag = "0"; node3.Tag = "0"; this.trvLogList.Nodes.Add(node); this.trvListInfo.Nodes.Add(node2); this.trvListInfo.Nodes.Add(node3); AddressList list = new AddressList(); UserNameList list2 = new UserNameList(); List<string> log = this.logInfo.GetLog(); List<string> addressList = list.GetAddressList(); List<string> userNameList = list2.GetUserNameList(); for (int i = 0; i < log.Count; i++) { TreeNode node4 = new TreeNode(); node4.Text = log[i]; this.trvLogList.Nodes[0].Nodes.Add(node4); } for (int j = 0; j < addressList.Count; j++) { TreeNode node5 = new TreeNode(); node5.Text = addressList[j]; this.trvListInfo.Nodes[0].Nodes.Add(node5); } for (int k = 0; k < userNameList.Count; k++) { TreeNode node6 = new TreeNode(); node6.Text = userNameList[k]; this.trvListInfo.Nodes[1].Nodes.Add(node6); } } catch (Exception) { this.MailInfoOutput.Text = this.MailInfoOutput.Text + "ͨѶ¼/��־����ʧ��!"; throw; } }
private void ImportUserBarButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string str = ""; string userName = ""; string passWd = ""; string str4 = ""; string str5 = ""; string str6 = ""; string str7 = "'1'"; string str8 = "'?'"; string str9 = "'0'"; string str10 = "1"; string str11 = ""; string str12 = ""; string str13 = ""; string str14 = "'��'"; string str15 = ""; string str16 = ""; string str17 = ""; string strSql = ""; str11 = "'" + str11 + "'"; str12 = "'" + str12 + "'"; str13 = "'" + str13 + "'"; string str19 = ""; OpenFileDialog dialog = new OpenFileDialog { Filter = "�ı��ļ�(*.txt)|*.txt" }; dialog.ShowDialog(); if (dialog.FileName != "") { StreamReader reader = new StreamReader(dialog.FileName, Encoding.UTF8); while ((str19 = reader.ReadLine()) != null) { try { if (str19.IndexOf('\t') != -1) { int startIndex = 0; int index = str19.IndexOf('\t'); str15 = str19.Substring(startIndex, index - startIndex).Trim(); startIndex = index + 1; index = str19.IndexOf('\t', startIndex); passWd = str19.Substring(startIndex, index - startIndex).Trim(); startIndex = index + 1; index = str19.IndexOf('\t', startIndex); str = str19.Substring(startIndex, index - startIndex).Trim(); startIndex = index + 1; index = str19.IndexOf('\t', startIndex); if (index == -1) { str4 = str19.Substring(startIndex).Trim(); } else { str4 = str19.Substring(startIndex, index - startIndex).Trim(); } if (str15.IndexOf("@") != -1) { userName = str15.Substring(0, str15.IndexOf("@")).Trim(); passWd = GlobalValue.PopMainForm.Encryption(passWd, userName); userName = "******" + userName + "'"; passWd = "'" + passWd + "'"; str = "'" + str + "'"; str4 = "'" + str4 + "'"; str16 = str15.Substring(str15.IndexOf("@") + 1, str15.Length - (str15.IndexOf("@") + 1)).Trim(); if (str16.ToUpper().IndexOf("POP") != -1) { str5 = "POP"; } else if (str16.IndexOf("yahoo") != -1) { str5 = "Yahoo"; } else if (str16.IndexOf("hotmail") != -1) { str5 = "Hotmail"; } else if (str16.IndexOf("gmail") != -1) { str5 = "Gmail"; } else if (str16.IndexOf("163.com") != -1) { str5 = "163"; } else if (str16.IndexOf("126.com") != -1) { str5 = "126"; } else if (str16.IndexOf("ru") != -1) { str5 = "Ru"; } else if (str16.IndexOf("hinet") != -1) { str5 = "Hinet"; } else if (str16.IndexOf("msn") != -1) { str5 = "Hotmail"; } else { str5 = "POP"; } str5 = "'" + str5 + "'"; str6 = "'" + str16 + "'"; string str20 = "SELECT count(*) FROM users WHERE ��������ַ=" + str6 + "and �û���=" + userName; if (Convert.ToInt32(GlobalValue.PopMainForm.ExecuteSQL(str20)) > 0) { GlobalValue.PopMainForm.listBoxView.Items.Add("���û��Ѿ�����" + str19); GlobalValue.PopMainForm.listBoxView.SelectedIndex = GlobalValue.PopMainForm.listBoxView.Items.Count - 1; } else { str17 = "(" + str + "," + userName + "," + passWd + "," + str4 + "," + str5 + "," + str6 + "," + str7 + "," + str8 + "," + str9 + "," + str10 + "," + str11 + "," + str12 + "," + str13 + "," + str14 + ",'��ͨ�û�')"; strSql = "insert into users (����,�û���,������,����,������,��������ַ,����,����״̬,�ʼ�����,����ʱ��,��ʼʱ��,ʱ���,ʱ����,ȫ������,�û�����)values" + str17; GlobalValue.PopMainForm.ExecuteSQL(strSql); GlobalValue.PopMainForm.listBoxView.Items.Add("����û�:" + userName.Trim(new char[] { '\'' }) + "@" + str6.Trim(new char[] { '\'' })); } } } continue; } catch (Exception exception) { GlobalValue.PopMainForm.listBoxView.Items.Add("�쳣" + exception.Message + ":" + str19); continue; } } reader.Close(); } }
private void tlsDelAddreess_Click(object sender, EventArgs e) { if (MessageBox.Show("ȷ��Ҫɾ����?", "������ʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { string text = ""; string param = this.trvListInfo.SelectedNode.Text; if (this.trvListInfo.SelectedNode.Parent.Text == "�����û���") { text = new UserNameList().DelUserNameList(param); } else if (this.trvListInfo.SelectedNode.Parent.Text == "�����ռ���") { text = new AddressList().DelAddressList(param); } MessageBox.Show(text, "�������", MessageBoxButtons.OK, MessageBoxIcon.None); } this.trvListInfo.ExpandAll(); this.BindTreeView(); }