Exemple #1
0
    protected void btnLogin_Click1(object sender, EventArgs e)
    {
        int id = CommonMethod.ConvertToInt(Request["id"], 0);

        if (id > 0)
        {
            XiHuan_UserGoodsChangeRequireEntity require = new XiHuan_UserGoodsChangeRequireEntity();
            require.Id = id;
            require.Retrieve();
            if (require.IsPersistent)
            {
                require.Flag = byte.Parse(rbtFlag.SelectedValue);
                require.Save();
                string ids = CommonMethod.FinalString(require.SelectToChangeGoodsId).Length > 0 ? require.SelectToChangeGoodsId + require.GoodsId.ToString() : require.GoodsId.ToString();
                Query.ProcessSqlNonQuery(string.Format("update XiHuan_UserGoods set GoodState=" + rbtFlag.SelectedValue.Trim() + " where Id in ({0}) ", ids), GlobalVar.DataBase_Name);
                XiHuan_UserGoodsEntity goods = new XiHuan_UserGoodsEntity();
                goods.Id = require.GoodsId;
                goods.Retrieve();
                if (goods.IsPersistent)
                {
                    CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + goods.Id, goods.DetailUrl);
                }
                Alert("恭喜:状态更改成功!");
                ExecScript("parent.location='userequst.aspx?type=" + Request["type"] + "'");
            }
        }
    }
    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
                        }
                    }
                }
            }
        }
    }
Exemple #3
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();
        }
    }
Exemple #4
0
    protected void lnkDelMultiMessage_Click(object sender, EventArgs e)
    {
        string[] mid = hidId.Value.Trim().TrimEnd(',').Split(',');
        if (mid.Length > 0)
        {
            for (int i = 0; i < mid.Length; i++)
            {
                int id = CommonMethod.ConvertToInt(mid[i], 0);
                if (id > 0)
                {
                    XiHuan_UserGoodsChangeRequireEntity note = new XiHuan_UserGoodsChangeRequireEntity();
                    note.Id = id;
                    note.Retrieve();
                    if (note.IsPersistent && note.Flag == (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.新发起)
                    {
                        if (hidType.Value.Trim().Equals("Send"))
                        {
                            note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.已取消;
                        }
                        else
                        {
                            note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.考虑中;
                        }
                        note.Save();
                        XiHuan_UserGoodsEntity goods = new XiHuan_UserGoodsEntity();
                        goods.Id = note.GoodsId;
                        goods.Retrieve();
                        if (goods.IsPersistent)
                        {
                            CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + note.GoodsId, goods.DetailUrl);
                        }
                    }
                }
            }

            Alert("恭喜:操作成功!");
            if (CommonMethod.FinalString(Request["type"]) == "receive")
            {
                BindReceive();
            }
            else
            {
                BindSend();
            }
        }
    }
Exemple #5
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"]));
        }
    }
Exemple #6
0
    private void LoadGoodInfo()
    {
        TitleName.Text = "修改换品";
        btnSubmit.Text = "保存修改";
        XiHuan_UserGoodsEntity goodinfo = XiHuan_UserGoodsEntityAction.RetrieveAXiHuan_UserGoodsEntity(CommonMethod.ConvertToInt(Request["id"], 0));

        if (goodinfo != null)
        {
            txtGoodName.Text = goodinfo.Name;
            chkTJ.Checked    = (goodinfo.IsTJ == 1);
            CommonMethod.SelectFlg(ddlGoodType, goodinfo.TypeId.ToString());
            CommonMethod.BindDrop(ddlGoodChildType, XiHuan_GoodsTypeFacade.GetInstance().GetGoodsChildType(goodinfo.TypeId.ToString()), "Name", "Id");
            CommonMethod.SelectFlg(ddlGoodChildType, goodinfo.ChildId.ToString());
            CommonMethod.SelectFlg(ddlGoodType1, goodinfo.HopeToChangeTypeId.ToString());
            CommonMethod.BindDrop(ddlGoodChildType1, XiHuan_GoodsTypeFacade.GetInstance().GetGoodsChildType(goodinfo.HopeToChangeChildTypeId.ToString()), "Name", "Id");
            CommonMethod.SelectFlg(ddlGoodChildType1, goodinfo.HopeToChangeChildTypeId.ToString());
            trimage.Visible   = uploadimage.Visible = false;
            txtGoodDesc.Value = goodinfo.Description;
            CommonMethod.SelectFlg(ddlNewOldDeep, goodinfo.NewDeep.ToString());
            chkValidCity.Checked     = (goodinfo.OnlyCityChange == 1);
            chkValidSchool.Checked   = (goodinfo.OnlySchoolChange == 1);
            txtHopeToChangeDesc.Text = goodinfo.HopeToChangeDesc;
        }
    }
Exemple #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (!IsUserAlreadyLogin)
        {
            MemberCenterPageRedirect("", "goodsadd.aspx" + (IsEdit ? "?id=" + CommonMethod.FinalString(Request["id"]) : ""));
        }
        else
        {
            #region  务器端验证 以后完善

            #endregion

            #region 保存换品信息

            Transaction            t        = new Transaction();
            XiHuan_UserGoodsEntity newgoods = null;
            if (IsEdit)
            {
                newgoods = XiHuan_UserGoodsEntityAction.RetrieveAXiHuan_UserGoodsEntity(CommonMethod.ConvertToInt(Request["id"], 0));
            }
            else
            {
                newgoods = new XiHuan_UserGoodsEntity();
            }
            newgoods.OwnerId                 = CurrentUserId;
            newgoods.OwnerName               = CurrentUserName;
            newgoods.Name                    = txtGoodName.Text.Trim();
            newgoods.IsTJ                    = chkTJ.Checked ? (byte)1 : (byte)0;
            newgoods.TypeId                  = CommonMethod.ConvertToInt(ddlGoodType.SelectedValue, 0);
            newgoods.ChildId                 = CommonMethod.ConvertToInt(ddlGoodChildType.SelectedValue, 0);
            newgoods.IsHavePhoto             = rbtYes.Checked ? (byte)XiHuan_UserGoodsFacade.IsGoodHavePhoto.  : (byte)XiHuan_UserGoodsFacade.IsGoodHavePhoto.无;
            newgoods.Description             = txtGoodDesc.Value.Trim();
            newgoods.NewDeep                 = byte.Parse(ddlNewOldDeep.SelectedValue.Trim());
            newgoods.OnlyCityChange          = chkValidCity.Checked ? (byte)1 : (byte)0;
            newgoods.OnlySchoolChange        = chkValidSchool.Checked ? (byte)1 : (byte)0;
            newgoods.HopeToChangeTypeId      = CommonMethod.ConvertToInt(ddlGoodType1.SelectedValue, 0);
            newgoods.HopeToChangeChildTypeId = CommonMethod.ConvertToInt(ddlGoodChildType1.SelectedValue, 0);
            newgoods.HopeToChangeDesc        = txtHopeToChangeDesc.Text.Trim();
            newgoods.ProvinceId              = CurrentUser.ProvinceId;
            newgoods.ProvinceName            = CurrentUser.ProvinceName;
            newgoods.CityId                  = CurrentUser.CityId;
            newgoods.CityName                = CurrentUser.CityName;
            newgoods.AreaId                  = CurrentUser.AreaId;
            newgoods.AreaName                = CurrentUser.AreaName;
            newgoods.SchoolId                = CurrentUser.SchoolId;
            newgoods.SchoolName              = CurrentUser.SchoolName;
            if (!IsEdit)
            {
                newgoods.CreateDate = DateTime.Now;
                newgoods.ViewCount  = new Random().Next(10, 30);
                newgoods.GoodState  = (byte)XiHuan_UserGoodsFacade.GoodsState.新登记;
            }
            newgoods.IsChecked = (byte)(SystemConfigFacade.Instance().IsGoodsAddNeedCheck ? 0 : 1);
            t.DoSaveObject(newgoods);

            if (!IsEdit)
            {
                #region 换品图片上传

                string gooddefaultphoto = string.Empty;

                if (rbtYes.Checked)
                {
                    string             extention  = string.Empty;
                    int                filesize   = 0;
                    string             filepath   = string.Empty;
                    string             savepath   = string.Empty;
                    string             filename   = string.Empty;
                    HttpFileCollection goodimages = HttpContext.Current.Request.Files;
                    for (int i = 0; i < goodimages.Count; i++)
                    {
                        HttpPostedFile currentfile = goodimages[i];
                        extention = Path.GetExtension(currentfile.FileName);
                        filesize  = currentfile.ContentLength;
                        filepath  = "images/userupload/goodsimage/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/";
                        //不符合条件的直接跳过,不进行保存
                        if (!(currentfile.FileName.Length > 0) || filesize == 0 || !CommonMethod.IsUploadImageValid("", extention) || filesize > 500 * 1024)
                        {
                            continue;
                        }
                        else
                        {
                            if (!Directory.Exists(Server.MapPath(filepath)))
                            {
                                Directory.CreateDirectory(Server.MapPath(filepath));
                            }

                            filename = newgoods.Id.ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssfff");
                            currentfile.SaveAs(Server.MapPath(filepath + filename + extention));
                            XiHuan_GoodsImageEntity newgoodimage = new XiHuan_GoodsImageEntity();
                            newgoodimage.GoodsId    = newgoods.Id;
                            newgoodimage.GoodsName  = newgoods.Name;
                            newgoodimage.ImgSrc     = filepath + filename + extention;
                            newgoodimage.CreateDate = DateTime.Now;

                            if (i == 0)
                            {
                                gooddefaultphoto            = filepath + filename + GlobalVar.DefaultPhotoSize + extention;
                                newgoodimage.IsDefaultPhoto = 1;
                                //生成不同规格的图片
                                PicHelper.MakeThumbnail(Server.MapPath(filepath + filename + extention), Server.MapPath(filepath + filename + GlobalVar.DefaultPhotoSize + extention), 85, 85);
                                PicHelper.MakeThumbnail(Server.MapPath(filepath + filename + extention), Server.MapPath(filepath + filename + GlobalVar.BigPhotoSize + extention), 200, 220);
                            }

                            t.DoSaveObject(newgoodimage);
                        }
                    }
                }

                #endregion

                #region 默认图片保存
                string sql = string.Format("update XiHuan_UserGoods set DefaultPhoto='{0}' where Id={1} ", gooddefaultphoto.Length > 0 ? gooddefaultphoto : "images/none.jpg", newgoods.Id);
                t.DoSqlNonQueryString(sql, GlobalVar.DataBase_Name);
                #endregion

                #region 更新用户换品数量和积分,换币

                string updategoodsnumber = string.Format(@"update XiHuan_UserInfo set GoodsNumber=GoodsNumber+1, Score=Score+{0},HuanBi=HuanBi+{1} where Id={2}"
                                                         , SystemConfigFacade.Instance().AddScoreByAddGoods(), SystemConfigFacade.Instance().AddHBByAddGoods(), CurrentUser.ID);
                t.DoSqlNonQueryString(updategoodsnumber, GlobalVar.DataBase_Name);

                #endregion

                #region 浏览人

                XiHuan_GoodsViewUserEntity view = new XiHuan_GoodsViewUserEntity();
                view.GoodsId          = newgoods.Id;
                view.Type             = 0;
                view.VisitDate        = DateTime.Now;
                view.VisitorName      = "喜换网";
                view.VisitorId        = 1;
                view.VisitorHeadImage = "images/userupload/20092113032102_1.png";
                t.DoSaveObject(view);

                #endregion
            }


            try
            {
                string detailurl = "goods/" + newgoods.CreateDate.Year + "/" + newgoods.CreateDate.Month + "/" + newgoods.CreateDate.Day + "/goods" + newgoods.Id + ".html";
                t.DoSqlNonQueryString("update XiHuan_UserGoods set DetailUrl='" + detailurl + "' where Id=" + newgoods.Id, GlobalVar.DataBase_Name);
                t.Commit();
                if (!SystemConfigFacade.Instance().IsGoodsAddNeedCheck)
                {
                    DataTable dt = Query.ProcessSql("select Id,DetailUrl,GoodState from XiHuan_UserGoods with(nolock) where OwnerId= " + CurrentUserId + " and IsChecked=1 ", GlobalVar.DataBase_Name);
                    foreach (DataRow dr in dt.Rows)
                    {
                        CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + dr["Id"], dr["DetailUrl"].ToString());
                    }
                }
                if (IsEdit)
                {
                    Alert("恭喜:换品信息保存成功" + (SystemConfigFacade.Instance().IsGoodsAddNeedCheck ? ",我们会尽快进行审核" : string.Empty) + "^_^!");
                }
                else
                {
                    Alert("恭喜:换品登记成功" + (SystemConfigFacade.Instance().IsGoodsAddNeedCheck ? ",我们会尽快进行审核" : string.Empty) + "^_^!");
                    SendMailFacade.sendEmail("[email protected],[email protected]", "有人在喜换网发换品了", "有人在喜换网发换品:" + txtGoodName.Text);
                }

                ExecScript("window.location='goodlist.aspx?s='+Math.random();");
            }

            catch (Exception ex)
            {
                t.RollBack();
                Alert("抱歉:换品保存出错," + ex.Message);
                return;
            }
            #endregion
        }
    }
Exemple #8
0
    protected void lnkDelMessage_Click(object sender, EventArgs e)
    {
        int id = CommonMethod.ConvertToInt(hidId.Value, 0);

        if (id > 0)
        {
            XiHuan_UserGoodsChangeRequireEntity note = new XiHuan_UserGoodsChangeRequireEntity();
            note.Id = id;
            note.Retrieve();
            if (note.IsPersistent)
            {
                if (CommonMethod.FinalString(Request["type"]) == "receive")
                {
                    if (note.Flag != (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.已取消)
                    {
                        if (hidType.Value.Trim() != "Ref")
                        {
                            string ids = (CommonMethod.FinalString(note.SelectToChangeGoodsId).Length > 0 ? note.SelectToChangeGoodsId + note.GoodsId.ToString() : note.GoodsId.ToString());
                            Query.ProcessSqlNonQuery(string.Format("update XiHuan_UserGoods set GoodState=" + XiHuan_UserGoodsFacade.GoodsState.考虑中.ToString("d") + " where Id in ({0}) ",
                                                                   ids), GlobalVar.DataBase_Name);
                            note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.考虑中;
                        }
                        else
                        {
                            note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.换主拒绝;
                        }
                    }
                    note.Save();
                    XiHuan_UserGoodsEntity goods = new XiHuan_UserGoodsEntity();
                    goods.Id = note.GoodsId;
                    goods.Retrieve();
                    if (goods.IsPersistent)
                    {
                        CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + note.GoodsId, goods.DetailUrl);
                    }
                    Alert("恭喜:操作成功!");
                    BindReceive();
                }
                else
                {
                    if (note.Flag != (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.新发起)
                    {
                        if (CommonMethod.FinalString(note.SelectToChangeGoodsId).Length > 0)
                        {
                            Query.ProcessSqlNonQuery(string.Format("update XiHuan_UserGoods set GoodState=" + XiHuan_UserGoodsFacade.GoodsState.新登记.ToString("d") + " where Id in ({0}) ",
                                                                   note.SelectToChangeGoodsId.TrimEnd(',')), GlobalVar.DataBase_Name);
                        }
                    }
                    if (hidType.Value.Trim() != "Recover")
                    {
                        note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.已取消;
                    }
                    else
                    {
                        note.Flag = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.新发起;
                    }
                    note.Save();
                    XiHuan_UserGoodsEntity goods = new XiHuan_UserGoodsEntity();
                    goods.Id = note.GoodsId;
                    goods.Retrieve();
                    if (goods.IsPersistent)
                    {
                        CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + note.GoodsId, goods.DetailUrl);
                    }
                    Alert("恭喜:操作成功!");
                    BindSend();
                }
            }
        }
    }
Exemple #9
0
    protected void lnkDel_Click(object sender, EventArgs e)
    {
        int         gid = CommonMethod.ConvertToInt(hidGoodId.Value.Trim(), 0);
        Transaction t   = new Transaction();

        if (gid > 0)
        {
            XiHuan_UserGoodsEntity del = XiHuan_UserGoodsEntityAction.RetrieveAXiHuan_UserGoodsEntity(gid);
            if (del != null)
            {
                if (del.GoodState == (byte)XiHuan_UserGoodsFacade.GoodsState.交换中)
                {
                    Alert("此换品正处于交换中的状态不能删除!");
                    return;
                }
                else
                {
                    t.AddDeleteObject(del);

                    #region  除换品信息的详细页面

                    if (File.Exists(Server.MapPath(del.DetailUrl)))
                    {
                        File.Delete(Server.MapPath(del.DetailUrl));
                    }

                    #endregion

                    #region 换品删除时,同时删除其图片信息,浏览信息

                    RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
                    Condition        c  = rc.GetNewCondition();
                    c.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, gid);
                    EntityContainer imagecontainer  = rc.AsEntityContainer();
                    string          imgphysicalsrc  = string.Empty;
                    string          imgname         = string.Empty;
                    string          thumphysicalsrc = string.Empty;
                    foreach (XiHuan_GoodsImageEntity goodimage in imagecontainer)
                    {
                        imgphysicalsrc = Server.MapPath(goodimage.ImgSrc);
                        if (File.Exists(imgphysicalsrc))
                        {
                            File.Delete(imgphysicalsrc);
                        }
                        imgname         = Path.GetFileNameWithoutExtension(imgphysicalsrc);
                        thumphysicalsrc = imgphysicalsrc.Replace(imgname, imgname + GlobalVar.DefaultPhotoSize);
                        if (File.Exists(thumphysicalsrc))
                        {
                            File.Delete(thumphysicalsrc);
                        }
                        thumphysicalsrc = imgphysicalsrc.Replace(imgname, imgname + GlobalVar.BigPhotoSize);
                        if (File.Exists(thumphysicalsrc))
                        {
                            File.Delete(thumphysicalsrc);
                        }
                        t.AddDeleteObject(goodimage);
                    }

                    DeleteCriteria delhistory = new DeleteCriteria(typeof(XiHuan_GoodsViewUserEntity));
                    Condition      chis       = delhistory.GetNewCondition();
                    chis.AddEqualTo(XiHuan_GoodsViewUserEntity.__GOODSID, gid);
                    chis.AddEqualTo(XiHuan_GoodsViewUserEntity._TYPE, 0);
                    t.AddDeleteCriteria(delhistory);

                    #endregion

                    #region 更新用户换品数量

                    t.AddSqlString("update XiHuan_UserInfo set GoodsNumber=GoodsNumber-1 where Id=" + del.OwnerId, GlobalVar.DataBase_Name);

                    #endregion

                    t.Process();
                    Alert("恭喜:换品删除成功!");
                    BindData();
                }
            }
        }
    }
Exemple #10
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("恭喜:邮件已经成功发送!");
    }
Exemple #11
0
    private void DelGoods(string id)
    {
        int         gid = CommonMethod.ConvertToInt(id, 0);
        Transaction t   = new Transaction();

        if (gid > 0)
        {
            XiHuan_UserGoodsEntity del = XiHuan_UserGoodsEntityAction.RetrieveAXiHuan_UserGoodsEntity(gid);
            if (del != null)
            {
                t.AddDeleteObject(del);

                #region  除换品信息的详细页面

                if (File.Exists(Server.MapPath("../" + del.DetailUrl)))
                {
                    File.Delete(Server.MapPath("../" + del.DetailUrl));
                }

                #endregion

                #region 换品删除时,同时删除其图片信息,浏览信息

                string           imgphysicalsrc  = string.Empty;
                string           imgname         = string.Empty;
                string           thumphysicalsrc = string.Empty;
                RetrieveCriteria rc = new RetrieveCriteria(typeof(XiHuan_GoodsImageEntity));
                Condition        c  = rc.GetNewCondition();
                c.AddEqualTo(XiHuan_GoodsImageEntity.__GOODSID, gid);
                EntityContainer imagecontainer = rc.AsEntityContainer();
                foreach (XiHuan_GoodsImageEntity goodimage in imagecontainer)
                {
                    imgphysicalsrc = Server.MapPath("../" + goodimage.ImgSrc);
                    if (File.Exists(imgphysicalsrc))
                    {
                        File.Delete(imgphysicalsrc);
                    }
                    imgname = Path.GetFileNameWithoutExtension(imgphysicalsrc);
                    //如果存在缩略图,一起进行删除
                    thumphysicalsrc = imgphysicalsrc.Replace(imgname, imgname + GlobalVar.DefaultPhotoSize);
                    if (File.Exists(thumphysicalsrc))
                    {
                        File.Delete(thumphysicalsrc);
                    }
                    //如果存在缩略图,一起进行删除
                    thumphysicalsrc = imgphysicalsrc.Replace(imgname, imgname + GlobalVar.BigPhotoSize);
                    if (File.Exists(thumphysicalsrc))
                    {
                        File.Delete(thumphysicalsrc);
                    }
                    t.AddDeleteObject(goodimage);
                }

                DeleteCriteria delhistory = new DeleteCriteria(typeof(XiHuan_GoodsViewUserEntity));
                Condition      chis       = delhistory.GetNewCondition();
                chis.AddEqualTo(XiHuan_GoodsViewUserEntity.__GOODSID, gid);
                chis.AddEqualTo(XiHuan_GoodsViewUserEntity._TYPE, 0);
                t.AddDeleteCriteria(delhistory);

                #endregion

                #region 更新用户换品数量
                t.AddSqlString("update XiHuan_UserInfo set GoodsNumber=GoodsNumber-1 where Id=" + del.OwnerId, GlobalVar.DataBase_Name);
                #endregion

                t.Process();
                Alert("恭喜:换品删除成功!");
                BindGoods();
            }
        }
    }