Пример #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"] + "'");
            }
        }
    }
Пример #2
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();
            }
        }
    }
Пример #3
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();
                }
            }
        }
    }
Пример #4
0
    protected void lnkSend_Click(object sender, EventArgs e)
    {
        if (IsUserAlreadyLogin)
        {
            #region 交换请求

            Transaction t         = new Transaction();
            string      detailurl = Microsoft.JScript.GlobalObject.unescape(CommonMethod.FinalString(Request["detailurl"]));
            XiHuan_UserGoodsChangeRequireEntity NewChangeRequire = new XiHuan_UserGoodsChangeRequireEntity();
            NewChangeRequire.GoodsId    = CommonMethod.ConvertToInt(Request["goodsid"], 0);
            NewChangeRequire.GoodsName  = Microsoft.JScript.GlobalObject.unescape(CommonMethod.FinalString(Request["goodsname"]));
            NewChangeRequire.OwnerId    = CommonMethod.ConvertToInt(Request["ownerid"], 0);
            NewChangeRequire.OwnerName  = Microsoft.JScript.GlobalObject.unescape(CommonMethod.FinalString(Request["ownername"]));
            NewChangeRequire.SenderId   = CurrentUserId;
            NewChangeRequire.SenderName = CurrentUserName;
            if (rbtMethodMoney.Checked)
            {
                NewChangeRequire.RequireType     = (byte)XiHuan_ChangeRequireFacade.ChangeRequireType.Money交换;
                NewChangeRequire.RequireDescribe = txtMoney.Text.Trim() + "Money ";
            }
            if (rbtMethodGoods.Checked)
            {
                string goodsid = hidGoodsId.Value.Trim().TrimEnd(';');
                if (goodsid.Length > 0)
                {
                    NewChangeRequire.RequireType = (byte)XiHuan_ChangeRequireFacade.ChangeRequireType.换品交换;
                    string[] ids = goodsid.Split(';');
                    for (int i = 0; i < ids.Length; i++)
                    {
                        string[] single = ids[i].ToString().Split(',');
                        NewChangeRequire.SelectToChangeGoodsId   += single[0] + ",";
                        NewChangeRequire.SelectToChangeGoodsName += single[1] + ",";
                        NewChangeRequire.RequireDescribe         += string.Format("<a href=\"{0}\" title=\"查看换品信息\" target=\"_blank\" >{1}</a>", SrcRootPath + single[2], single[1]) + "&nbsp;,";
                    }
                }
            }

            NewChangeRequire.Flag        = (byte)XiHuan_ChangeRequireFacade.ChangeRequireState.新发起;
            NewChangeRequire.RequireDate = DateTime.Now;
            if (chkSecret.Checked)
            {
                NewChangeRequire.IsSecret = 1;
            }
            t.AddSaveObject(NewChangeRequire);

            #endregion

            #region 给请求接收者发短消息

            XiHuan_MessageEntity ExchangeNoticeMesage = new XiHuan_MessageEntity();
            ExchangeNoticeMesage.ToId     = NewChangeRequire.OwnerId;
            ExchangeNoticeMesage.ToName   = NewChangeRequire.OwnerName;
            ExchangeNoticeMesage.FromId   = 0;
            ExchangeNoticeMesage.FromName = CurrentUserName;
            string strLinkInfo = CommonMethod.FinalString(CurrentUser.TelePhone).Length > 0 ? "电话:" + CurrentUser.TelePhone.Trim() + "," : "";
            strLinkInfo += CommonMethod.FinalString(CurrentUser.QQ).Length > 0 ? "QQ:" + CurrentUser.QQ.Trim() + "," : "";
            strLinkInfo += CommonMethod.FinalString(CurrentUser.Msn).Length > 0 ? "MSN:" + CurrentUser.Msn.Trim() + "," : "";
            strLinkInfo += CommonMethod.FinalString(CurrentUser.Email).Length > 0 ? "Email:" + CurrentUser.Email.Trim() + "," : "";
            ExchangeNoticeMesage.Content = string.Format("尊敬的<strong>{0}</strong>:<br/><a href=\"{1}\" target=\"_blank\">{2}</a>想用{3}换你的<a href=\"{4}\" target=\"_blank\">{5}</a>!请注意查看,{6}祝你好运!",
                                                         NewChangeRequire.OwnerName, SrcRootPath + "xh.aspx?id=" + NewChangeRequire.SenderId,
                                                         NewChangeRequire.SenderName, NewChangeRequire.RequireDescribe, SrcRootPath + detailurl,
                                                         NewChangeRequire.GoodsName, strLinkInfo.Length > 0 ? "你可以通过" + strLinkInfo + "与" + (CurrentUser.Gender == 1 ? "他" : "她") + "联系," : "");
            ExchangeNoticeMesage.CreateDate = DateTime.Now;
            ExchangeNoticeMesage.Flag       = (byte)XiHuan_MessageFacade.MessageState.未读;
            t.AddSaveObject(ExchangeNoticeMesage);

            #endregion

            try
            {
                t.Process(); Alert("您的交换请求已经成功发送给换主,祝您好运 ^_^!您还可以通过QQ,站内信留言联系换主进行交换!");
                CommonMethod.readAspxAndWriteHtmlSoruce("showdetail.aspx?id=" + CommonMethod.FinalString(Request["goodsid"]), detailurl);
                ExecScript(string.Format("parent.location=\"{0}\";", SrcRootPath + detailurl + "?s=" + new Random().Next(int.MaxValue)));
            }
            catch
            {
                t.RollBack();
                Alert("抱歉,发送交换请求出错,请稍候重试!");
            }
        }
    }