using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using web; using System.Data.SqlClient; using System.Data; public partial class control_itemtogold : System.Web.UI.UserControl { private void btnedit_Click(object sender, EventArgs e) { int useridx = int.Parse(base.Session["useridx"].ToString()); int chaidx = int.Parse(this.ddchalist.SelectedValue.ToString()); string str = itemtogold2(base.Session["userid"].ToString(), useridx, chaidx); base.Response.Write(""); } public string itemtogold2(string userid, int useridx, int chaidx) { int num; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@userid", SqlDbType.VarChar, 50), new SqlParameter("@useridx", SqlDbType.Int, 8), new SqlParameter("@character_idx", SqlDbType.Int, 8) }; parameters[0].Value = userid; parameters[1].Value = useridx; parameters[2].Value = chaidx; switch (new DataProviders().RunProcedure("Web_ItemToGold2", parameters, out num)) { case 0: return "中介物品已經成功變賣爲元寶,請查收。"; case 1: return "請先退出遊戲至登陸界面後再來變賣元寶!"; case 2: return "無營商許可證可變賣!"; } return "系統級錯誤,請聯繫管理員!"; } private void InitializeComponent() { this.btnedit.Click += new EventHandler(this.btnedit_Click); base.Load += new EventHandler(this.Page_Load); } protected override void OnInit(EventArgs e) { this.InitializeComponent(); base.OnInit(e); } protected void Page_Load(object sender, EventArgs e) { if (base.Session["userid"] == null) { base.Response.Redirect("login.aspx?returnurl=" + base.Request.ServerVariables["SCRIPT_NAME"]); } else if (!this.Page.IsPostBack) { this.ddchalist.DataSource = new DataProviders().ExecuteSqlDs("select character_idx,character_name from mhgame..tb_character where substring(character_name,1,1)!='@' and user_idx=" + base.Session["useridx"].ToString(), "ddchalist"); this.ddchalist.DataTextField = "character_name"; this.ddchalist.DataValueField = "character_idx"; this.ddchalist.DataBind(); for (int i = 0; i < this.ddchalist.Items.Count; i++) { this.ddchalist.Items[i].Text = new system().ConvertToBig5(this.ddchalist.Items[i].Text.ToString(), 950); } this.ddchalist.Items.Insert(0, new ListItem("請選擇角色", "0")); } } }