private void ShowInfo(int _id) { BLL.CardCategory bll = new BLL.CardCategory(); Model.CardCategory model = bll.GetModel(_id); //编写赋值操作Begin ddlParentId.SelectedValue = model.ParentId.ToString(); txtFullName.Text = model.FullName; txtBackImgUrl.Text = model.BackImageUrl; txtImgUrl.Text = model.ImagUrl; txtDescribe.Text = model.Describe; txtDuration.Text = model.Duration.ToString(); txtCallIndex.Text = model.CallIndex; txtUserGroupCallIndex.Text = model.UserGroupCallIndex; //编写赋值操作End }
private bool DoAdd() { Model.CardCategory model = new Model.CardCategory(); BLL.CardCategory bll = new BLL.CardCategory(); //编写添加操作Begin model.FullName = txtFullName.Text; model.Describe = txtDescribe.Text; model.ImagUrl = txtImgUrl.Text; if (!string.IsNullOrEmpty(ddlParentId.SelectedValue)) { model.ParentId = Convert.ToInt32(ddlParentId.SelectedValue); } else { model.ParentId = 0; } var parent = bll.GetModel(model.ParentId); model.Layer = parent.Layer + 1; model.BackImageUrl = txtBackImgUrl.Text; model.CallIndex = txtCallIndex.Text; model.Duration = decimal.Parse(txtDuration.Text); model.CreateDate = DateTime.Now; model.CreateUserName = GetAdminInfo().user_name; model.ModifyDate = DateTime.Now; model.UserGroupCallIndex = txtUserGroupCallIndex.Text; //编写添加操作End if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加卡片类别:" + model.FullName); //记录日志 return(true); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.CardCategory bll = new BLL.CardCategory(); Model.CardCategory model = bll.GetModel(_id); //编写编辑操作Begin model.FullName = txtFullName.Text; model.Describe = txtDescribe.Text; model.ImagUrl = txtImgUrl.Text; model.BackImageUrl = txtBackImgUrl.Text; model.CallIndex = txtCallIndex.Text; model.Duration = decimal.Parse(txtDuration.Text); if (!string.IsNullOrEmpty(ddlParentId.SelectedValue)) { model.ParentId = Convert.ToInt32(ddlParentId.SelectedValue); } else { model.ParentId = 0; } model.Layer = model.ParentId + 1; model.ModifyDate = DateTime.Now; model.ModifyUserName = GetAdminInfo().user_name; model.UserGroupCallIndex = txtUserGroupCallIndex.Text; //编写编辑操作End if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改卡片类型:" + model.FullName); //记录日志 result = true; } return(result); }