コード例 #1
0
 /// <summary>
 /// 绑定任务信息
 /// </summary>
 protected void BindTask()
 {
     Game.Entity.Platform.TaskInfo taskInfo = FacadeManage.aidePlatformFacade.GetTaskInfoByID(IntParam);
     if (taskInfo != null)
     {
         txtTaskName.Text           = taskInfo.TaskName;
         ddlTaskType.SelectedValue  = taskInfo.TaskType.ToString();
         ddlGameKind.SelectedValue  = taskInfo.KindID.ToString();
         txtStandardAwardGold.Text  = taskInfo.StandardAwardGold.ToString();
         txtStandardAwardMedal.Text = taskInfo.StandardAwardMedal.ToString();
         txtMemberAwardGold.Text    = taskInfo.MemberAwardGold.ToString();
         txtMemberAwardMedal.Text   = taskInfo.MemberAwardMedal.ToString();
         txtTimeLimit.Text          = taskInfo.TimeLimit.ToString();
         txtTaskDescription.Text    = taskInfo.TaskDescription;
         rblUserType.SelectedValue  = taskInfo.UserType.ToString();
         //if( taskInfo.TaskType == (int)EnumerationList.TaskType.比赛任务 )
         //{
         //    trMatchID.Visible = true;
         //    try
         //    {
         //        ddlMatchID.SelectedValue = taskInfo.MatchID.ToString();
         //    }
         //    catch { }
         //}
         //else
         //{
         //    trMatchID.Visible = false;
         //}
         txtInnings.Text = taskInfo.Innings.ToString();
     }
 }
コード例 #2
0
 /// <summary>
 /// 数据绑定
 /// </summary>
 private void BindData()
 {
     Game.Entity.Platform.TaskInfo info = FacadeManage.aidePlatformFacade.GetTaskInfo(IntParam);
     if (info != null)
     {
         txtTaskName.Text        = info.TaskName;
         txtDescription.Text     = info.TaskDescription;
         txtInnings.Text         = info.Innings.ToString();
         ddlKindID.SelectedValue = info.KindID.ToString();
         BindDataRoom();
         //ddlMatchID.SelectedValue = info.MatchID.ToString();
         ddlServerID.SelectedValue = info.ServerID.ToString();
         ddlTaskType.SelectedValue = info.TaskType.ToString();
         ddlTimeType.SelectedValue = info.TimeType.ToString();
         ddlUserType.SelectedValue = info.UserType.ToString();
         ddlState.SelectedValue    = info.Nullity.ToString();
         //txtSortID.Text = info.SortID.ToString();
         if (!string.IsNullOrEmpty(info.TaskAward))
         {
             string[] awards = null;
             if (info.TaskAward.IndexOf(';') > 0)
             {
                 string[] arry = info.TaskAward.Split(';');
                 foreach (var item in arry)
                 {
                     awards = item.Split(':');
                     if (awards[0].ToString() == "1")
                     {
                         txtGold.Text = awards[1].ToString();
                     }
                     else if (awards[0].ToString() == "2")
                     {
                         txtDiamond.Text = awards[1].ToString();
                     }
                     else if (awards[0].ToString() == "3")
                     {
                         txtMedal.Text = awards[1].ToString();
                     }
                 }
             }
             else
             {
                 awards = info.TaskAward.Split(':');
                 if (awards[0].ToString() == "1")
                 {
                     txtGold.Text = awards[1].ToString();
                 }
                 else if (awards[0].ToString() == "2")
                 {
                     txtDiamond.Text = awards[1].ToString();
                 }
                 else if (awards[0].ToString() == "3")
                 {
                     txtMedal.Text = awards[1].ToString();
                 }
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// 绑定任务信息
 /// </summary>
 protected void BindTask()
 {
     Game.Entity.Platform.TaskInfo taskInfo = FacadeManage.aidePlatformFacade.GetTaskInfoByID(IntParam);
     if (taskInfo != null)
     {
         txtTaskName.Text           = taskInfo.TaskName;
         ddlTaskType.SelectedValue  = taskInfo.TaskType.ToString();
         ddlGameKind.SelectedValue  = taskInfo.KindID.ToString();
         txtStandardAwardGold.Text  = taskInfo.StandardAwardGold.ToString();
         txtStandardAwardMedal.Text = taskInfo.StandardAwardMedal.ToString();
         txtMemberAwardGold.Text    = taskInfo.MemberAwardGold.ToString();
         txtMemberAwardMedal.Text   = taskInfo.MemberAwardMedal.ToString();
         txtTimeLimit.Text          = taskInfo.TimeLimit.ToString();
         txtTaskDescription.Text    = taskInfo.TaskDescription;
         for (int i = 1; i <= cblUserType.Items.Count; i++)
         {
             if ((i & taskInfo.UserType) == i)
             {
                 cblUserType.Items[i - 1].Selected = true;
             }
             else
             {
                 cblUserType.Items[i - 1].Selected = false;
                 if (i == 2)
                 {
                     trMemberGold.Visible     = false;
                     trMemberMedal.Visible    = false;
                     txtMemberAwardGold.Text  = "0";
                     txtMemberAwardMedal.Text = "0";
                 }
             }
         }
         //if( taskInfo.TaskType == (int)EnumerationList.TaskType.比赛任务 )
         //{
         //    trMatchID.Visible = true;
         //    try
         //    {
         //        ddlMatchID.SelectedValue = taskInfo.MatchID.ToString();
         //    }
         //    catch { }
         //}
         //else
         //{
         //    trMatchID.Visible = false;
         //}
         txtInnings.Text = taskInfo.Innings.ToString();
     }
 }
コード例 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!IsValid)
            {
                return;
            }

            //验证任务类型
            int taskType = -1;

            taskType = Convert.ToInt32(ddlTaskType.SelectedValue);
            if (taskType == -1)
            {
                ShowError("请选择任务类型");
                return;
            }

            //验证可领取任务玩家类型
            int userType = 0;

            for (int i = 1; i <= cblUserType.Items.Count; i++)
            {
                if (cblUserType.Items[i - 1].Selected)
                {
                    userType = userType | i;
                }
            }
            if (userType == 0)
            {
                ShowError("请选择可领取任务玩家类型");
                return;
            }

            //验证游戏
            int kindID = -1;

            kindID = Convert.ToInt32(ddlGameKind.SelectedValue);
            if (kindID == -1)
            {
                ShowError("请选择任务所属游戏");
                return;
            }

            //验证局数
            int innings = CtrlHelper.GetInt(txtInnings, 0);

            if (innings == 0)
            {
                ShowError("请输入比赛局数");
                return;
            }

            //验证比赛
            int matchID = 0;

            //if( taskType == (int)EnumerationList.TaskType.比赛任务 )
            //{
            //    matchID = Convert.ToInt32( ddlMatchID.SelectedValue );
            //    if( matchID == 0 )
            //    {
            //        ShowError( "请选择任务所属比赛" );
            //        return;
            //    }
            //}

            Game.Entity.Platform.TaskInfo taskInfo = new Game.Entity.Platform.TaskInfo();
            if (IntParam > 0)
            {
                AuthUserOperationPermission(Permission.Edit);
                taskInfo = FacadeManage.aidePlatformFacade.GetTaskInfoByID(IntParam);
            }
            else
            {
                AuthUserOperationPermission(Permission.Add);
                taskInfo.InputDate = DateTime.Now;
            }

            taskInfo.TaskName           = CtrlHelper.GetText(txtTaskName);
            taskInfo.TaskType           = taskType;
            taskInfo.UserType           = Convert.ToByte(userType);
            taskInfo.KindID             = kindID;
            taskInfo.StandardAwardGold  = CtrlHelper.GetInt(txtStandardAwardGold, 0);
            taskInfo.StandardAwardMedal = CtrlHelper.GetInt(txtStandardAwardMedal, 0);
            taskInfo.MemberAwardGold    = CtrlHelper.GetInt(txtMemberAwardGold, 0);
            taskInfo.MemberAwardMedal   = CtrlHelper.GetInt(txtMemberAwardMedal, 0);
            taskInfo.TimeLimit          = CtrlHelper.GetInt(txtTimeLimit, 0);
            taskInfo.TaskDescription    = TextUtility.CutString(CtrlHelper.GetText(txtTaskDescription), 0, 500);
            taskInfo.Innings            = innings;
            taskInfo.MatchID            = matchID;

            bool isSuccess;

            if (IntParam > 0)
            {
                isSuccess = FacadeManage.aidePlatformFacade.UpdateTaskInfo(taskInfo);
            }
            else
            {
                isSuccess = FacadeManage.aidePlatformFacade.InsertTaskInfo(taskInfo);
            }

            if (isSuccess)
            {
                ShowInfo("保存任务信息成功", "TaskList.aspx", 1000);
            }
            else
            {
                ShowError("保存任务信息失败");
            }
        }
コード例 #5
0
        /// <summary>
        /// 数据保存
        /// </summary>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Game.Entity.Platform.TaskInfo info = new Game.Entity.Platform.TaskInfo();
            if (IntParam > 0)
            {
                if (!AuthUserOperationPermission(Permission.Edit))
                {
                    return;
                }
                info = FacadeManage.aidePlatformFacade.GetTaskInfo(IntParam);
            }
            else
            {
                if (!AuthUserOperationPermission(Permission.Add))
                {
                    return;
                }
            }

            info.CollectDate = DateTime.Now;
            info.Innings     = CtrlHelper.GetInt(txtInnings, 0);
            info.KindID      = Convert.ToInt32(ddlKindID.SelectedValue);
            //info.MatchID = Convert.ToInt32(ddlMatchID.SelectedValue);
            info.Nullity         = Convert.ToByte(ddlState.SelectedValue);
            info.ServerID        = Convert.ToInt32(ddlServerID.SelectedValue);
            info.TaskDescription = CtrlHelper.GetText(txtDescription);
            info.TaskName        = CtrlHelper.GetText(txtTaskName);
            info.TaskType        = Convert.ToInt32(ddlTaskType.SelectedValue);
            info.TimeType        = Convert.ToByte(ddlTimeType.SelectedValue);
            info.UserType        = Convert.ToByte(ddlUserType.SelectedValue);
            //info.SortID = CtrlHelper.GetInt(txtSortID, 0);

            int    gold    = CtrlHelper.GetInt(txtGold, 0);
            int    diamond = CtrlHelper.GetInt(txtDiamond, 0);
            int    medal   = CtrlHelper.GetInt(txtMedal, 0);
            string award   = "";

            if (gold > 0)
            {
                award = award + "1:" + gold.ToString() + ";";
            }
            if (diamond > 0)
            {
                award = award + "2:" + diamond.ToString() + ";";
            }
            if (medal > 0)
            {
                award = award + "3:" + medal.ToString() + ";";
            }
            info.TaskAward = award != "" ? award.Substring(0, award.Length - 1) : "";

            int result = 0;

            if (IntParam > 0)
            {
                result = FacadeManage.aidePlatformFacade.UpdateTaskInfo(info);
            }
            else
            {
                result = FacadeManage.aidePlatformFacade.InsertTaskInfo(info);
            }
            if (result > 0)
            {
                ShowInfo("操作成功", "TaskList.aspx", 1200);
            }
            else
            {
                ShowError("操作失败");
            }
        }