private void SaveData(bool isClose) { //保存权限 if (!VerifyPurview(",SR-SAVE,")) { Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE); return; } string strErr = String.Empty; int num = 1; if (id < 0) { strErr += num + "、参数错误 <br />"; num++; } string name = HttpUtility.HtmlEncode(txtName.Text.Trim()); if (name.Length == 0) { strErr += num + "、角色名称不能为空 <br />"; } if (strErr.Length > 0) { Alert.ShowInParent(strErr); return; } RoleModel model = new RoleModel(); model.Id = id; model.Name = name; int orderId = 0; Int32.TryParse(txtOrderId.Text.Trim(), out orderId); model.OrderId = orderId; model.Desc = HttpUtility.HtmlEncode(txtDesc.Text.Trim()); string tipTitle = model.Id == 0 ? "添加" : "修改"; int result = new RoleBLL().Save(model); if (result > 0) { if (isClose) { Alert.ShowInParent(tipTitle + "数据成功!", String.Empty, ActiveWindow.GetHidePostBackReference()); } else { Alert.ShowInParent(tipTitle + "数据成功!"); PageContext.Refresh(); } } else if (result == -10000) { Alert.ShowInParent("已存在该名称数据"); } else { Alert.ShowInParent(tipTitle + "数据失败"); } }
protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "Delete") { //删除权限 if (!VerifyPurview(",SR-DEL,")) { Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE); return; } int result = new RoleBLL().DeleteById(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0])); if (result > 0) { Alert.ShowInParent("删除成功"); BindData(); } else { Alert.ShowInParent("删除失败"); } } }
private void LoadInfo() { if (id > 0) { btnSave2.Visible = false; RoleModel model = new RoleBLL().GetModelById(id); if (model != null) { txtName.Text = HttpUtility.HtmlDecode(model.Name); txtOrderId.Text = model.OrderId.ToString(); txtDesc.Text = HttpUtility.HtmlDecode(model.Desc); } else { Alert.ShowInParent("读取数据失败!", String.Empty, ActiveWindow.GetHideReference()); } } else { txtOrderId.Text = new RoleBLL().GetMaxOrderId().ToString(); } }