protected void formView_ItemCommand(object sender, FormViewCommandEventArgs e) { Guid wxgId = Guid.Empty; Guid.TryParse(hfSId.Value, out wxgId); if (e.CommandName == "UpdateStuff") { YC.SQLServerDAL.Stuff record = bll_StuffManage.GetStuffById(wxgId); // 工号 TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox; record.JobNumber = tbJobNumber.Text; // 姓名 TextBox tbRealName = formView.FindControl("tbRealName") as TextBox; record.RealName = tbRealName.Text; // 手机号码 TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox; record.MobilePhone = tbMobilePhone.Text; // 手机短号 TextBox tbMobileShort = formView.FindControl("tbMobileShort") as TextBox; record.MobileShort = tbMobileShort.Text; bll_StuffManage.UpdateStuff(record); if (Updated != null) { Updated(this, new EventArgs()); } } if (e.CommandName == "InsertStuff") { YC.SQLServerDAL.Stuff record = new YC.SQLServerDAL.Stuff(); // 工号 TextBox tbJobNumber = formView.FindControl("tbJobNumber") as TextBox; record.JobNumber = tbJobNumber.Text; // 姓名 TextBox tbRealName = formView.FindControl("tbRealName") as TextBox; record.RealName = tbRealName.Text; // 手机号码 TextBox tbMobilePhone = formView.FindControl("tbMobilePhone") as TextBox; record.MobilePhone = tbMobilePhone.Text; // 手机短号 TextBox tbMobileShort = formView.FindControl("tbMobileShort") as TextBox; record.MobileShort = tbMobileShort.Text; YC.SQLServerDAL.Stuff user = bll_StuffManage.NewStuff(record); if (StuffCreated != null) { hfSId.Value = user.SId.ToString(); StuffInsertedEventArgs args = new StuffInsertedEventArgs(user); StuffCreated(this, args); } } if (e.CommandName == "DeleteStuff") { bll_StuffManage.DeleteStuff(wxgId); if (Deleted != null) { Deleted(this, new EventArgs()); } } if (e.CommandName == "CancelUpdate" || e.CommandName == "CancelInsert") { if (Canceled != null) { Canceled(this, new EventArgs()); } } }
private void SEA_Stuff1_StuffCreated(object sender, StuffInsertedEventArgs e) { Response.Redirect("UserList.aspx"); }