Exemple #1
0
        protected void rptVideo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var id = int.Parse(e.CommandArgument.ToString());

            if (e.CommandName == "SetCurrent")
            {
                if (UserVideo.GetUserVideosByUserID(ProfileUserID).FindAll(
                        delegate(UserVideo uv) { return(uv.IsPublic); }).Count >= 3)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "cannotsetcurrent",
                                                                "alert('集锦使用数量上限为3个,请取消其他已使用的集锦。');", true);
                }
                else
                {
                    var uv = new UserVideo();
                    uv.UserVideoID = id;
                    uv.Select();

                    uv.IsPublic = true;
                    uv.Update();

                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "cannotsetcurrent",
                                                                "alert('该集锦已使用。');window.location.href = window.location.href;", true);
                }
            }
            else if (e.CommandName == "CancelCurrent")
            {
                var uv = new UserVideo();
                uv.UserVideoID = id;
                uv.Select();

                uv.IsPublic = false;
                uv.Update();

                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "cannotsetcurrent",
                                                            "alert('该集锦取消使用。');window.location.href = window.location.href;", true);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //validate user id and user name
            var awardUserID = int.Parse(tbUserID.Text);
            var sUser = Users.GetShortUserInfo(awardUserID);

            var awardUserName = tbUserName.Text;

            if (awardUserName == sUser.Username.Trim())
            {
                //process the award
                float cashIncrement = 0;
                float rp = 0;
                Guid? videoGuid = null;
                var AwardNotes = string.Empty;

                //precheck
                if (tbCash.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbCash.Text.Trim(), out cashIncrement))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof (string), "invalidCash", "alert('枪手币格式无法转换!');",
                            true);
                        return;
                    }
                }

                if (tbRP.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbRP.Text.Trim(), out rp))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof (string), "invalidRP", "alert('RP格式无法转换!');", true);
                        return;
                    }
                }

                if (tbVideoGuid.Text.Trim() != string.Empty)
                {
                    try
                    {
                        videoGuid = new Guid(tbVideoGuid.Text);
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(typeof (string), "invalidGuid", "alert('Guid格式无法转换!');",
                            true);
                        return;
                    }
                }
                if (tbNotes.Text.Trim() != string.Empty)
                {
                    AwardNotes = tbNotes.Text;
                }

                //is actually something awarded?
                var realAwarded = false;

                var awardMessageBody = "您获得奖励";

                //add cash
                if (cashIncrement != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 2, cashIncrement);

                    awardMessageBody += $" 枪手币+{cashIncrement}";

                    realAwarded = true;
                }

                //add rp
                if (rp != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 4, rp);

                    awardMessageBody += $" RP+{rp}, ";

                    realAwarded = true;
                }

                //add card
                if (!string.IsNullOrEmpty(lstPlayer.SelectedValue) && lstPlayer.SelectedValue != Guid.Empty.ToString())
                {
                    PlayerStrip.AddCard(awardUserID, awardUserName, new Guid(lstPlayer.SelectedValue),
                        cbCardActive.Checked);

                    awardMessageBody += $" 球星卡一张({(cbCardActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                //add video
                if (videoGuid != null)
                {
                    if (cbVideoActive.Checked)
                    {
                        //active
                        //UserVideo.InsertActiveVideo(awardUserID, awardUserName, videoGuid.Value);

                        var uv = new UserVideo();
                        uv.UserID = awardUserID;
                        uv.UserName = awardUserName;
                        uv.VideoGuid = videoGuid.Value;
                        uv.ActiveDate = DateTime.Now;
                        uv.UserDesc = string.Empty;
                        uv.IsPublic = false;

                        uv.Insert();
                    }
                    else
                    {
                        //inactive
                        PlayerStrip.AddCard(awardUserID, awardUserName, null, false);
                    }

                    awardMessageBody += $" 视频卡一张({(cbVideoActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                if (!string.IsNullOrEmpty(AwardNotes))
                {
                    awardMessageBody += $" 奖励原因:{AwardNotes}";
                }

                if (realAwarded)
                {
                    PlayerLog.LogHistory(awardUserID, awardUserName, PlayerHistoryType.Award,
                        new AwardDesc(cashIncrement, rp,
                            (!string.IsNullOrEmpty(lstPlayer.SelectedValue) &&
                             lstPlayer.SelectedValue != Guid.Empty.ToString()), videoGuid != null).Generate());

                    var pm = new PrivateMessageInfo();

                    pm.Msgfrom = ClubSysPrivateMessage.ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder = 0;
                    pm.Message = awardMessageBody;
                    pm.Msgto = awardUserName;
                    pm.Msgtoid = awardUserID;
                    pm.New = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject = "ACN球会系统奖励(请勿回复此系统信息)";

                    PrivateMessages.CreatePrivateMessage(pm, 0);

                    ClientScript.RegisterClientScriptBlock(typeof (string), "succeed", "alert('成功颁奖!');", true);
                }
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(typeof (string), "alert", "alert('用户ID与用户名不匹配!');", true);
            }

            InitDropDownList();
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (GRank > 0)
            {
                ddlGoalRank.SelectedValue = GRank.ToString();
            }

            if (TRank > 0)
            {
                ddlTeamRank.SelectedValue = TRank.ToString();
            }

            if (clubID > 0)
            {
                var haveVideoCount  = 0;
                var totalVideoCount = Video.Cache.GetAvailableVideosByRank(GRank, TRank).Count;

                //load data
                //DataTable dt = UserVideo.GetUserVideoByClubID(clubID);

                var list = UserVideo.GetUserVideosByClubID(clubID);

                if (list != null && list.Count > 0)
                {
                    //string expression = string.Empty;

                    if (GRank > 0 && TRank <= 0)
                    {
                        //expression = string.Format("GoalRank = {0}", GRank.ToString());
                        list =
                            list.FindAll(
                                delegate(UserVideo uv)
                        {
                            return(Video.Cache.Load(uv.VideoGuid).GoalRank.Equals(GRank.ToString()));
                        });
                    }
                    else if (GRank > 0 && TRank > 0)
                    {
                        //expression = string.Format("GoalRank = {0} AND TeamworkRank = {1}", GRank.ToString(), TRank.ToString());
                        list = list.FindAll(delegate(UserVideo uv)
                        {
                            var v = Video.Cache.Load(uv.VideoGuid);
                            return(v.GoalRank.Equals(GRank.ToString()) && v.TeamworkRank.Equals(TRank.ToString()));
                        });
                    }
                    else if (GRank <= 0 && TRank > 0)
                    {
                        //expression = string.Format("TeamworkRank = {0}", TRank.ToString());
                        list =
                            list.FindAll(
                                delegate(UserVideo uv)
                        {
                            return(Video.Cache.Load(uv.VideoGuid).TeamworkRank.Equals(TRank.ToString()));
                        });
                    }

                    //DataRow[] dr = dt.Select(expression, "ActiveDate DESC");
                    list.Sort(
                        delegate(UserVideo uv1, UserVideo uv2) { return(uv2.ActiveDate.CompareTo(uv1.ActiveDate)); });

                    haveVideoCount = list.Count;

                    rptVideo.DataSource = list;
                    rptVideo.DataBind();
                }

                ltlVideoCount.Text =
                    $"<span title=\"GRank:{GRank} | TRank:{TRank}\">已获得(总共)视频:<em>{haveVideoCount}/{totalVideoCount}</em></span>";
            }
        }
        protected void rptVideo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var id = int.Parse(e.CommandArgument.ToString());

            if (e.CommandName == "SetCurrent")
            {
                if (UserVideo.GetUserVideosByUserID(ProfileUserID).FindAll(
                    delegate(UserVideo uv) { return uv.IsPublic; }).Count >= 3)
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof (string), "cannotsetcurrent",
                        "alert('集锦使用数量上限为3个,请取消其他已使用的集锦。');", true);
                }
                else
                {
                    var uv = new UserVideo();
                    uv.UserVideoID = id;
                    uv.Select();

                    uv.IsPublic = true;
                    uv.Update();

                    Page.ClientScript.RegisterClientScriptBlock(typeof (string), "cannotsetcurrent",
                        "alert('该集锦已使用。');window.location.href = window.location.href;", true);
                }
            }
            else if (e.CommandName == "CancelCurrent")
            {
                var uv = new UserVideo();
                uv.UserVideoID = id;
                uv.Select();

                uv.IsPublic = false;
                uv.Update();

                Page.ClientScript.RegisterClientScriptBlock(typeof (string), "cannotsetcurrent",
                    "alert('该集锦取消使用。');window.location.href = window.location.href;", true);
            }
        }
Exemple #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //validate user id and user name
            var awardUserID = int.Parse(tbUserID.Text);
            var sUser       = Users.GetShortUserInfo(awardUserID);

            var awardUserName = tbUserName.Text;

            if (awardUserName == sUser.Username.Trim())
            {
                //process the award
                float cashIncrement = 0;
                float rp            = 0;
                Guid? videoGuid     = null;
                var   AwardNotes    = string.Empty;

                //precheck
                if (tbCash.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbCash.Text.Trim(), out cashIncrement))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidCash", "alert('枪手币格式无法转换!');",
                                                               true);
                        return;
                    }
                }

                if (tbRP.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbRP.Text.Trim(), out rp))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidRP", "alert('RP格式无法转换!');", true);
                        return;
                    }
                }

                if (tbVideoGuid.Text.Trim() != string.Empty)
                {
                    try
                    {
                        videoGuid = new Guid(tbVideoGuid.Text);
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidGuid", "alert('Guid格式无法转换!');",
                                                               true);
                        return;
                    }
                }
                if (tbNotes.Text.Trim() != string.Empty)
                {
                    AwardNotes = tbNotes.Text;
                }

                //is actually something awarded?
                var realAwarded = false;

                var awardMessageBody = "您获得奖励";

                //add cash
                if (cashIncrement != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 2, cashIncrement);

                    awardMessageBody += $" 枪手币+{cashIncrement}";

                    realAwarded = true;
                }

                //add rp
                if (rp != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 4, rp);

                    awardMessageBody += $" RP+{rp}, ";

                    realAwarded = true;
                }

                //add card
                if (!string.IsNullOrEmpty(lstPlayer.SelectedValue) && lstPlayer.SelectedValue != Guid.Empty.ToString())
                {
                    PlayerStrip.AddCard(awardUserID, awardUserName, new Guid(lstPlayer.SelectedValue),
                                        cbCardActive.Checked);

                    awardMessageBody += $" 球星卡一张({(cbCardActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                //add video
                if (videoGuid != null)
                {
                    if (cbVideoActive.Checked)
                    {
                        //active
                        //UserVideo.InsertActiveVideo(awardUserID, awardUserName, videoGuid.Value);

                        var uv = new UserVideo();
                        uv.UserID     = awardUserID;
                        uv.UserName   = awardUserName;
                        uv.VideoGuid  = videoGuid.Value;
                        uv.ActiveDate = DateTime.Now;
                        uv.UserDesc   = string.Empty;
                        uv.IsPublic   = false;

                        uv.Insert();
                    }
                    else
                    {
                        //inactive
                        PlayerStrip.AddCard(awardUserID, awardUserName, null, false);
                    }

                    awardMessageBody += $" 视频卡一张({(cbVideoActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                if (!string.IsNullOrEmpty(AwardNotes))
                {
                    awardMessageBody += $" 奖励原因:{AwardNotes}";
                }

                if (realAwarded)
                {
                    PlayerLog.LogHistory(awardUserID, awardUserName, PlayerHistoryType.Award,
                                         new AwardDesc(cashIncrement, rp,
                                                       (!string.IsNullOrEmpty(lstPlayer.SelectedValue) &&
                                                        lstPlayer.SelectedValue != Guid.Empty.ToString()), videoGuid != null).Generate());

                    var pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysPrivateMessage.ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder       = 0;
                    pm.Message      = awardMessageBody;
                    pm.Msgto        = awardUserName;
                    pm.Msgtoid      = awardUserID;
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = "ACN球会系统奖励(请勿回复此系统信息)";

                    PrivateMessages.CreatePrivateMessage(pm, 0);

                    ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('成功颁奖!');", true);
                }
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "alert('用户ID与用户名不匹配!');", true);
            }

            InitDropDownList();
        }