예제 #1
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static IEnumerable <E_RECEIVE_Model> getListModel(E_RECEIVE_SW sw)
        {
            DataTable dt     = BaseDT.E_RECEIVE.getDT(sw);//列表
            var       result = new List <E_RECEIVE_Model>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                E_RECEIVE_Model m = new E_RECEIVE_Model();
                m.ERID               = dt.Rows[i]["ERID"].ToString();
                m.BYEMAILID          = dt.Rows[i]["BYEMAILID"].ToString();
                m.RECEIVETYPE        = dt.Rows[i]["RECEIVETYPE"].ToString();
                m.EMAILRECEIVESTATUS = dt.Rows[i]["EMAILRECEIVESTATUS"].ToString();
                m.EMAILSENDTIME      = ClsSwitch.SwitTM(dt.Rows[i]["EMAILSENDTIME"].ToString());
                m.EMAILRECEIVETIME   = ClsSwitch.SwitTM(dt.Rows[i]["EMAILRECEIVETIME"].ToString());
                m.SubjectModel       = E_SUBJECTCls.getModel(new E_SUBJECT_SW {
                    EMAILID = m.BYEMAILID
                });
                m.FileModel = E_FILECls.getListModel(new E_File_SW {
                    BYEMAILID = m.BYEMAILID
                });
                if (m.EMAILRECEIVESTATUS == "0")//未读
                {
                    BaseDT.E_RECEIVE.Mdy(new E_RECEIVE_Model
                    {
                        EMAILRECEIVESTATUS = "1",
                        EMAILRECEIVETIME   = ClsSwitch.SwitTM(DateTime.Now),
                        ERID = m.ERID
                    });
                }
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }
예제 #2
0
        /// <summary>
        /// 查看某一邮件信息
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static E_RECEIVE_Model getModel(E_RECEIVE_SW sw)
        {
            DataTable       dt = BaseDT.E_RECEIVE.getDT(sw);//列表
            E_RECEIVE_Model m  = new E_RECEIVE_Model();

            if (dt.Rows.Count > 0)
            {
                int i = 0;
                m.ERID               = dt.Rows[i]["ERID"].ToString();
                m.BYEMAILID          = dt.Rows[i]["BYEMAILID"].ToString();
                m.RECEIVETYPE        = dt.Rows[i]["RECEIVETYPE"].ToString();
                m.EMAILRECEIVESTATUS = dt.Rows[i]["EMAILRECEIVESTATUS"].ToString();
                m.EMAILSENDTIME      = ClsSwitch.SwitTM(dt.Rows[i]["EMAILSENDTIME"].ToString());
                m.EMAILRECEIVETIME   = ClsSwitch.SwitTM(dt.Rows[i]["EMAILRECEIVETIME"].ToString());
                m.SubjectModel       = E_SUBJECTCls.getModel(new E_SUBJECT_SW {
                    EMAILID = m.BYEMAILID
                });
                m.FileModel = E_FILECls.getListModel(new E_File_SW {
                    BYEMAILID = m.BYEMAILID
                });
                if (m.EMAILRECEIVESTATUS == "0")//未读
                {
                    BaseDT.E_RECEIVE.Mdy(new E_RECEIVE_Model {
                        EMAILRECEIVESTATUS = "1",
                        EMAILRECEIVETIME   = ClsSwitch.SwitTM(DateTime.Now),
                        ERID = m.ERID
                    });
                }
            }
            dt.Clear();
            dt.Dispose();
            return(m);
        }
예제 #3
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static DataTable getDT(E_RECEIVE_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("FROM  E_RECEIVE b left join E_SUBJECT a");
            sb.AppendFormat("  on b.BYEMAILID=a.EMAILID");
            sb.AppendFormat(" WHERE   1=1");
            if (string.IsNullOrEmpty(sw.ERID) == false)
            {
                sb.AppendFormat(" AND b.ERID = '{0}'", ClsSql.EncodeSql(sw.ERID));
            }
            if (string.IsNullOrEmpty(sw.BYEMAILID) == false)
            {
                sb.AppendFormat(" AND b.BYEMAILID ='{0}'", ClsSql.EncodeSql(sw.BYEMAILID));
            }
            if (string.IsNullOrEmpty(sw.RECEIVETYPE) == false)
            {
                sb.AppendFormat(" AND b.RECEIVETYPE = '{0}'", ClsSql.EncodeSql(sw.RECEIVETYPE));
            }
            if (string.IsNullOrEmpty(sw.RECEIVEUSERID) == false)//接收人序号 用于收件箱
            {
                sb.AppendFormat(" AND b.RECEIVEUSERID ='{0}'", ClsSql.EncodeSql(sw.RECEIVEUSERID));
            }
            if (string.IsNullOrEmpty(sw.EMAILRECEIVESTATUS) == false)//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1
            {
                sb.AppendFormat(" AND b.EMAILRECEIVESTATUS in({0})", ClsSql.EncodeSql(sw.EMAILRECEIVESTATUS));
            }
            if (string.IsNullOrEmpty(sw.EMAILTITLE) == false)//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1
            {
                sb.AppendFormat(" AND a.EMAILTITLE like '%{0}%'", ClsSql.EncodeSql(sw.EMAILTITLE));
            }
            string  sql  = "select a.*,b.*" + sb.ToString() + " order by b.EMAILSENDTIME DESC";
            string  sqlC = "select count(1) " + sb.ToString();
            DataSet ds   = DataBaseClass.FullDataSet(sql);

            return(ds.Tables[0]);
            //return ds.Tables[0];
            //StringBuilder sb = new StringBuilder();
            //sb.AppendFormat(" FROM      E_RECEIVE a");
            //sb.AppendFormat(" WHERE   1=1");
            //if (string.IsNullOrEmpty(sw.ERID) == false)
            //    sb.AppendFormat(" AND ERID = '{0}'", ClsSql.EncodeSql(sw.ERID));
            //if (string.IsNullOrEmpty(sw.BYEMAILID) == false)
            //    sb.AppendFormat(" AND BYEMAILID ='{0}'", ClsSql.EncodeSql(sw.BYEMAILID));
            //if (string.IsNullOrEmpty(sw.RECEIVETYPE) == false)
            //    sb.AppendFormat(" AND RECEIVETYPE = '{0}'", ClsSql.EncodeSql(sw.RECEIVETYPE));
            //if (string.IsNullOrEmpty(sw.RECEIVEUSERID) == false)//接收人序号 用于收件箱
            //    sb.AppendFormat(" AND RECEIVEUSERID ='{0}'", ClsSql.EncodeSql(sw.RECEIVEUSERID));

            //if (string.IsNullOrEmpty(sw.EMAILRECEIVESTATUS) == false)//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1
            //    sb.AppendFormat(" AND EMAILRECEIVESTATUS in({0}", ClsSql.EncodeSql(sw.EMAILRECEIVESTATUS));
            //string sql = "SELECT   ERID, BYEMAILID, RECEIVETYPE, RECEIVEUSERID, EMAILRECEIVESTATUS, EMAILSENDTIME,EMAILRECEIVETIME"
            //    + sb.ToString()
            //    + " order by EMAILSENDTIME DESC";
            //DataSet ds = DataBaseClass.FullDataSet(sql);
            //return ds.Tables[0];
        }
예제 #4
0
        /// <summary>
        /// 根据邮件接收的状态判断计算邮件的数量
        /// </summary>
        /// <param name="sw"></param>
        /// <returns></returns>
        public static string getNum(E_RECEIVE_SW sw)
        {
            string        total = "";
            StringBuilder sb    = new StringBuilder();

            sb.AppendFormat("    from    E_RECEIVE  ");
            sb.AppendFormat("where 1 = 1 ");
            if (string.IsNullOrEmpty(sw.RECEIVEUSERID) == false)//接收人序号 用于收件箱
            {
                sb.AppendFormat(" AND RECEIVEUSERID ='{0}'", ClsSql.EncodeSql(sw.RECEIVEUSERID));
            }
            if (sw.EMAILRECEIVESTATUS != null && sw.EMAILRECEIVESTATUS.Trim() != "")//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1
            {
                sb.AppendFormat(" AND EMAILRECEIVESTATUS in({0})", ClsSql.EncodeSql(sw.EMAILRECEIVESTATUS));
            }
            string sqlC = "select count(1) " + sb.ToString();

            total = (DataBaseClass.ReturnSqlField(sqlC)).ToString();
            return(total);
        }
예제 #5
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public static DataTable getDT(E_RECEIVE_SW sw, out int total)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("FROM      E_RECEIVE b left join E_SUBJECT a on b.BYEMAILID=a.EMAILID");
            sb.AppendFormat(" WHERE   1=1 ");
            if (string.IsNullOrEmpty(sw.ERID) == false)
            {
                sb.AppendFormat(" AND b.ERID = '{0}'", ClsSql.EncodeSql(sw.ERID));
            }
            if (string.IsNullOrEmpty(sw.BYEMAILID) == false)
            {
                sb.AppendFormat(" AND b.BYEMAILID ='{0}'", ClsSql.EncodeSql(sw.BYEMAILID));
            }
            if (string.IsNullOrEmpty(sw.RECEIVETYPE) == false)
            {
                sb.AppendFormat(" AND b.RECEIVETYPE = '{0}'", ClsSql.EncodeSql(sw.RECEIVETYPE));
            }
            if (string.IsNullOrEmpty(sw.RECEIVEUSERID) == false)//接收人序号 用于收件箱
            {
                sb.AppendFormat(" AND b.RECEIVEUSERID ='{0}'", ClsSql.EncodeSql(sw.RECEIVEUSERID));
            }
            if (sw.EMAILRECEIVESTATUS != null && sw.EMAILRECEIVESTATUS.Trim() != "")//接收状态 用于收件箱[已读、未读]\已删除 收件箱传 0,1 已删除 -1
            {
                sb.AppendFormat(" AND b.EMAILRECEIVESTATUS in({0})", ClsSql.EncodeSql(sw.EMAILRECEIVESTATUS));
            }
            if (!string.IsNullOrEmpty(sw.EMAILTITLE))//主题
            {
                sb.AppendFormat(" AND a.EMAILTITLE like '%{0}%'", ClsSql.EncodeSql(sw.EMAILTITLE));
            }
            string sql  = "select a.*,b.*" + sb.ToString() + " order by b.EMAILSENDTIME DESC";
            string sqlC = "select count(1) " + sb.ToString();

            total      = int.Parse(DataBaseClass.ReturnSqlField(sqlC));
            sw.curPage = PagerCls.getCurPage(new PagerSW {
                curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total
            });
            DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a");

            return(ds.Tables[0]);
        }
예제 #6
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="sw"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public static IEnumerable <E_RECEIVE_Model> getListModel(E_RECEIVE_SW sw, out int total)
        {
            DataTable dt     = BaseDT.E_RECEIVE.getDT(sw, out total);//列表
            var       result = new List <E_RECEIVE_Model>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                E_RECEIVE_Model m = new E_RECEIVE_Model();
                m.ERID               = dt.Rows[i]["ERID"].ToString();
                m.BYEMAILID          = dt.Rows[i]["BYEMAILID"].ToString();
                m.RECEIVETYPE        = dt.Rows[i]["RECEIVETYPE"].ToString();
                m.EMAILRECEIVESTATUS = dt.Rows[i]["EMAILRECEIVESTATUS"].ToString();
                m.EMAILSENDTIME      = ClsSwitch.SwitTM(dt.Rows[i]["EMAILSENDTIME"].ToString());
                m.EMAILRECEIVETIME   = ClsSwitch.SwitTM(dt.Rows[i]["EMAILRECEIVETIME"].ToString());
                m.SubjectModel       = E_SUBJECTCls.getModel(new E_SUBJECT_SW {
                    EMAILID = m.BYEMAILID
                });
                result.Add(m);
            }
            dt.Clear();
            dt.Dispose();
            return(result);
        }