protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int agId = Convert.ToInt32(Request.QueryString["id"]); Model.AgentInfo agent = new BLL.AgentInfo().GetModel(agId); txtAgentAccount.Text = agent.AgentAccount; txtAgentName.Text = agent.AgentName; txtAgentPasswd.Text = agent.AgentPasswd; txtAgentQQ.Text = agent.AgentQQ; txtAgentTel.Text = agent.AgentTel; txtAgentEmail.Text = agent.AgentEmail; dropModel.SelectedValue = Convert.ToString(agent.RevenueModel); string [] s = agent.JurisdictionID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < s.Length; i++) { if (s[i] == "1") { c1.Checked = true; } else if (s[i] == "2") { c2.Checked = true; } else if (s[i] == "3") { c3.Checked = true; } } } }
/// <summary> /// 获取各类信息 /// </summary> /// <returns></returns> public string getInfo(string tmp, string flag) { string info = string.Empty; switch (flag) { case "1": DateTime dt1 = new DateTime(1970, 1, 1); DateTime dt = new DateTime(dt1.Ticks + (long.Parse(tmp) * 10000000)); info = Convert.ToString(dt); break; case "2": if (tmp == "0") { info = "男"; } else { info = "女"; } break; case "3": Model.AgentInfo ag = new BLL.AgentInfo().GetModel(Convert.ToInt32(tmp)); info = ag.AgentAccount; break; } return(info); }
protected void btnSava_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { try { int agId = Convert.ToInt32(Request.QueryString["id"]); string agAccount = txtAgentAccount.Text.Trim(); Model.AgentInfo agentL = new BLL.AgentInfo().GetModel(agAccount); if (agentL == null) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('亲,转移的代理不存在,请重新输入帐号')</script>"); } else { Model.AgentInfo agentinfo = new Model.AgentInfo(); agentinfo.HigherLevel = agentL.AgentID; agentinfo.AgentID = agId; bool result = new BLL.AgentInfo().UpdateHigherLevel(agentinfo); if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('转移代理成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('转移代理失败')</script>"); } } } catch (Exception) { throw; } } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "Del": int agentId = Convert.ToInt32(e.CommandArgument); bool extits = new BLL.AgentInfo().Exists(" HigherLevel='" + agentId + "'"); bool extitsvip = new BLL.GameUserInfo().extitsvip(" GUParentUserID='" + agentId + "'"); if (extits || extitsvip) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('该代理存在下级代理或会员,请亲转移或者删除下级代理或者会员在做操作')</script>"); } else { new BLL.AgentInfo().Delete(agentId); AgentBind(""); } break; case "AgShift": int agId = Convert.ToInt32(e.CommandArgument); Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>showTipsWindown('代理转移','AgShift.aspx?id=" + agId + "',380,200)</script>"); break; case "Update": int uageId = Convert.ToInt32(e.CommandArgument); Response.Redirect("UpdateAgent.aspx?id=" + uageId + ""); break; } }
protected void btnSava_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int vipId = Convert.ToInt32(Request.QueryString["id"]); Model.AgentInfo ag = new BLL.AgentInfo().GetModel(txtAgentAccount.Text.Trim()); if (ag == null) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('亲,转移的代理不存在,请重新输入帐号')</script>"); } else { Model.GameUserInfo gu = new Model.GameUserInfo(); gu.GUUserID = vipId; gu.GUParentUserID = ag.AgentID; bool result = new BLL.GameUserInfo().VIPShift(gu); if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('会员转移成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('会员转移失败')</script>"); } } } } catch (Exception) { throw; } }
protected void btnSava_Click(object sender, EventArgs e) { try { Model.GameUserInfo guser = new Model.GameUserInfo(); guser.GUAccount = txtGUAccount.Text.Trim(); guser.GUPasswd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtGUPasswd.Text.Trim(), "MD5");; guser.GUEmail = txtGUEmail.Text.Trim(); guser.GUName = txtGUName.Text.Trim(); guser.GUTel = txtGUTel.Text.Trim(); guser.GUExtend_Sex = Convert.ToInt32(dropsex.SelectedValue); guser.GUExtend_Signature = txtGUExtend_Signature.Text.Trim(); guser.GUExtend_Birthday = GetConversion(txtGUExtend_Birthday.Text.Trim()); guser.GUExtend_RealName = txtGUExtend_RealName.Text; guser.GUExtend_Address = txtGUExtend_Address.Text; guser.GUExtend_IDCardNo = txtGUExtend_IDCardNo.Text; guser.GURegisterTime = GetConversion(DateTime.Now.ToString()); if (Session["manager"] != null) { Model.AgentInfo agent = new BLL.AgentInfo().GetModel(txtAgentAccount.Text.Trim()); if (agent == null) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('代理不存在,请重新输入')</script>"); return; } else { guser.GUParentUserID = agent.AgentID; } } else if (Session["Agent"] != null) { guser.GUParentUserID = ((Model.AgentInfo)Session["Agent"]).AgentID; } int result = new BLL.GameUserInfo().Add(guser); if (result > 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存失败')</script>"); } } catch (Exception) { throw; } }
public String[] GetCompleteDepart(string prefixText, int count) { ///检测参数是否为空 if (string.IsNullOrEmpty(prefixText) == true || count <= 0) { return(null); } // 如果数组为空 if (autoCompleteWordList == null) { //读取数据库的内容 DataSet ds = new BLL.AgentInfo().GetList(" AgentAccount like'" + prefixText + "%' order by RegisterTime desc"); //读取内容文件的数据到临时数组 string[] temp = new string[ds.Tables[0].Rows.Count]; int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { temp[i] = dr["AgentAccount"].ToString(); i++; } Array.Sort(temp, new CaseInsensitiveComparer()); //将临时数组的内容赋给返回数组 autoCompleteWordList = temp; } //定位二叉树搜索的起点 int index = Array.BinarySearch(autoCompleteWordList, prefixText, new CaseInsensitiveComparer()); if (index < 0) { //修正起点 index = ~index; } //搜索符合条件的数据 int matchCount = 0; for (matchCount = 0; matchCount < count && matchCount + index < autoCompleteWordList.Length; matchCount++) { ///查看开头字符串相同的项 if (autoCompleteWordList[index + matchCount].StartsWith(prefixText, StringComparison.CurrentCultureIgnoreCase) == false) { break; } } //处理搜索结果 string[] matchResultList = new string[matchCount]; if (matchCount > 0) { //复制搜索结果 Array.Copy(autoCompleteWordList, index, matchResultList, 0, matchCount); } return(matchResultList); }
protected void btnSava_Click(object sender, EventArgs e) { try { Model.AgentInfo agent = new Model.AgentInfo(); agent.AgentAccount = txtAgentAccount.Text.Trim(); agent.AgentName = txtAgentName.Text; agent.AgentPasswd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtAgentPasswd.Text.Trim(), "MD5"); agent.AgentQQ = txtAgentQQ.Text.Trim(); agent.AgentEmail = txtAgentEmail.Text.Trim(); agent.AgentTel = txtAgentTel.Text; agent.RegisterTime = DateTime.Now; int OperateType = 0; if (base.Session["manager"] != null) { agent.HigherLevel = 0; OperateType = 1; } else if (base.Session["Agent"] != null) { agent.HigherLevel = ((Model.AgentInfo)Session["Agent"]).AgentID; OperateType = 2; } agent.JurisdictionID = getQxID(); agent.RevenueModel = Convert.ToInt32(dropModel.SelectedValue); int result = new BLL.AgentInfo().Add(agent); if (result > 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存失败')</script>"); } } catch (Exception ec) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('" + ec.Message + "')</script>"); throw; } }
/// <summary> /// 获取导航 /// </summary> /// <param name="Id"></param> /// <returns></returns> public string GetNavigation(int Id) { string nav = string.Empty; if (Id != 0) { Model.AgentInfo agents = new BLL.AgentInfo().GetModel(Id); if (agents.HigherLevel != 0) { Model.AgentInfo aenet = new BLL.AgentInfo().GetModel(Convert.ToInt32(agents.HigherLevel)); nav += " <a href='AgentInfo.aspx?id=" + aenet.AgentID + "' class='current'>" + aenet.AgentName + "</a>"; } nav += " <a href='AgentInfo.aspx?id=" + agents.AgentID + "' class='current'>" + agents.AgentName + "</a>"; //nav += " <a href='AgentInfo.aspx?id="+agents.AgentID+"' class='current'>" + agents.AgentName + "</a>"; } return(nav); }
protected void btnSava_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { int agId = Convert.ToInt32(Request.QueryString["id"]); Model.AgentInfo agent = new Model.AgentInfo(); agent.AgentAccount = txtAgentAccount.Text.Trim(); agent.AgentName = txtAgentName.Text.Trim(); if (txtAgentPasswd.Text.Trim() != "") { agent.AgentPasswd = txtAgentPasswd.Text.Trim(); } else { Model.AgentInfo ag = new BLL.AgentInfo().GetModel(agId); agent.AgentPasswd = ag.AgentPasswd; } agent.AgentQQ = txtAgentQQ.Text.Trim(); agent.AgentTel = txtAgentTel.Text.Trim(); agent.AgentID = agId; bool result = new BLL.AgentInfo().UpdateAg(agent); if (result) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存成功')</script>"); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('保存失败')</script>"); } } } catch (Exception) { throw; } }
protected void btnlogin_Click(object sender, EventArgs e) { Session.Clear(); string username = Request.Form["username"].ToString(); string passwd = Request.Form["password"].ToString(); string md5pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passwd, "MD5"); try { if (dropModel.SelectedValue == "0") { Model.ManagerInfo manager = new BLL.ManagerInfo().GetModel(username); if (manager == null || string.IsNullOrEmpty(manager.AdminAccount)) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>"); } else if (md5pass != manager.AdminPasswd) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>"); } else { Session["manager"] = manager; AddLog(manager.AdminID, 1, DateTime.Now, "在Ip为:" + Request.UserHostAddress + " 的PC端登录"); Response.Redirect("Manage\\Management.aspx"); } } else if (dropModel.SelectedValue == "1") { Model.AgentInfo agent = new BLL.AgentInfo().GetModel(username); if (agent == null || string.IsNullOrEmpty(agent.AgentAccount)) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>"); } else if (md5pass != agent.AgentPasswd) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>"); } else { Session["Agent"] = agent; Model.AgentInfo agents = new Model.AgentInfo(); agents.AgentID = agent.AgentID; agents.LoginIP = Request.UserHostAddress; agents.LoginTime = DateTime.Now; agents.OnlineState = 1; new BLL.AgentInfo().UpdateIPonTime(agents); AddLog(agent.AgentID, 2, DateTime.Now, "在IP为:" + Request.UserHostAddress + " 的PC端登录"); Response.Redirect("Manage\\AgentInfo.aspx"); } } else if (dropModel.SelectedValue == "2") { Model.CustomerInfo cust = new BLL.CustomerInfo().GetModel(username); if (cust == null || string.IsNullOrEmpty(cust.CustomerAccount)) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('帐号不存在,请重新输入')</script>"); } else if (md5pass != cust.CustomerPwd) { Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('密码不正确,请重新输入')</script>"); } else { Session["Cust"] = cust; Model.CustomerInfo Customer = new Model.CustomerInfo(); Customer.CustomerState = 1; Customer.CustomerAccount = cust.CustomerAccount; new BLL.CustomerInfo().UpdateState(Customer); Response.Redirect("Manage\\OnlineProblem.aspx"); } } } catch (Exception) { throw; } }