protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "tongyi") { Panel1.Visible = false; Panel2.Visible = false; //获取行号 BLL.B_Card b_card = new BLL.B_Card(); //webclass.Show(this, selectID.ToString()); GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); int UID = Convert.ToInt32(GridView1.DataKeys[drv.RowIndex].Value); int adminID = int.Parse(Session["UID"].ToString()); bool result = b_card.updateReason("", UID, adminID, 5); //webclass.Show(this,ID.ToString()); if (result == true) { webclass.Show(this, "操作成功"); GridView1.DataBind(); } else { webclass.Show(this, "操作失败"); } } if (e.CommandName == "reject") { GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); int ID = Convert.ToInt32(GridView1.DataKeys[drv.RowIndex].Value);//专家ID Panel1.Visible = true; Panel2.Visible = false; selectID = ID; //webclass.Show(this,selectID.ToString()); } if (e.CommandName == "search") { GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); int ID = Convert.ToInt32(GridView1.DataKeys[drv.RowIndex].Value);//ID BLL.B_ApplyInfo b_apply = new BLL.B_ApplyInfo(); //webclass.Show(this,ID.ToString()); Model.ApplyInfo applyInfo = new Model.ApplyInfo(); applyInfo = b_apply.getInfo(ID, 0); if (applyInfo != null) { label1.Text = applyInfo.Id.ToString(); label2.Text = applyInfo.UID.ToString(); label3.Text = applyInfo.ApplyTime.ToString(); label4.Text = applyInfo.Age.ToString(); label5.Text = applyInfo.Gender.ToString(); label6.Text = applyInfo.Address.ToString(); label7.Text = applyInfo.Tel.ToString(); label8.Text = applyInfo.Job.ToString(); label9.Text = applyInfo.Money.ToString(); label10.Text = applyInfo.Types.ToString(); Panel1.Visible = false; Panel2.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddl_Age.Items.Clear(); ddl_Age.Items.Add(" "); for (int i = 65; i < 150; i++) { ddl_Age.Items.Add(i.ToString()); } BLL.B_ApplyInfo b_apply = new BLL.B_ApplyInfo(); model = b_apply.getInfo((int)Session["UID"], (int)Session["ApplyTypes"]); if (model != null) { for (int i = 0; i < ddl_Age.Items.Count; i++) { if (ddl_Age.Items[i].Value == model.Age.ToString()) { ddl_Age.SelectedIndex = i; } } BLL.B_UInfo b_uinfo = new BLL.B_UInfo(); Model.UInfo uinfo = b_uinfo.GetUInfo(model.UID); if (uinfo != null) { tb_Name.Text = uinfo.Name; tb_Number.Text = uinfo.Number; } tb_Addr.Text = model.Address; rbl_Gender.SelectedValue = model.Gender; tb_Job.Text = model.Job; tb_Money.Text = model.Money.ToString(); tb_Tel.Text = model.Tel; } } }
protected void btn_Submit_Click(object sender, EventArgs e) { BLL.B_ApplyInfo b_apply = new BLL.B_ApplyInfo(); //判断该用户是否可以申请 string tishi = ""; if (b_apply.CanApply((int)Session["UID"], (int)Session["ApplyTypes"], out tishi)) { Model.ApplyInfo model = new Model.ApplyInfo(); if (tb_Age.Text.Trim() != "") { model.Age = Convert.ToInt32(tb_Age.Text); } model.Address = tb_Addr.Text; model.ApplyTime = DateTime.Now; model.Gender = rbl_Gender.SelectedItem.Value; model.Job = tb_Job.Text.Trim(); if (tb_Money.Text.Trim() != "") { model.Money = Convert.ToSingle(tb_Money.Text); } model.Tel = tb_Tel.Text.Trim(); model.Types = (int)Session["ApplyTypes"]; model.UID = (int)Session["UID"]; if (tishi == "reapply") { if (b_apply.UpdateInfo(model)) { //修改对应card或money表 if (UpdateCardOrMoney(model)) { webclass.Show(this, "更新成功"); } else { webclass.Show(this, "更新Card或者Money表的时候出错"); } } } else if (tishi == "apply") { //直接申请 if (b_apply.WriteInfo(model)) { //向card或money表插入数据 if (AddCardOrMoney(model)) { webclass.Show(this, "提交申请成功"); } else { webclass.Show(this, "向Card或者Money表添加数据的时候出错"); } } } else { webclass.Show(this, "错误"); } } else//用户不可以申请 { //弹出提示框 webclass.Show(this, tishi); } }