예제 #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_mail model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id",      SqlDbType.Int,          8),
                new SqlParameter("@m_title",   SqlDbType.VarChar,    200),
                new SqlParameter("@m_content", SqlDbType.Text),
                new SqlParameter("@m_from",    SqlDbType.Int,          4),
                new SqlParameter("@m_to",      SqlDbType.VarChar,   1000),
                new SqlParameter("@m_file",    SqlDbType.VarChar,   1000),
                new SqlParameter("@m_time",    SqlDbType.DateTime),
                new SqlParameter("@m_sort",    SqlDbType.Int,          4),
                new SqlParameter("@m_state",   SqlDbType.Int,          4),
                new SqlParameter("@m_main",    SqlDbType.Int,          4),
                new SqlParameter("@m_ip",      SqlDbType.VarChar, 20)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.m_title;
            parameters[2].Value     = model.m_content;
            parameters[3].Value     = model.m_from;
            parameters[4].Value     = model.m_to;
            parameters[5].Value     = model.m_file;
            parameters[6].Value     = model.m_time;
            parameters[7].Value     = model.m_sort;
            parameters[8].Value     = model.m_state;
            parameters[9].Value     = model.m_Main;
            parameters[10].Value    = model.m_Ip;

            DbHelperSQL.RunProcedure("Tunnel_mail_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
예제 #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(Tunnel.Model.Tunnel_mail model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id",    SqlDbType.BigInt,  8),
                //new SqlParameter("@m_title", SqlDbType.VarChar,200),
                //new SqlParameter("@m_content", SqlDbType.Text),
                //new SqlParameter("@m_from", SqlDbType.Int,4),
                //new SqlParameter("@m_to", SqlDbType.Int,4),
                //new SqlParameter("@m_file", SqlDbType.VarChar,1000),
                //new SqlParameter("@m_time", SqlDbType.DateTime),
                new SqlParameter("@m_sort",  SqlDbType.Int,     4),
                new SqlParameter("@m_state", SqlDbType.Int,     4),
                new SqlParameter("@m_user",  SqlDbType.Int,     4),
                new SqlParameter("@m_ip",    SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model.m_id;
            //parameters[1].Value = model.m_title;
            //parameters[2].Value = model.m_content;
            //parameters[3].Value = model.m_from;
            //parameters[4].Value = model.m_to;
            //parameters[5].Value = model.m_file;
            //parameters[6].Value = model.m_time;
            parameters[1].Value = model.m_sort;
            parameters[2].Value = model.m_state;
            parameters[3].Value = model.m_from;
            parameters[4].Value = model.m_Ip;


            return(DbHelperSQL.RunProcedure("Tunnel_mail_Update", parameters, out rowsAffected));
        }
예제 #3
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        if (Id == 0)
        {
            return;
        }
        Tunnel.Model.Tunnel_mail        model     = new Tunnel.Model.Tunnel_mail();
        List <Tunnel.Model.Tunnel_mail> modelList = new List <Tunnel.Model.Tunnel_mail>();

        model = tbll.GetModel(Id);
        modelList.Add(model);
        Repeater1.DataSource = modelList;
        Repeater1.DataBind();

        if (model.m_Main == 0 && model.m_state == 0)
        {
            Tunnel.Model.Tunnel_mail modelUp = new Tunnel.Model.Tunnel_mail();
            modelUp.m_id    = Id;
            modelUp.m_state = 1;
            modelUp.m_from  = ul.LoginID;
            modelUp.m_Ip    = Tunnel.Common.Common.GetIp();
            tbll.Update(modelUp);

            Tunnel.Model.Tunnel_mail modelUp2 = new Tunnel.Model.Tunnel_mail();
            modelUp2.m_id    = Id - 1;
            modelUp2.m_state = 1;
            modelUp2.m_from  = ul.LoginID;
            modelUp2.m_Ip    = Tunnel.Common.Common.GetIp();
            tbll.Update(modelUp2);
            string strsql = "delete Tunnel_Remind where m_typeid=" + Id + " and m_type=2";
            Tunnel.Data.DbHelperSQL.ExecuteSql(strsql);
        }
    }
예제 #4
0
    /// <summary>
    ///  创建文件及路径参数

    /// </summary>
    public void CreateMdAndFilePaht(HttpPostedFile hpf)
    {
        //string wordMd = Request.PhysicalApplicationPath.Replace(HttpRuntime.AppDomainAppVirtualPath.Replace("/", "") + "\\", "");
        string upPaht     = "upload";
        string createPaht = "\\Messge";
        string fileSaveMd = createPaht + ul.LoginID + "\\";

        fileDirectory = Request.PhysicalApplicationPath + upPaht + createPaht;
        if (Tunnel.Common.Common.CreateMd(fileDirectory) == 0)
        {
            fileDirectory = fileDirectory + fileSaveMd;
            if (Tunnel.Common.Common.CreateMd(fileDirectory) == 0)
            {
                upDbFilePaht = upPaht + createPaht + fileSaveMd;
                fileName     = DateTime.Now.ToString("yyyyMMddHHmmssffff");
            }
        }
        if (hpf.ContentLength > 0)
        {
            if (!string.IsNullOrEmpty(hpf.FileName))
            {
                fileName = fileName + System.IO.Path.GetExtension(hpf.FileName);
            }
            else
            {
                fileName = fileName + hpf.ContentType;
            }
            filePaht      = upDbFilePaht + fileName;
            fileDirectory = fileDirectory + fileName;
            hpf.SaveAs(fileDirectory);
        }
        else
        {
            if (classid == 2)
            {
                Tunnel.Model.Tunnel_mail model = new Tunnel.Model.Tunnel_mail();
                Tunnel.BLL.Tunnel_mail   mbll  = new Tunnel.BLL.Tunnel_mail();
                model = mbll.GetModel(Convert.ToInt64(Id));
                if (model.m_file.Trim().Equals(""))
                {
                    filePaht = string.Empty;
                }
                else
                {
                    filePaht = upDbFilePaht + fileName + model.m_file.Substring(model.m_file.LastIndexOf('.'));
                    File.Copy(Request.PhysicalApplicationPath + model.m_file, fileDirectory + fileName + model.m_file.Substring(model.m_file.LastIndexOf('.')));
                }
            }
            else
            {
                filePaht = string.Empty;
            }
        }
    }
예제 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_mail GetModel(long m_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@m_id", SqlDbType.BigInt)
            };
            parameters[0].Value = m_id;

            Tunnel.Model.Tunnel_mail model = new Tunnel.Model.Tunnel_mail();
            DataSet ds = DbHelperSQL.RunProcedure("Tunnel_mail_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["m_id"].ToString() != "")
                {
                    model.m_id = long.Parse(ds.Tables[0].Rows[0]["m_id"].ToString());
                }
                model.m_title   = ds.Tables[0].Rows[0]["m_title"].ToString();
                model.m_content = ds.Tables[0].Rows[0]["m_content"].ToString();
                if (ds.Tables[0].Rows[0]["m_from"].ToString() != "")
                {
                    model.m_from = int.Parse(ds.Tables[0].Rows[0]["m_from"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_to"].ToString() != "")
                {
                    model.m_to = int.Parse(ds.Tables[0].Rows[0]["m_to"].ToString());
                }
                model.m_file = ds.Tables[0].Rows[0]["m_file"].ToString();
                if (ds.Tables[0].Rows[0]["m_time"].ToString() != "")
                {
                    model.m_time = DateTime.Parse(ds.Tables[0].Rows[0]["m_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_sort"].ToString() != "")
                {
                    model.m_sort = int.Parse(ds.Tables[0].Rows[0]["m_sort"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_state"].ToString() != "")
                {
                    model.m_state = int.Parse(ds.Tables[0].Rows[0]["m_state"].ToString());
                }
                if (ds.Tables[0].Rows[0]["m_main"].ToString() != "")
                {
                    model.m_Main = int.Parse(ds.Tables[0].Rows[0]["m_main"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #6
0
 private void PageBind2(int mailId)
 {
     Tunnel.BLL.Tunnel_mail   mail  = new Tunnel.BLL.Tunnel_mail();
     Tunnel.Model.Tunnel_mail model = new Tunnel.Model.Tunnel_mail();
     model           = mail.GetModel(mailId);
     tb_Title.Text   = "转发:" + model.m_title;
     tb_content.Text = "原信息内容:\n" + model.m_content.Replace(@"<br \>", "\n") + "\n" + model.m_time.ToString() + "\n-------------------------------\n";
     if (!model.m_file.Trim().Equals(""))
     {
         Label1.Text   += model.m_file.Substring(model.m_file.LastIndexOf('\\'));
         Label1.Visible = true;
         Label2.Visible = true;
     }
 }
예제 #7
0
    private void PageBind(int mailId)
    {
        Tunnel.BLL.Tunnel_mail   mail  = new Tunnel.BLL.Tunnel_mail();
        Tunnel.Model.Tunnel_mail model = new Tunnel.Model.Tunnel_mail();
        model           = mail.GetModel(mailId);
        tb_Title.Text   = "回复:" + model.m_title;
        tb_content.Text = "原信息内容:\n" + model.m_content.Replace(@"<br \>", "\n") + "\n" + model.m_time.ToString() + "\n-------------------------------\n";
        Tunnel.BLL.Tunnel_menber   menb = new Tunnel.BLL.Tunnel_menber();
        Tunnel.Model.Tunnel_menber mmol = new Tunnel.Model.Tunnel_menber();
        mmol             = menb.GetModel(model.m_from);
        tb_toname.Text   = mmol.m_name + ",";
        id_toValue.Value = model.m_from.ToString() + ",";
        string priv_name = mmol.m_name;
        long   priv_id   = mmol.m_id;
        char   d         = '"';

        td_tomail.InnerHtml = priv_name + "<IMG id=" + priv_name + priv_id + " onclick=" + "'" + "removeimg(" + d + priv_name + d + "," + d + priv_id + d + ");" + "'" + " src=" + d + "../../image/remove.png" + d + ">,";
    }
예제 #8
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="pb">分页基本信息</param>
        /// <param name="count">返回总数</param>
        /// <returns></returns>
        public List <Tunnel.Model.Tunnel_mail> GetList(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_mail> modelList = new List <Tunnel.Model.Tunnel_mail>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_mail model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model           = new Tunnel.Model.Tunnel_mail();
                    model.m_id      = Convert.ToInt64(dt.Rows[n]["m_id"].ToString());
                    model.m_title   = dt.Rows[n]["m_title"].ToString();
                    model.m_content = dt.Rows[n]["m_content"].ToString();
                    if (dt.Rows[n]["m_from"].ToString() != "")
                    {
                        model.m_from = int.Parse(dt.Rows[n]["m_from"].ToString());
                    }
                    if (dt.Rows[n]["m_to"].ToString() != "")
                    {
                        model.m_to = Convert.ToInt32(dt.Rows[n]["m_to"].ToString());
                    }
                    model.m_file = dt.Rows[n]["m_file"].ToString();
                    if (dt.Rows[n]["m_time"].ToString() != "")
                    {
                        model.m_time = DateTime.Parse(dt.Rows[n]["m_time"].ToString());
                    }
                    if (dt.Rows[n]["m_sort"].ToString() != "")
                    {
                        model.m_sort = int.Parse(dt.Rows[n]["m_sort"].ToString());
                    }
                    if (dt.Rows[n]["m_state"].ToString() != "")
                    {
                        model.m_state = int.Parse(dt.Rows[n]["m_state"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #9
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_mail> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_mail> modelList = new List <Tunnel.Model.Tunnel_mail>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_mail model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tunnel.Model.Tunnel_mail();
                    //model.m_id=dt.Rows[n]["m_id"].ToString();
                    model.m_title   = dt.Rows[n]["m_title"].ToString();
                    model.m_content = dt.Rows[n]["m_content"].ToString();
                    if (dt.Rows[n]["m_from"].ToString() != "")
                    {
                        model.m_from = int.Parse(dt.Rows[n]["m_from"].ToString());
                    }
                    if (dt.Rows[n]["m_to"].ToString() != "")
                    {
                        model.m_to = Convert.ToInt32(dt.Rows[n]["m_to"].ToString());
                    }
                    model.m_file = dt.Rows[n]["m_file"].ToString();
                    if (dt.Rows[n]["m_time"].ToString() != "")
                    {
                        model.m_time = DateTime.Parse(dt.Rows[n]["m_time"].ToString());
                    }
                    if (dt.Rows[n]["m_sort"].ToString() != "")
                    {
                        model.m_sort = int.Parse(dt.Rows[n]["m_sort"].ToString());
                    }
                    if (dt.Rows[n]["m_state"].ToString() != "")
                    {
                        model.m_state = int.Parse(dt.Rows[n]["m_state"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Tunnel.Model.Tunnel_mail model)
 {
     return(dal.Update(model));
 }
예제 #11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tunnel.Model.Tunnel_mail model)
 {
     return(dal.Add(model));
 }
예제 #12
0
    /// <summary>
    /// 发送邮件并保存到服务器
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        //获得所需参数
        string strTo = tb_toname.Text.Trim();

        strToIds = id_toValue.Value.Trim();
        string         strTitle   = tb_Title.Text.Trim();
        string         strContent = tb_content.Text.Trim().Replace("\r\n", @"<br \>").Replace("原信息内容:", "");
        HttpPostedFile hpf        = file1.PostedFile;

        if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10)
        {
            Response.Write("<script>alert('附件大小不能大于10MB');</script>");

            return;
        }
        else
        {
            CreateMdAndFilePaht(hpf);
        }

        //写入数据库

        Tunnel.BLL.Tunnel_mail   rbll  = new Tunnel.BLL.Tunnel_mail();
        Tunnel.Model.Tunnel_mail model = new Tunnel.Model.Tunnel_mail();
        model.m_title   = strTitle;
        model.m_content = strContent;
        model.m_file    = filePaht;
        model.m_time    = DateTime.Now;
        model.m_from    = ul.LoginID;
        model.m_sort    = 0; // 0未删除、1删除
        model.m_state   = 0; // 0未读、1已读
        model.m_Ip      = Tunnel.Common.Common.GetIp();
        if (strToIds.LastIndexOf(',') > 0)
        {
            strToIds = strToIds.Remove(strToIds.LastIndexOf(','), 1);
        }
        string[] arr   = strToIds.Split(',');
        int      relt1 = -1;

        foreach (string s in arr)
        {
            bool state = true;
            for (int i = 1; i <= 2; i++)
            {
                if (i == 1)
                {
                    model.m_Main = 1; //标记是自己发的
                    model.m_to   = Convert.ToInt32(s);
                    relt1        = rbll.Add(model);
                }
                else
                {
                    model.m_Main = 0; //标记是发给别人的
                    model.m_to   = Convert.ToInt32(s);
                    relt1        = rbll.Add(model);
                    //-------添加消息提示--------
                    Tunnel.Model.Tunnel_Remind remindmodel = new Tunnel.Model.Tunnel_Remind();
                    remindmodel.m_isread   = 0;
                    remindmodel.m_time     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    remindmodel.m_title    = "新的站内消息,发件人:" + ul.getUserModel(model.m_from).m_name + "。时间:" + DateTime.Now + "<font color=red>(未读)</font>";
                    remindmodel.m_touser   = model.m_to;
                    remindmodel.m_url      = "N_Exchange/N_Message/N_MessageView.aspx?Id=" + relt1;
                    remindmodel.m_type     = 2;
                    remindmodel.m_typeid   = relt1;
                    remindmodel.m_callTime = Convert.ToDateTime("1800-01-01");
                    Tunnel.BLL.Tunnel_Remind rd = new Tunnel.BLL.Tunnel_Remind();
                    rd.Add(remindmodel);
                }
                if (relt1 == 0)
                {
                    state = false;
                    break;
                }
            }
            if (state == false)
            {
                break;
            }
        }

        string str = "站内信息发送";
        string url = "N_MessageOld.aspx";

        if (relt1 > 0)
        {
            str += "成功!";
        }
        else
        {
            str += "失败!";
        }

        MessageBox(str, url);
    }
예제 #13
0
 public void NewSh()
 {
     if (Request.QueryString["id"] != null)
     {
         int    id    = Convert.ToInt32(Request.QueryString["id"]);
         int    i_hit = 0;
         string str1  = "";
         if (RadioButton2.Checked)
         {
             i_hit = 1;
             str1  = "已通过审核";
         }
         if (RadioButton1.Checked)
         {
             i_hit = 2;
             str1  = "审核已被驳回";
         }
         string strsql = "update tunnel_information set i_hit=" + i_hit.ToString() + " where i_id=" + id.ToString();
         int    result = Tunnel.Data.DbHelperSQL.ExecuteSql(strsql);
         string str    = "";
         if (result > 0)
         {
             str = "提交成功";
             PageBind();
         }
         else
         {
             str = "提交失败";
         }
         string strsql2 = "delete tunnel_remind where m_typeid=" + id.ToString() + " and m_type=4";
         Tunnel.Data.DbHelperSQL.ExecuteSql(strsql2);
         Tunnel.Common.Message.Show(str);
         Tunnel_log model = new Tunnel_log();
         model.l_content = "系统管理>>新闻管理>>审核新闻新闻,id:" + id;
         model.l_ip      = Tunnel.Common.Common.GetIp();
         model.l_time    = DateTime.Now;
         model.l_user    = ul.LoginID;
         model.l_sort    = 3;
         Tunnel.BLL.Tunnel_log log = new Tunnel.BLL.Tunnel_log();
         log.Add(model);
         strsql = "select * from tunnel_information where i_id=" + id;
         SqlDataReader reader   = Tunnel.Data.DbHelperSQL.ExecuteReader(strsql);
         int           touserId = 0;
         string        titles   = "";
         if (reader.Read())
         {
             touserId = Convert.ToInt32(reader["i_user"]);
             titles   = reader["i_title"].ToString();
         }
         if (touserId > 0 && touserId != ul.LoginID)
         {
             Tunnel.BLL.Tunnel_mail   rbll   = new Tunnel.BLL.Tunnel_mail();
             Tunnel.Model.Tunnel_mail modelm = new Tunnel.Model.Tunnel_mail();
             modelm.m_title   = "新闻" + str1;
             modelm.m_content = "您发布的新闻:" + titles + "。" + str1;
             modelm.m_file    = "";
             modelm.m_time    = DateTime.Now;
             modelm.m_from    = ul.LoginID;
             modelm.m_sort    = 0; // 0未删除、1删除
             modelm.m_state   = 0; // 0未读、1已读
             modelm.m_Ip      = Tunnel.Common.Common.GetIp();
             int relt1 = -1;
             for (int i = 1; i <= 2; i++)
             {
                 if (i == 1)
                 {
                     modelm.m_Main = 1; //标记是自己发的
                     modelm.m_to   = Convert.ToInt32(touserId);
                     relt1         = rbll.Add(modelm);
                 }
                 else
                 {
                     modelm.m_Main = 0; //标记是发给别人的
                     modelm.m_to   = Convert.ToInt32(touserId);
                     relt1         = rbll.Add(modelm);
                 }
             }
         }
     }
 }