private bool DoAdd() { Model.t_customer model = new Model.t_customer(); BLL.t_customer bll = new BLL.t_customer(); model.CustomerType = Convert.ToInt32(ddl_CustomerType.SelectedValue); model.TrueName = txt_TrueName.Text; model.Wechat = txt_Wechat.Text; model.Nickname = txt_Nickname.Text; model.Gender = Convert.ToInt32(ddl_Gender.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.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_customer bll = new BLL.t_customer(); Model.t_customer model = bll.GetModel(_id); model.ID = _id; model.CustomerType = Convert.ToInt32(ddl_CustomerType.SelectedValue); model.TrueName = txt_TrueName.Text; model.Wechat = txt_Wechat.Text; model.Nickname = txt_Nickname.Text; model.Gender = Convert.ToInt32(ddl_Gender.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_customer bll = new BLL.t_customer(); Model.t_customer model = bll.GetModel(_id); ddl_CustomerType.SelectedValue = model.CustomerType.ToString(); txt_TrueName.Text = model.TrueName; txt_Wechat.Text = model.Wechat; txt_Nickname.Text = model.Nickname; ddl_Gender.SelectedValue = model.Gender.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(); }