Exemplo n.º 1
0
        private void leadout(int type)
        {
            if (listView1.SelectedIndices.Count > 0)
            {
                string sss = listView1.SelectedItems[0].SubItems[1].Text;
                DSMessage.MessageBodyDataTable dt = getMymsg(sss);
                if (dt == null)
                {
                    return;
                }


                bool   flag = false;
                string s    = "";
                System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("\\d{5,12}");
                switch (type)
                {
                case 0:    //xls
                    s    = System.IO.Path.Combine(LeadOutPath, reg.Match(sss).Value + ".xls");
                    flag = new QouShui.DLL.LeadOut.ClassLeadOut().LeadOutAsXLS(dt, s, System.Text.Encoding.Default, true);
                    break;

                case 1:     //txt
                    s    = System.IO.Path.Combine(LeadOutPath, reg.Match(sss).Value + ".txt");
                    flag = new QouShui.DLL.LeadOut.ClassLeadOut().LeadOutAsTXT(dt, s, System.Text.Encoding.Default, true);
                    break;

                case 2:      //xml
                    s    = System.IO.Path.Combine(LeadOutPath, reg.Match(sss).Value + ".xml");
                    flag = new QouShui.DLL.LeadOut.ClassLeadOut().LeadOutAsXML(dt, s, System.Text.Encoding.Default, true);

                    break;

                default:
                    break;
                }
                if (flag)
                {
                    QouShui.DLL.Message.Msg.Info("导出成功!");
                    QouShui.DLL.Message.Msg.SelectFile(s);
                }
            }
        }
Exemplo n.º 2
0
        private DSMessage.MessageBodyDataTable getMymsg(string sss)
        {
            DataRow[] rows = ds.Message.Select(ds.Message.ReceiverUriColumn.ColumnName + "='" + sss + "'");
            if (rows.Length == 0)
            {
                return(null);
            }
            DSMessage.MessageRow[]         rows2 = (DSMessage.MessageRow[])rows;
            DSMessage.MessageBodyDataTable dt    = (DSMessage.MessageBodyDataTable)ds.MessageBody.Clone();
            if (sss.IndexOf(mainNo) < 0)
            {
                foreach (DSMessage.MessageRow row in rows2)
                {
                    foreach (DSMessage.MessageBodyRow r in row.GetMessageBodyRows())  //所有发往该号码的
                    {
                        dt.ImportRow(r);
                    }
                }

                foreach (DSMessage.MessageBodyRow row in ds.MessageBody.Select(ds.MessageBody.SenderUriColumn.ColumnName + "='" + sss + "'"))  // 所有来自该号码 的
                {
                    dt.ImportRow(row);
                }
            }
            else
            {
                //如果要查看自己的,则要求收件与发件都是自己
                foreach (DSMessage.MessageRow row in rows2)
                {
                    foreach (DSMessage.MessageBodyRow r in row.GetMessageBodyRows())  //所有发往该号码的
                    {
                        if (r.SenderUri == row.ReceiverUri)
                        {
                            dt.ImportRow(r);
                        }
                    }
                }
            }
            return(dt);
        }
Exemplo n.º 3
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count > 0)
            {
                DSMessage.MessageBodyDataTable dt = getMymsg(listView1.SelectedItems[0].SubItems[1].Text);
                if (dt == null)
                {
                    return;
                }
                dt.DefaultView.Sort = dt.TimeColumn.ColumnName;
                dgv.DataSource      = dt.DefaultView;
                dgv.Start();

                dgv.Columns.RemoveAt(0);
                dgv.Columns.RemoveAt(0);

                dgv.Columns.RemoveAt(2);
                dgv.Columns.RemoveAt(2);
                dgv.Columns[1].Width = 400;
                dgv.Columns[2].Width = 150;
                curIndex             = -1;
            }
        }