Ejemplo n.º 1
0
        /// <summary>
        ///更新记录
        /// </summary>
        /// <param name="UserDay"></param>
        /// <returns></returns>
        public bool GetUpdate(M_UserDay model)
        {
            string sqlStr = "UPDATE [dbo].[ZL_UserDay] SET [D_name] = @D_name,[D_date] = @D_date,[D_Content] = @D_Content,[D_UserID] = @D_UserID,[D_mail] = @D_mail,[D_mobile] = @D_mobile,[D_SendNum] = @D_SendNum WHERE [id] = @id";

            SqlParameter[] cmdParams = model.GetParameters();
            return(SqlHelper.ExecuteSql(sqlStr, cmdParams));
        }
Ejemplo n.º 2
0
        public ActionResult UserDay()
        {
            DataTable dt     = dayBll.Select_All(mu.UserID);
            int       Mid    = DataConverter.CLng(Request["ID"]);
            M_UserDay dayMod = dayBll.GetSelect(Mid);

            ViewBag.dayMod = dayMod;
            return(View(dt));
        }
Ejemplo n.º 3
0
        public void UserDay_Add()
        {
            int       Mid    = DataConverter.CLng(Request["ID"]);
            M_UserDay dayMod = dayBll.GetSelect(Mid);

            dayMod.D_name    = Request.Form["D_name"];
            dayMod.D_date    = DataConverter.CDate(Request.Form["D_date"]);
            dayMod.D_Content = Request.Form["D_Content"];
            if (dayMod.id > 0)
            {
                dayBll.GetUpdate(dayMod);
                function.WriteSuccessMsg("修改成功", "UserDay?id=" + dayMod.id);
            }
            else
            {
                dayMod.D_UserID = mu.UserID;
                dayBll.GetInsert(dayMod);
                function.WriteSuccessMsg("添加成功", "UserDay");
            }
        }
        /// <summary>
        /// 线程工作
        /// </summary>
        protected void Work()
        {
            DataTable allinfo = dll.Select_All(this.selectdate, selectday);

            if (allinfo != null)
            {
                for (int i = 0; i < allinfo.Rows.Count; i++)
                {
                    int        id     = DataConverter.CLng(allinfo.Rows[i]["id"].ToString());
                    int        userID = DataConverter.CLng(allinfo.Rows[i]["D_UserID"].ToString());
                    M_UserInfo uinfo  = ull.GetUserByUserID(userID);


                    if (uinfo.UserCreit >= 70)
                    {
                        M_UserDay dayinfo = dll.GetSelect(id);
                        if (Sendtotxt != "")
                        {
                            if (Sendtotxt.IndexOf(',') > -1)
                            {
                                string[] sendarr = Sendtotxt.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            }
                            //发送邮件
                            if (uinfo.Email != null)
                            {
                                string mailaddstr = uinfo.Email;//邮件地址

                                MailInfo minfo = Getmail(allinfo.Rows[i]["D_name"].ToString(), SiteConfig.SiteInfo.SiteName + "\n\r" + SiteConfig.SiteInfo.SiteUrl + Resources.L.提醒您 + ":\n\r" + allinfo.Rows[i]["D_Content"].ToString() + "\n\r " + Resources.L.网站自动发送请勿回复);

                                if (DataValidator.IsEmail(uinfo.Email))
                                {
                                    minfo.ToAddress = new MailAddress(uinfo.Email, "");

                                    if (SendMail.Send(minfo) == SendMail.MailState.Ok)
                                    {
                                        //发送成功
                                        dayinfo.D_mail = 1;
                                        //Response.Write("邮件发送成功!");
                                    }
                                    else
                                    {
                                        dayinfo.D_mail = 0;
                                        //Response.Write("邮件发送失败!");
                                        //发送失败
                                    }
                                }
                            }


                            //发送手机短信
                            M_Uinfo ubaseinfo  = ull.GetUserBaseByuserid(userID);
                            string  UserMobile = ubaseinfo.Mobile;

                            if (UserMobile.Length == 11)
                            {
                                string uid = SiteConfig.SiteOption.MssUser;
                                string psw = SiteConfig.SiteOption.MssPsw;

                                if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(psw))
                                {
                                    //this.LblMobile.Text = "没有设置网站的短信通账号和密码";
                                }
                                else
                                {
                                    string balance = GetBalance(uid, psw);//余额查询
                                    if (DataConverter.CDouble(balance) > 0)
                                    {
                                        string sendtxt = SiteConfig.SiteInfo.SiteName + SiteConfig.SiteInfo.SiteUrl + Resources.L.提醒您 + ":" + dayinfo.D_Content + Resources.L.网站自动发送请勿回复;
                                        string req     = this.SendMsg(SiteConfig.SiteOption.MssUser, SiteConfig.SiteOption.MssPsw, UserMobile, sendtxt);

                                        string[] reqs = req.Split(new char[] { '/' });
                                    }
                                }
                            }
                        }
                        dayinfo.D_SendNum += 1;
                        dll.GetUpdate(dayinfo);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 ///添加记录
 /// </summary>
 /// <param name="UserDay"></param>
 /// <returns></returns>
 public int GetInsert(M_UserDay model)
 {
     return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }