示例#1
0
    ICollection CreateDataSource(ArrayList itemList)
    {
        try
        {
            DataTable dataTable = new DataTable();
            DataRow   dataRow;

            dataTable.Columns.Add(new DataColumn("Seller", typeof(String)));
            dataTable.Columns.Add(new DataColumn("Goods", typeof(String)));
            dataTable.Columns.Add(new DataColumn("Buyer", typeof(String)));
            dataTable.Columns.Add(new DataColumn("StartTime", typeof(String)));
            dataTable.Columns.Add(new DataColumn("FinishTime", typeof(String)));
            dataTable.Columns.Add(new DataColumn("CurrentPrice", typeof(String)));
            dataTable.Columns.Add(new DataColumn("PassPrice", typeof(String)));

            if (itemList != null && itemList.Count != 0)
            {
                foreach (AuctionRoomItem item in itemList)
                {
                    dataRow    = dataTable.NewRow();
                    dataRow[0] = string.Format("<a href='../GameMaster/RoleDetail.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>",
                                               WebConfig.ParamServerId,
                                               (int)ViewState[WebConfig.ParamServerId],
                                               WebConfig.ParamRoleName,
                                               HttpUtility.UrlEncode(item.SellerName),
                                               item.SellerName);
                    if (item.ItemData != null)
                    {
                        dataRow[1] = string.Format("<div onmouseover='updateRoleItemInfo(\"{0}\")'>{1}</div>", item.ItemData.TemplateId, item.GoodsName);
                    }
                    else
                    {
                        dataRow[1] = item.GoodsName;
                    }
                    if (item.BuyerName != null && item.BuyerName.Length != 0)
                    {
                        dataRow[2] = string.Format("<a href='../GameMaster/RoleDetail.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>",
                                                   WebConfig.ParamServerId,
                                                   (int)ViewState[WebConfig.ParamServerId],
                                                   WebConfig.ParamRoleName,
                                                   HttpUtility.UrlEncode(item.BuyerName),
                                                   item.BuyerName);
                    }
                    else
                    {
                        dataRow[2] = StringDef.NotAvailable;
                    }
                    dataRow[3] = item.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
                    dataRow[4] = item.FinishTime.ToString("yyyy-MM-dd HH:mm:ss");
                    dataRow[5] = GameDataRender.RenderMoney(item.CurrentPrice);
                    dataRow[6] = GameDataRender.RenderMoney(item.PassPrice);

                    dataTable.Rows.Add(dataRow);
                }
                return(new DataView(dataTable));
            }
            return(null);
        }
        catch (Exception)
        {
            return(null);
        }
    }
示例#2
0
    private void SetRoleBasicInfo(FS2RoleDataInfo role)
    {
        TextBoxTongName.Text    = role.TongName;
        TextBoxAccountName.Text = role.AccountName;
        TextBoxRoleName.Text    = role.RoleName;
        switch (role.RoleSex)
        {
        case FS2RoleSex.Male:
            TextBoxSex.Text = StringDef.Male;
            break;

        case FS2RoleSex.Female:
            TextBoxSex.Text = StringDef.Female;
            break;
        }
        string classDescription = string.Empty;

        switch (role.RoleType)
        {
        case FS2RoleType.Jiashi:
            classDescription = StringDef.Jiashi;
            break;

        case FS2RoleType.Xuanfeng:
            classDescription = StringDef.XuanFeng;
            break;

        case FS2RoleType.Xingtian:
            classDescription = StringDef.XingTian;
            break;

        case FS2RoleType.Daoshi:
            classDescription = StringDef.Daoshi;
            break;

        case FS2RoleType.Zhenren:
            classDescription = StringDef.ZhenRen;
            break;

        case FS2RoleType.Tianshi:
            classDescription = StringDef.TianShi;
            break;

        case FS2RoleType.Yiren:
            classDescription = StringDef.Yiren;
            break;

        case FS2RoleType.Shoushi:
            classDescription = StringDef.ShouShi;
            break;

        case FS2RoleType.Yishi:
            classDescription = StringDef.YiShi;
            break;
        }
        TextBoxType.Text = classDescription;

        TextBoxLevel.Text             = role.RoleLevel.ToString();
        TextBoxMoney.Text             = GameDataRender.RenderMoney(role.Money);
        TextBoxMoneyInBox.Text        = GameDataRender.RenderMoney(role.MoneyInBox);
        TextBoxPlayedTime.Text        = TimeSpan.FromSeconds(role.PlayedTime).ToString();
        TextBoxCreateDate.Text        = role.CreateDate.ToString();
        TextBoxLastPlayingDate.Text   = role.LastPlayingDate.ToString();
        TextBoxLastPlayingIP.Text     = role.LastPlayingIP.ToString();
        TextBoxNoChatIn.Text          = (role.NoChatIn == 0) ? StringDef.No : StringDef.Yes;
        TextBoxNoLoginIn.Text         = (role.NoLoginIn == 0) ? StringDef.No : StringDef.Yes;
        TextBoxUseRevivePosition.Text = ((role.UseRevivePosition == 0) ? StringDef.No : StringDef.Yes);
        TextBoxReviveID.Text          = role.ReviveID.ToString();
        TextBoxReviveX.Text           = role.ReviveX.ToString();
        TextBoxReviveY.Text           = role.ReviveY.ToString();
        TextBoxEnterMapID.Text        = role.EnterMapId.ToString();
        TextBoxRoleGuid.Text          = role.RoleGuid;
        LabelIsOnline.Text            = role.Online == 0 ? StringDef.No : StringDef.Yes;
        ListBoxSpyLevel.SelectedIndex = role.SpyLevel;

        if (role.TongName != null && role.TongName.Length != 0)
        {
            TextBoxTongName.Text = string.Format("<a href='../GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}' target='_blank' >{4}</a>",
                                                 WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
            LinkClanInfo.Enabled     = true;
            LinkClanInfo.NavigateUrl = string.Format("~/GameInfo/ClanMemberStatistic.aspx?{0}={1}&{2}={3}",
                                                     WebConfig.ParamServerId, (int)ViewState[WebConfig.ParamServerId], WebConfig.ParamNodeGUID, (string)ViewState[WebConfig.ParamNodeGUID], role.TongName);
        }
        else
        {
            LinkClanInfo.Enabled = false;
            TextBoxTongName.Text = StringDef.NotAvailable;
        }

        Page.Title = string.Format("{0} - \"{1}\"", Page.Title, role.RoleName);
    }
示例#3
0
    void CreateTopPlutocratList()
    {
        try
        {
            int        serverId = ServerDropDownList.SelectedServerId;
            GameServer server   = ServerDropDownList.SelectedGameServer;
            //需要在该游戏服务器的Execute权限
            //if (!WebUtil.CheckPrivilege(server.SecurityObject, OpType.EXECUTE, Session))
            //{
            //    Response.Redirect(WebConfig.PageNotEnoughPrivilege, true);
            //}
            if (server == null)
            {
                LabelOpMsg.Text = string.Format(StringDef.MsgCannotBeNone, StringDef.GameServer);
                return;
            }
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            SqlCommand cmd = new SqlCommand("SELECT Id,AccountName,RoleName,RoleSex,RoleType,RoleLevel,Money,MoneyInBox,SkillSeries FROM rolesfirst ORDER BY Money+MoneyInBox DESC LIMIT 10;");
            if (!server.IsConnected)
            {
                LabelOpMsg.Text = StringDef.NoConnectionAlert;
                return;
            }
            SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id, server, cmd);
            if (result != null && result.Success)
            {
                result.SetFieldType(
                    new SqlDataType[] {
                    SqlDataType.Int32,
                    SqlDataType.String,
                    SqlDataType.String,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.SByte,
                    SqlDataType.UInt32,
                    SqlDataType.UInt32,
                    SqlDataType.Int32
                });

                ArrayList roles  = new ArrayList();
                object[]  record = null;
                while ((record = result.ReadRecord()) != null)
                {
                    FS2RoleDataInfo info = new FS2RoleDataInfo();
                    info.RoleId      = (int)record[0];
                    info.AccountName = (string)record[1];
                    info.RoleName    = (string)record[2];
                    info.RoleSex     = (FS2RoleSex)((SByte)record[3]);
                    info.SkillSeries = (int)record[8];
                    switch ((SByte)record[4])
                    {
                    case (SByte)0:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Xuanfeng;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Xingtian;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Jiashi;
                        }
                        break;

                    case (SByte)1:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Zhenren;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Tianshi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Daoshi;
                        }
                        break;

                    case (SByte)2:
                        if (info.SkillSeries == 0)
                        {
                            info.RoleType = FS2RoleType.Shoushi;
                        }
                        else if (info.SkillSeries == 1)
                        {
                            info.RoleType = FS2RoleType.Yishi;
                        }
                        else
                        {
                            info.RoleType = FS2RoleType.Yiren;
                        }
                        break;
                    }

                    info.RoleLevel  = (SByte)record[5];
                    info.Money      = (uint)record[6];
                    info.MoneyInBox = (uint)record[7];

                    roles.Add(info);
                }

                FS2RoleDataInfo[] rolesInfo = (FS2RoleDataInfo[])roles.ToArray(typeof(FS2RoleDataInfo));
                if (roles != null && rolesInfo.Length > 0)
                {
                    FS2RoleDataInfo info = null;
                    for (int i = 0; i < rolesInfo.Length; i++)
                    {
                        info = rolesInfo[i];
                        TableRow row = new TableRow();

                        TableCell cell = new TableCell();
                        cell.Text = (i + 1).ToString();
                        row.Cells.Add(cell);

                        cell      = new TableCell();
                        cell.Text = GameDataRender.RenderMoney(info.Money + info.MoneyInBox);
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        HyperLink link = new HyperLink();
                        link.Target      = "_blank";
                        link.NavigateUrl = "~/GameMaster/RoleDetail.aspx?serverId=" + serverId + "&roleId=" + info.RoleId;
                        link.Text        = info.RoleName;
                        link.SkinID      = "PlainText";
                        cell.Controls.Add(link);
                        row.Cells.Add(cell);

                        cell      = new TableCell();
                        cell.Text = info.AccountName;
                        row.Cells.Add(cell);

                        //cell = new TableCell();
                        //if (info.TongName != null && info.TongName.Length != 0)
                        //{
                        //    cell.Text = info.TongName;
                        //}
                        //else
                        //{
                        //    cell.Text = StringDef.None;
                        //}
                        //row.Cells.Add(cell);

                        cell           = new TableCell();
                        cell.Font.Bold = true;
                        cell.Text      = info.RoleLevel.ToString();
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        Image sexImage = new Image();
                        switch (info.RoleSex)
                        {
                        case FS2RoleSex.Male:
                            sexImage.ToolTip  = StringDef.Male;
                            sexImage.ImageUrl = "~/Image/male.gif";
                            break;

                        case FS2RoleSex.Female:
                            sexImage.ToolTip  = StringDef.Female;
                            sexImage.ImageUrl = "~/Image/female.gif";
                            break;
                        }
                        cell.Controls.Add(sexImage);
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        string classDescription = string.Empty;
                        switch (info.RoleType)
                        {
                        case FS2RoleType.Jiashi:
                            classDescription = StringDef.Jiashi;
                            break;

                        case FS2RoleType.Xuanfeng:
                            classDescription = StringDef.XuanFeng;
                            break;

                        case FS2RoleType.Xingtian:
                            classDescription = StringDef.XingTian;
                            break;

                        case FS2RoleType.Daoshi:
                            classDescription = StringDef.Daoshi;
                            break;

                        case FS2RoleType.Zhenren:
                            classDescription = StringDef.ZhenRen;
                            break;

                        case FS2RoleType.Tianshi:
                            classDescription = StringDef.TianShi;
                            break;

                        case FS2RoleType.Yiren:
                            classDescription = StringDef.Yiren;
                            break;

                        case FS2RoleType.Shoushi:
                            classDescription = StringDef.ShouShi;
                            break;

                        case FS2RoleType.Yishi:
                            classDescription = StringDef.YiShi;
                            break;
                        }
                        cell.Text = classDescription;
                        row.Cells.Add(cell);

                        TableTopPlutocrat.Rows.Add(row);
                    }

                    TableTopPlutocrat.Visible = true;
                }
            }
            else
            {
                if (result == null)
                {
                    LabelOpMsg.Text = StringDef.QueryTimeOut;
                }
                else
                {
                    LabelOpMsg.Text = StringDef.OperationFail;
                }
            }
        }
        catch (Exception ex)
        {
            LabelOpMsg.Text = ex.Message;
        }
    }