private bool DoAdd() { Model.t_agent model = new Model.t_agent(); BLL.t_agent bll = new BLL.t_agent(); model.IsManage = Convert.ToInt32(ddl_IsManage.SelectedValue); model.TrueName = txt_TrueName.Text; model.AgentCode = txt_AgentCode.Text; model.Nickname = txt_Nickname.Text; model.Gender = Convert.ToInt32(ddl_Gender.SelectedValue); model.AvatarUrl = img_AvatarUrl.ImageUrl; model.PhoneNumber = txt_PhoneNumber.Text; model.State = Convert.ToInt32(ddl_State.SelectedValue); model.Country = txt_Country.Text; model.Province = txt_Province.Text; model.City = txt_City.Text; model.NativePlace = txt_NativePlace.Text; model.Height = Convert.ToDecimal(txt_Height.Text); model.Birthday = txt_Birthday.Text == "" ? DateTime.Now : Convert.ToDateTime(txt_Birthday.Text); model.CreationTime = DateTime.Now; if (bll.Add(model)) { //AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name); //记录日志 return(true); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.t_agent bll = new BLL.t_agent(); Model.t_agent model = bll.GetModel(_id); model.ID = _id; model.IsManage = Convert.ToInt32(ddl_IsManage.SelectedValue); model.TrueName = txt_TrueName.Text; model.AgentCode = txt_AgentCode.Text; model.Nickname = txt_Nickname.Text; model.Gender = Convert.ToInt32(ddl_Gender.SelectedValue); model.State = Convert.ToInt32(ddl_State.SelectedValue); model.AvatarUrl = img_AvatarUrl.ImageUrl; model.PhoneNumber = txt_PhoneNumber.Text; model.Country = txt_Country.Text; model.Province = txt_Province.Text; model.City = txt_City.Text; model.NativePlace = txt_NativePlace.Text; model.Height = Convert.ToDecimal(txt_Height.Text); model.Birthday = txt_Birthday.Text == "" ? DateTime.Now : Convert.ToDateTime(txt_Birthday.Text); model.LastModificationTime = DateTime.Now; if (bll.Update(model)) { //AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.t_agent bll = new BLL.t_agent(); Model.t_agent model = bll.GetModel(_id); ddl_IsManage.SelectedValue = model.IsManage.ToString(); txt_TrueName.Text = model.TrueName; txt_AgentCode.Text = model.AgentCode; txt_Nickname.Text = model.Nickname; ddl_Gender.SelectedValue = model.Gender.ToString(); ddl_State.SelectedValue = model.State.ToString(); img_AvatarUrl.ImageUrl = model.AvatarUrl; txt_PhoneNumber.Text = model.PhoneNumber; txt_Country.Text = model.Country; txt_Province.Text = model.Province; txt_City.Text = model.City; txt_NativePlace.Text = model.NativePlace; txt_Height.Text = model.Height.ToString(); txt_Birthday.Text = model.Birthday.ToString(); }