コード例 #1
0
ファイル: sys_notes.aspx.cs プロジェクト: gangqiang/xihuan
    private void DelNotes(string id)
    {
        DeleteCriteria dcnote = new DeleteCriteria(typeof(XiHuan_GuestBookEntity));
        Condition      cnote  = dcnote.GetNewCondition();

        cnote.AddEqualTo(XiHuan_GuestBookEntity.__ID, id);
        if (dcnote.Perform() > 0)
        {
            Alert("恭喜:留言已成功删除!");
            BindNotes(0);
        }
    }
コード例 #2
0
    protected void lnkDelMessage_Click(object sender, EventArgs e)
    {
        DeleteCriteria dcmessage = new DeleteCriteria(typeof(XiHuan_MessageEntity));
        Condition      cmessage  = dcmessage.GetNewCondition();

        cmessage.AddEqualTo(XiHuan_MessageEntity.__ID, hidId.Value);
        if (dcmessage.Perform() > 0)
        {
            Alert("恭喜:短消息已成功删除!");
            if (CommonMethod.FinalString(Request["type"]) == "receive")
            {
                BindReceive();
            }
            else
            {
                BindSend();
            }
        }
    }
コード例 #3
0
 protected void lnkDelMultiMessage_Click(object sender, EventArgs e)
 {
     string[] mid = hidId.Value.Trim().TrimEnd(',').Split(',');
     if (mid.Length > 0)
     {
         DeleteCriteria dcnotes = new DeleteCriteria(typeof(XiHuan_MessageEntity));
         Condition      cnotes  = dcnotes.GetNewCondition();
         cnotes.AddIn(XiHuan_MessageEntity.__ID, mid);
         if (dcnotes.Perform() > 0)
         {
             Alert("恭喜:选中的短消息已成功删除!");
             if (CommonMethod.FinalString(Request["type"]) == "receive")
             {
                 BindReceive();
             }
             else
             {
                 BindSend();
             }
         }
     }
 }
コード例 #4
0
ファイル: goodlist.aspx.cs プロジェクト: gangqiang/xihuan
    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();
                }
            }
        }
    }
コード例 #5
0
ファイル: sys_goods.aspx.cs プロジェクト: gangqiang/xihuan
    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();
            }
        }
    }