Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int id = CommonMethod.ConvertToInt(Request["id"], 0);
            if (id > 0)
            {
                RetrieveCriteria rcgoodimage = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
                Condition        c           = rcgoodimage.GetNewCondition();
                c.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, id);
                rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGSRC);
                rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGDESC);
                rcgoodimage.OrderBy(XiHuan_GoodsImageEntity.__CREATEDATE, false);
                DataTable     dt      = rcgoodimage.AsDataTable();
                StringBuilder sbImage = new StringBuilder();
                StringBuilder sbDesc  = new StringBuilder();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sbImage.AppendFormat("\"{0}\",", dt.Rows[i][XiHuan_GoodsImageEntity.__IMGSRC]);
                    sbDesc.AppendFormat("\"{0}\",", dt.Rows[i][XiHuan_GoodsImageEntity.__IMGDESC]);
                }

                ExecStartupScript(string.Format("imageArray=new Array({0});", sbImage.ToString().TrimEnd(',')));
                ExecStartupScript(string.Format("imageDesc=new Array({0});", sbDesc.ToString().TrimEnd(',')));
                ExecStartupScript("getnext();$('#loadingimage').hide(); $('#saint').show();");
            }
        }
    }
Esempio n. 2
0
    protected void btnUpDatePic_Click(object sender, EventArgs e)
    {
        RetrieveCriteria rcGoodsPics = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));

        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__NAME);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
        Condition c = rcGoodsPics.GetNewCondition();

        c.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
        c.AddNotEqualTo(XiHuan_UserGoodsEntity.__DEFAULTPHOTO, "images/none.jpg");
        rcGoodsPics.OrderBy(XiHuan_UserGoodsEntity.__CREATEDATE, false);
        rcGoodsPics.Top = 6;
        EntityContainer ecGoods = rcGoodsPics.AsEntityContainer();
        string          pics    = "var pics=\"";
        string          links   = "var links=\"";
        string          texts   = "var texts=\"";

        foreach (XiHuan_UserGoodsEntity goods in ecGoods)
        {
            pics  += goods.DefaultPhoto.Replace(GlobalVar.DefaultPhotoSize, GlobalVar.BigPhotoSize) + "|";
            links += goods.DetailUrl + "|";
            texts += ValidatorHelper.SafeSql(goods.Name) + "|";
        }
        pics  = pics.TrimEnd('|') + "\";";
        links = links.TrimEnd('|') + "\";";
        texts = texts.TrimEnd('|') + "\";";
        Query.ProcessSqlNonQuery(string.Format("update xihuan_systemconfig set configvalue='{0}' where configkey='HomeRounPics'", pics + links + texts), GlobalVar.DataBase_Name);
        SystemConfigFacade.Refresh();
        Alert("幻灯片成功更新!");
    }
Esempio n. 3
0
    private void GetDetail()
    {
        RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity));
        Condition        c  = rc.GetNewCondition();

        c.AddEqualTo(XiHuan_UserInfoEntity.__USERNAME, txtUserName.Text.Trim());
        rc.AddSelect(XiHuan_UserInfoEntity.__ID);
        rc.AddSelect(XiHuan_UserInfoEntity.__ORIGNALPWD);
        rc.AddSelect(XiHuan_UserInfoEntity.__ISLOCKED);
        XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity;

        if (user != null)
        {
            if (user.IsLocked == 0)
            {
                lblResult.Text = string.Format("密码为:<span class=\"highlight\">{0}</span>,<a href=\"###\" onclick=\"LockUser({1});\">锁定此账号</a>", user.OrignalPwd, user.ID);
            }
            if (user.IsLocked == 1)
            {
                lblResult.Text = string.Format("密码为:<span class=\"highlight\">{0}</span>,<a href=\"###\" onclick=\"UnLockUser({1});\">撤消锁定此账号</a>", user.OrignalPwd, user.ID);
            }
        }
        else
        {
            lblResult.Text = "<span class=\"highlight\">没有找到此会员的信息!</span>";
        }
    }
Esempio n. 4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //图片表还需要处理,不是默认图片的,需要将图片复制到新的路径,更新路径到数据库
        RetrieveCriteria rcgimages = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
        Condition        c         = rcgimages.GetNewCondition();

        if (txtGoodsId.Text.Trim().Length > 0)
        {
            c.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, txtGoodsId.Text);
        }
        rcgimages.AddSelect(XiHuan_GoodsImageEntity.__ID);
        rcgimages.AddSelect(XiHuan_GoodsImageEntity.__CREATEDATE);
        rcgimages.AddSelect(XiHuan_GoodsImageEntity.__IMGSRC);
        EntityContainer imagecontainer = rcgimages.AsEntityContainer();
        string          opath          = string.Empty;
        string          filename       = string.Empty;
        string          extention      = string.Empty;
        string          despath        = string.Empty;
        string          filepath       = string.Empty;
        string          fixpath        = "images/userupload/goodsimage/";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        foreach (XiHuan_GoodsImageEntity goodsimage in imagecontainer)
        {
            opath     = Server.MapPath(goodsimage.ImgSrc);
            filename  = Path.GetFileNameWithoutExtension(opath);
            extention = Path.GetExtension(opath);
            if (File.Exists(opath))
            {
                filepath = fixpath + goodsimage.CreateDate.Year + "/" + goodsimage.CreateDate.Month + "/" + goodsimage.CreateDate.Day + "/";
                despath  = Server.MapPath(filepath + filename + extention);
                if (!Directory.Exists(Server.MapPath(filepath)))
                {
                    Directory.CreateDirectory(Server.MapPath(filepath));
                }
                if (!File.Exists(despath))
                {
                    File.Copy(opath, despath, true);//复制原来的图片到新的路径
                    //File.Delete(opath);
                }
                sb.Append("Update XiHuan_GoodsImage set ImgSrc='" + filepath + filename + extention + "' WHERE Id=" + goodsimage.Id + ";");
            }
        }
        if (sb.ToString().Length > 0)
        {
            Query.ProcessSqlNonQuery(sb.ToString(), GlobalVar.DataBase_Name);
        }
    }
Esempio n. 5
0
 private void AddFavorite(string id, string name)
 {
     if (!IsUserAlreadyLogin)
     {
         CommonMethod.ResponseAjaxContent(this.Page, "needlogin");
         return;
     }
     else
     {
         RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserFavorateEntity));
         Condition        c  = rc.GetNewCondition();
         c.AddEqualTo(XiHuan_UserFavorateEntity.__USERID, CurrentUserId);
         c.AddEqualTo(XiHuan_UserFavorateEntity.__GOODSID, id);
         rc.AddSelect(XiHuan_UserFavorateEntity.__ID);
         DataTable dt = rc.AsDataTable();
         if (dt != null && dt.Rows.Count > 0)
         {
             CommonMethod.ResponseAjaxContent(this.Page, "already");
             return;
         }
         else
         {
             XiHuan_UserFavorateEntity newfavorite = new XiHuan_UserFavorateEntity();
             newfavorite.UserId    = CurrentUserId;
             newfavorite.GoodsId   = CommonMethod.ConvertToInt(id, 0);
             newfavorite.GoodsName = GlobalObject.unescape(CommonMethod.FinalString(name));
             newfavorite.FacRemark = "";
             newfavorite.FavDate   = DateTime.Now;
             newfavorite.Save();
             CommonMethod.ResponseAjaxContent(this.Page, "ok");
         }
     }
 }
Esempio n. 6
0
    private void CheckeNotes()
    {
        Transaction t            = new Transaction();
        DataTable   dt           = Query.ProcessSql(@"SELECT Id,Content,ReplyContent FROM XiHuan_GuestBook WITH(nolock) WHERE IsChecked=0 ", GlobalVar.DataBase_Name);
        string      content      = string.Empty;
        string      replycontent = string.Empty;
        int         nid          = 0;

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                nid          = CommonMethod.ConvertToInt(dr["Id"], 0);
                content      = CommonMethod.FinalString(dr["Content"]);
                replycontent = CommonMethod.FinalString(dr["ReplyContent"]);
                if (CommonMethodFacade.ValidFFZF(content).Length == 0 && CommonMethodFacade.ValidFFZF(replycontent).Length == 0)
                {
                    XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
                    notesinfo.Id = nid;
                    notesinfo.Retrieve();
                    if (notesinfo.IsPersistent)
                    {
                        notesinfo.IsChecked = 1;
                        t.AddSaveObject(notesinfo);
                        XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
                        notechecknoticemessage.FromId   = 1;
                        notechecknoticemessage.FromName = "喜换网";
                        notechecknoticemessage.ToId     = notesinfo.FromId;
                        notechecknoticemessage.ToName   = notesinfo.FromName;
                        notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                                        notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
                        notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
                        notechecknoticemessage.CreateDate = DateTime.Now;
                        t.AddSaveObject(notechecknoticemessage);
                        if (t.Process())
                        {
                            #region   如果是对换品页面的留言,重新生成换品页
                            if (CommonMethod.ConvertToInt(nid, 0) > 0)
                            {
                                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                                Condition cgoods = rcgoods.GetNewCondition();
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, notesinfo.GoodsId);
                                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                                if (goods != null)
                                {
                                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + notesinfo.GoodsId, "../" + goods.DetailUrl);
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
        }
    }
Esempio n. 7
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity));
        Condition        c  = rc.GetNewCondition();

        c.AddEqualTo(XiHuan_UserInfoEntity.__USERNAME, txtName.Text.Trim());
        rc.AddSelect(XiHuan_UserInfoEntity.__USERNAME);
        rc.AddSelect(XiHuan_UserInfoEntity.__ORIGNALPWD);
        rc.AddSelect(XiHuan_UserInfoEntity.__QUESTION);
        rc.AddSelect(XiHuan_UserInfoEntity.__ANSWER);
        XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity;

        if (user != null)
        {
            if (user.Question == txtQuestion.Text.Trim() && user.Answer == txtAnswer.Text.Trim())
            {
                try
                {
                    SendMailFacade.sendEmail(txtEmail.Text.Trim(), "喜换网-找回密码", "<strong>" + txtName.Text.Trim() + "</strong>您好,<br/>您在喜换网注册的账号密码为" + user.OrignalPwd + ",请妥善保管,此邮件为系统邮件,请勿回复!");
                    Alert("您的密码已成功发送到您的邮箱,请注意查收!");
                    ExecScript("parent.ymPrompt.close();");
                }
                catch
                {
                    Alert("抱歉:邮件发送出现错误!");
                    return;
                }
            }
            else
            {
                Alert("很抱歉:您输入的安全提问问题和答案不符合,我们不能为您提供找回密码的服务!");
                return;
            }
        }
        else
        {
            Alert("不存在换客名为" + txtName.Text + "的用户!");
            return;
        }
    }
Esempio n. 8
0
    private void CheckNotes(string id, string gid)
    {
        #region 留言通过审核,给留言人发送提醒短消息,提醒留言已通过审核

        Transaction            t         = new Transaction();
        XiHuan_GuestBookEntity notesinfo = new XiHuan_GuestBookEntity();
        notesinfo.Id = CommonMethod.ConvertToInt(id, 0);
        notesinfo.Retrieve();
        if (notesinfo.IsPersistent)
        {
            notesinfo.IsChecked = 1;
            t.AddSaveObject(notesinfo);
            XiHuan_MessageEntity notechecknoticemessage = new XiHuan_MessageEntity();
            notechecknoticemessage.FromId   = 1;
            notechecknoticemessage.FromName = "喜换网";
            notechecknoticemessage.ToId     = notesinfo.FromId;
            notechecknoticemessage.ToName   = notesinfo.FromName;
            notechecknoticemessage.Content  = string.Format("尊敬的喜换网会员<strong>{0}</strong>,您好:<br/>您给\"{1}\"的留言\"{2}\",已经通过审核,请注意查看!",
                                                            notesinfo.FromName, notesinfo.ToName, notesinfo.Content);
            notechecknoticemessage.Flag       = byte.Parse(XiHuan_MessageFacade.MessageState.未读.ToString("d"));
            notechecknoticemessage.CreateDate = DateTime.Now;
            t.AddSaveObject(notechecknoticemessage);
        }

        #endregion

        if (t.Process())
        {
            #region   如果是对换品页面的留言,重新生成换品页
            if (CommonMethod.ConvertToInt(gid, 0) > 0)
            {
                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                Condition cgoods = rcgoods.GetNewCondition();
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, gid);
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                if (goods != null)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("../showdetail.aspx?id=" + gid, "../" + goods.DetailUrl);
                }
            }
            #endregion

            Alert("恭喜:留言审核成功!");
            BindNotes(0);
        }
        else
        {
            t.RollBack();
        }
    }
Esempio n. 9
0
    private void AddFriend(string fid, string fname)
    {
        if (!IsUserAlreadyLogin)
        {
            CommonMethod.ResponseAjaxContent(this.Page, "needlogin");
            return;
        }
        else
        {
            fname = GlobalObject.unescape(fname);
            if (fname.Equals(CurrentUserName))
            {
                CommonMethod.ResponseAjaxContent(this.Page, "self");
                return;
            }

            else
            {
                RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserFriendsEntity));
                Condition        c  = rc.GetNewCondition();
                c.AddEqualTo(XiHuan_UserFriendsEntity.__OWNERID, CurrentUserId);
                c.AddEqualTo(XiHuan_UserFriendsEntity.__FRIENDID, fid);
                rc.AddSelect(XiHuan_UserFriendsEntity.__ID);
                DataTable dt = rc.AsDataTable();
                if (dt != null && dt.Rows.Count > 0)
                {
                    CommonMethod.ResponseAjaxContent(this.Page, "already");
                    return;
                }
                else
                {
                    XiHuan_UserFriendsEntity newfriend = new XiHuan_UserFriendsEntity();
                    newfriend.OwnerId    = CurrentUserId;
                    newfriend.OwnerName  = CurrentUserName;
                    newfriend.FriendId   = CommonMethod.ConvertToInt(fid, 0);
                    newfriend.FriendName = fname;
                    newfriend.AddDate    = DateTime.Now;
                    newfriend.FriendDesc = "";
                    newfriend.Save();
                    CommonMethod.ResponseAjaxContent(this.Page, "ok");
                }
            }
        }
    }
Esempio n. 10
0
        public static int GetIdByName(string uname)
        {
            uname = CommonMethodFacade.FinalString(uname);
            RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity));
            Condition        c  = rc.GetNewCondition();

            c.AddEqualTo(XiHuan_UserInfoEntity.__USERNAME, uname);
            rc.AddSelect(XiHuan_UserInfoEntity.__ID);
            XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity;

            if (user != null)
            {
                return(user.ID);
            }
            else
            {
                return(0);
            }
        }
Esempio n. 11
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        #region 验证

        if (txtContent.Text.Trim().Length == 0)
        {
            Alert("请输入回复内容!");
            return;
        }

        #endregion

        XiHuan_GuestBookEntity note = new XiHuan_GuestBookEntity();
        note.Id = CommonMethod.ConvertToInt(Request["id"], 0);
        if (note.Id > 0)
        {
            note.Retrieve();
        }
        if (note.IsPersistent)
        {
            note.Flag         = (byte)XiHuan_UserNotesFacade.NotesState.已回复;
            note.ReplyContent = CommonMethod.ClearInputText(txtContent.Text, 200);
            note.IsChecked    = 0;
            note.Save();
            if (note.GoodsId > 0)
            {
                RetrieveCriteria rcgoods = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
                rcgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
                Condition cgoods = rcgoods.GetNewCondition();
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ID, note.GoodsId);
                cgoods.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
                XiHuan_UserGoodsEntity goods = rcgoods.AsEntity() as XiHuan_UserGoodsEntity;
                if (goods != null)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + note.GoodsId, goods.DetailUrl);
                }
            }
            Alert("恭喜:留言回复成功!");
            ExecScript(string.Format("parent.location='membernotes.aspx?type={0}';", Request["type"]));
        }
    }
Esempio n. 12
0
    private void InitPage()
    {
        if (GoodDetail == null)
        {
            return;
        }

        #region 界面显示
        RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_UserInfoEntity));
        Condition        c  = rc.GetNewCondition();
        c.AddEqualTo(XiHuan_UserInfoEntity.__ID, GoodDetail.OwnerId);
        rc.AddSelect(XiHuan_UserInfoEntity.__GENDER);
        rc.AddSelect(XiHuan_UserInfoEntity.__SCORE);
        rc.AddSelect(XiHuan_UserInfoEntity.__HUANBI);
        rc.AddSelect(XiHuan_UserInfoEntity.__GOODFEED);
        rc.AddSelect(XiHuan_UserInfoEntity.__XINYU);
        rc.AddSelect(XiHuan_UserInfoEntity.__REGISTERDATE);
        rc.AddSelect(XiHuan_UserInfoEntity.__LASTLOGINTIME);
        rc.AddSelect(XiHuan_UserInfoEntity._TelePhone);
        rc.AddSelect(XiHuan_UserInfoEntity._WangWang);
        rc.AddSelect(XiHuan_UserInfoEntity.__EMAIL);
        rc.AddSelect(XiHuan_UserInfoEntity.__QQ);
        rc.AddSelect(XiHuan_UserInfoEntity.__MSN);
        rc.AddSelect(XiHuan_UserInfoEntity.__OTHERLINK);
        XiHuan_UserInfoEntity user = rc.AsEntity() as XiHuan_UserInfoEntity;
        lblScore.Text         = user.Score.ToString();
        lblHB.Text            = user.HuanBi.ToString();
        lblGoodFeed.Text      = user.GoodFeed.ToString();
        lblXY.Text            = user.XinYu.ToString();
        lblRegisterDate.Text  = user.RegisterDate.ToString("yyyy-MM-dd");
        lblLastLoginTime.Text = user.LastLoginTime.ToString("yyyy-MM-dd");
        lblWW.Text            = CommonMethod.FinalString(user.WangWang).Length > 0 ? "&nbsp;" + string.Format(GlobalVar.BIGSTRWW, Server.UrlEncode(user.WangWang)) : string.Empty;
        lblQQ.Text            = CommonMethod.FinalString(user.QQ).Length > 0 ? string.Format(GlobalVar.QQSTR, user.QQ) : string.Empty;
        linkMethod.Text       = string.Format("&nbsp;&nbsp;电话:{0}&nbsp;&nbsp;&nbsp;&nbsp;邮箱:{1}&nbsp;&nbsp;&nbsp;&nbsp;旺旺:{5}&nbsp;&nbsp;&nbsp;&nbsp;QQ:{2}&nbsp;&nbsp;&nbsp;&nbsp;MSN:{3}<br/>&nbsp;&nbsp;其他联系方式:{4}", user.TelePhone, user.Email, user.QQ + lblQQ.Text, user.Msn, user.OtherLink, lblWW.Text);
        lblGender.Text        = CommonMethodFacade.FormatGender(user.Gender, SrcRootPath);
        #endregion

        #region 换主热门换品

        RetrieveCriteria rchotgoods        = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
        Condition        hotgoodscondition = rchotgoods.GetNewCondition();
        hotgoodscondition.AddEqualTo(XiHuan_UserGoodsEntity.__OWNERID, GoodDetail.OwnerId);
        hotgoodscondition.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
        rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO);
        rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__NAME);
        rchotgoods.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
        rchotgoods.Top = 10;
        rchotgoods.OrderBy(XiHuan_UserGoodsEntity.__VIEWCOUNT, false);
        rptHotGoods.DataSource = rchotgoods.AsDataTable();
        rptHotGoods.DataBind();

        #endregion

        #region 其它相关换品

        DataTable dtrelateGoods = Query.ProcessSql(
            @"select top 10 DefaultPhoto,Name,DetailUrl from XiHuan_UserGoods 
        with(nolock) where TypeId=" + GoodDetail.TypeId + " and OwnerId<>" + GoodDetail.OwnerId + " and IsChecked=1 order by newid() ",
            GlobalVar.DataBase_Name);
        rtpRelateGoods.DataSource = dtrelateGoods;
        rtpRelateGoods.DataBind();

        #endregion

        #region 留言
        BindNotes();
        #endregion

        #region 交换请求

        BindRequire();

        #endregion

        #region  一换品下一换品链接

        string  sqlpre  = "select top 1 Name,DetailUrl from XiHuan_UserGoods with(nolock) where Id<" + Request["id"] + " and IsChecked=1 order by Id desc;";
        string  sqlnext = "select top 1 Name,DetailUrl from XiHuan_UserGoods with(nolock) where Id>" + Request["id"] + " and IsChecked=1 order by Id asc;";
        DataSet dt      = Query.ProcessMultiSql(sqlpre + sqlnext, GlobalVar.DataBase_Name);
        lblPre.Text  = dt.Tables[0].Rows.Count > 0 ? string.Format("<a href=\"{0}\" title=\"{1}\">{2}</a>", SrcRootPath + (dt.Tables[0].Rows[0][1]), dt.Tables[0].Rows[0][0], CommonMethod.GetSubString(CommonMethod.FinalString(dt.Tables[0].Rows[0][0]), 20, "")) : "没有了";
        lblNext.Text = dt.Tables[1].Rows.Count > 0 ? string.Format("<a href=\"{0}\" title=\"{1}\">{2}</a>", SrcRootPath + (dt.Tables[1].Rows[0][1]), dt.Tables[1].Rows[0][0], CommonMethod.GetSubString(CommonMethod.FinalString(dt.Tables[1].Rows[0][0]), 20, "")) : "没有了";

        #endregion

        #region 换品图片加载
        if (GoodDetail.DefaultPhoto != null && GoodDetail.DefaultPhoto.Trim().Length > 0 && !GoodDetail.DefaultPhoto.Trim().Equals("images/none.jpg"))
        {
            RetrieveCriteria rcgoodimage = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
            Condition        cg          = rcgoodimage.GetNewCondition();
            cg.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, GoodDetail.Id);
            cg.AddEqualTo(XiHuan_GoodsImageEntity.__ISDEFAULTPHOTO, 0);
            rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGSRC);
            rcgoodimage.AddSelect(XiHuan_GoodsImageEntity.__IMGDESC);
            rcgoodimage.OrderBy(XiHuan_GoodsImageEntity.__CREATEDATE, false);
            rptGoodsImage.DataSource = rcgoodimage.AsDataTable();
            rptGoodsImage.DataBind();
        }
        #endregion
    }
Esempio n. 13
0
    protected void btnSendMaiil_Click(object sender, EventArgs e)
    {
        string           mailcontent = " <table style=\"width:98%;border: #ccc 1px solid;padding-right: 10px;padding-left: 10px;padding-bottom: 10px;padding-top: 10px;background-color: #f7f7f7; font-size:14px; color:black;\">";
        RetrieveCriteria rcGoodsPics = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));

        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__NAME);
        rcGoodsPics.AddSelect(XiHuan_UserGoodsEntity.__DETAILURL);
        Condition c = rcGoodsPics.GetNewCondition();

        c.AddEqualTo(XiHuan_UserGoodsEntity.__ISCHECKED, 1);
        c.AddNotEqualTo(XiHuan_UserGoodsEntity.__DEFAULTPHOTO, "images/none.jpg");
        rcGoodsPics.OrderBy(XiHuan_UserGoodsEntity.__CREATEDATE, false);
        rcGoodsPics.Top = 70;
        EntityContainer ecGoods = rcGoodsPics.AsEntityContainer();

        for (int i = 0; i < ecGoods.Count; i++)
        {
            int rem;
            XiHuan_UserGoodsEntity goods = ecGoods[i] as XiHuan_UserGoodsEntity;
            Math.DivRem(i, 7, out rem);
            if (rem == 0)
            {
                mailcontent += "<tr>";
            }
            else
            {
                mailcontent += string.Format("<td style=\"border: solid 1px #CCCCCC;height: 30px;text-align:center;padding: 2px 5px;\"> <a title=\"{0}\" href=\"{1}\" target=\"_blank\"><img style=\"width: 85px;height: 85px;border: solid 1px #CCCCCC;\" title=\"{0}\" src=\"{2}\" /><br/><br/>{3}</a></td>", goods.Name, "http://www.tsc8.com/" + goods.DetailUrl + "?from=email", "http://www.tsc8.com/" + goods.DefaultPhoto, CommonMethod.GetSubString(goods.Name, 6, "..."));
            }

            if (rem == 0)
            {
                mailcontent += "</tr>";
            }
        }

        mailcontent += "</table>";
        DataTable dt         = PersistenceLayer.Query.ProcessSql("select Id,UserName,Email,QQ,Msn from XiHuan_UserInfo with(nolock) where LastLoginTime<='" + DateTime.Now.AddDays(-Math.Abs(Convert.ToDouble(txtDays.Text))).ToString("yyyy-MM-dd") + "' and (Email>'' or QQ >'' or Msn >'')", GlobalVar.DataBase_Name);
        string    strMailAdd = string.Empty;
        string    email      = string.Empty;
        string    qq         = string.Empty;
        string    msn        = string.Empty;

        foreach (DataRow dr in dt.Rows)
        {
            strMailAdd = string.Empty;
            email      = CommonMethod.FinalString(dr[XiHuan_UserInfoEntity.__EMAIL]).ToLower();
            qq         = GetFinalQQ(CommonMethod.FinalString(dr[XiHuan_UserInfoEntity.__QQ]));
            msn        = CommonMethod.FinalString(dr[XiHuan_UserInfoEntity.__MSN]);
            if (IsEmail(email))
            {
                strMailAdd += email + ",";
            }
            if (IsInt(qq))
            {
                strMailAdd += qq + "@qq.com,";
            }
            if (IsEmail(msn))
            {
                strMailAdd += msn + ",";
            }
            if (strMailAdd.Length > 0)
            {
                SendMailFacade.sendEmail(strMailAdd.TrimEnd(','), "喜换网-物品交换,节约,时尚,好玩,精彩不容错过!", "<span style=\"color:blue;font-weight:bold;\">尊敬的换友<a href=\"http://www.tsc8.com/xh.aspx?id=" + dr[XiHuan_UserInfoEntity.__ID] + "&from=email\" target=\"_blank\" style=\"color:red;\">" + dr[XiHuan_UserInfoEntity.__USERNAME] + "</a>,我们注意到你有段时间没来<a href=\"http://www.tsc8.com/?from=eamil&id=" + dr[XiHuan_UserInfoEntity.__ID] + "\" target=\"_blank\" style=\"color:red;\">喜换网</a>逛逛了啊,<br/><br/>你不在的这段时间里好多朋友发布了很多好玩的换品:</span><br/><br/>" + mailcontent + "<br/><br/>现在快<a href=\"http://www.tsc8.com/?from=eamil\" target=\"_blank\">去看看</a>吧!");
            }
        }

        Alert("恭喜:邮件已经成功发送!");
    }
Esempio n. 14
0
    protected void btnDealGoodsImage_Click(object sender, EventArgs e)
    {
        string opath     = string.Empty;
        string thumpath  = string.Empty;
        string despath   = string.Empty;
        string filename  = string.Empty;
        string filepath  = string.Empty;
        string fixpath   = "images/userupload/goodsimage/";
        string extention = string.Empty;

        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        #region 默认图片的处理

        RetrieveCriteria rcGooos = new RetrieveCriteria(typeof(XiHuan_UserGoodsEntity));
        Condition        c       = rcGooos.GetNewCondition();
        if (txtGoodsId.Text.Trim().Length > 0)
        {
            c.AddEqualTo(XiHuan_UserGoodsEntity.__ID, txtGoodsId.Text);
        }
        rcGooos.AddSelect(XiHuan_UserGoodsEntity.__ID);
        rcGooos.AddSelect(XiHuan_UserGoodsEntity.__DEFAULTPHOTO);
        rcGooos.OrderBy(XiHuan_UserGoodsEntity.__ID, false);
        c.AddNotEqualTo(XiHuan_UserGoodsEntity.__DEFAULTPHOTO, "images/none.jpg");
        EntityContainer goodscontainer = rcGooos.AsEntityContainer();
        foreach (XiHuan_UserGoodsEntity goods in goodscontainer)
        {
            if (goods.DefaultPhoto != null && goods.DefaultPhoto.Length > 0)
            {
                opath     = Server.MapPath(goods.DefaultPhoto);
                filename  = Path.GetFileNameWithoutExtension(opath);
                extention = Path.GetExtension(opath);
                if (File.Exists(opath))
                {
                    filepath = fixpath + goods.CreateDate.Year + "/" + goods.CreateDate.Month + "/" + goods.CreateDate.Day + "/";
                    despath  = Server.MapPath(filepath + filename + extention);
                    if (!Directory.Exists(Server.MapPath(filepath)))
                    {
                        Directory.CreateDirectory(Server.MapPath(filepath));
                    }
                    if (!File.Exists(despath))
                    {
                        File.Copy(opath, despath, true);//复制原来的图片到新的路径
                        //File.Delete(opath);
                    }

                    thumpath = Server.MapPath(filepath + filename + GlobalVar.DefaultPhotoSize + extention);
                    PicHelper.MakeThumbnail(despath, thumpath, 85, 85);
                    thumpath = Server.MapPath(filepath + filename + GlobalVar.BigPhotoSize + extention);
                    PicHelper.MakeThumbnail(despath, thumpath, 200, 220);
                    sb.Append("Update XiHuan_UserGoods set DefaultPhoto='" + filepath + filename + GlobalVar.DefaultPhotoSize + extention + "' WHERE Id=" + goods.Id + ";");
                }
            }
        }

        #endregion

        if (sb.ToString().Length > 0)
        {
            Query.ProcessSqlNonQuery(sb.ToString(), GlobalVar.DataBase_Name);
        }
    }