//删除功能页按钮点击事件 protected void btnDel_Click(object sender, EventArgs e) { FineUI.CheckBoxField chkFild = (FineUI.CheckBoxField)GridFunctionPages.FindColumn("CheckBoxField1"); SeatManage.ClassModel.SysFuncDicInfo modelSysFuncDicInfo = new SeatManage.ClassModel.SysFuncDicInfo(); SeatManage.Bll.SysFuncDic bllSysFuncDic = new SeatManage.Bll.SysFuncDic(); int selectCount = GridFunctionPages.SelectedRowIndexArray.Length; if (selectCount > 0) { for (int i = 0; i < selectCount; i++) { int rowIndex = GridFunctionPages.SelectedRowIndexArray[i]; FineUI.GridRow row = GridFunctionPages.Rows[rowIndex] as FineUI.GridRow; modelSysFuncDicInfo.No = row.DataKeys[0].ToString(); if (bllSysFuncDic.DeleteFuncPage(modelSysFuncDicInfo)) { FineUI.Alert.ShowInTop("删除成功!"); } else { FineUI.Alert.ShowInTop("删除失败!"); } } BindFunctionPagesGrid(); } }
//行事件 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "Delete") { int id = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0]); int flag = operate.DeletePublishByID(id); if (flag >= 1) { Alert.ShowInParent("删除成功"); BindData(); } else { Alert.ShowInParent("删除失败"); } } else if (e.CommandName == "CheckBox1") { int id = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0]); FineUI.CheckBoxField checkField = (FineUI.CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); int a = operate.UpdatePublishByID(id, checkState); if (a > 0) { Alert.ShowInParent("操作成功"); BindData(); } else { Alert.ShowInParent("操作失败"); } } }
//行预绑定事件 protected void GridRole_PreRowDataBound(object sender, FineUI.GridPreRowEventArgs e) { DataRowView row = e.DataItem as DataRowView; string roleId = row[0].ToString(); string roleName = Server.UrlEncode(row[1].ToString()); LinkButtonField lnkbtnField = GridRole.FindColumn("lnkbtnEdit") as LinkButtonField; LinkButtonField lnkbtnColDel = GridRole.FindColumn("ColDel") as LinkButtonField; lnkbtnField.OnClientClick = WindowEdit.GetShowReference("RoleEdit.aspx?flag=edit&roleId=" + roleId + "&roleName=" + roleName, "修改角色"); FineUI.CheckBoxField cbxField = GridRole.FindColumn("CheckBoxField1") as FineUI.CheckBoxField; if (row[2].ToString() == "True") { lnkbtnField.Enabled = false; lnkbtnField.Icon = Icon.Lock; lnkbtnField.ToolTip = "不可编辑"; lnkbtnColDel.Enabled = false; lnkbtnColDel.Icon = Icon.Lock; lnkbtnColDel.ToolTip = "不可删除"; } else { lnkbtnField.Enabled = true; lnkbtnField.Icon = Icon.Pencil; lnkbtnField.ToolTip = "编辑"; lnkbtnColDel.Enabled = true; lnkbtnColDel.Icon = Icon.Delete; lnkbtnColDel.ToolTip = "删除"; } }
//删除菜单按钮点击事件 protected void btnDel_Click(object sender, EventArgs e) { FineUI.CheckBoxField chkFild = (FineUI.CheckBoxField)GridSysMenu.FindColumn("CheckBoxField1"); SeatManage.ClassModel.SysMenuInfo modelSysMenuInfo = new SeatManage.ClassModel.SysMenuInfo(); int selectCount = GridSysMenu.SelectedRowIndexArray.Length; if (selectCount > 0) { for (int i = 0; i < selectCount; i++) { int rowIndex = GridSysMenu.SelectedRowIndexArray[i]; FineUI.GridRow row = GridSysMenu.Rows[rowIndex] as FineUI.GridRow; modelSysMenuInfo.MenuID = int.Parse(row.DataKeys[0].ToString()); if (row.DataKeys[1].ToString() == "一级菜单") { List <SeatManage.ClassModel.SysMenuInfo> listSysMenu = SeatManage.Bll.SysMenu.GetMenusList(); foreach (SeatManage.ClassModel.SysMenuInfo selectmenu in listSysMenu) { if (selectmenu.MenuID == modelSysMenuInfo.MenuID) { modelSysMenuInfo = selectmenu; break; } } foreach (SeatManage.ClassModel.SysMenuInfo childmenu in modelSysMenuInfo.ChildMenu) { if (!SeatManage.Bll.SysMenu.DeleteMenus(childmenu)) { FineUI.Alert.ShowInTop("删除子菜单失败!"); BindSysMenu(); return; } } if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo)) { FineUI.Alert.ShowInTop("删除成功!"); BindSysMenu(); } else { FineUI.Alert.ShowInTop("删除失败!"); BindSysMenu(); } } else { if (SeatManage.Bll.SysMenu.DeleteMenus(modelSysMenuInfo)) { FineUI.Alert.ShowInTop("删除成功!"); } else { FineUI.Alert.ShowInTop("删除失败!"); } } } BindSysMenu(); } }
//验证是否同一物料编码 private bool isOneItem() { //int[] selections = Grid2.SelectedRowIndexArray; FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField; string itemNo = ""; int find = 0; for (int i = 0; i < Grid2.Rows.Count; i++) { bool canRead = canReadField.GetCheckedState(i); if (canRead) { find += 1; string curItemNo = Grid2.Rows[i].Values[2].ToString(); if (find == 1) { itemNo = curItemNo; } else { if (itemNo != curItemNo) { find = -1; break; } } } } //for (int i = 1; i < selections.Length; i++) //{ // string compLineName = Grid2.Rows[selections[i]].Values[2].ToString(); // if (lineName != compLineName) // { // find = i; // } //} if (find == -1) { return(false); } else { return(true); } }
// 行事件 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "Delete") { string keyname = Grid1.Rows[e.RowIndex].Values[1].ToString(); int flag = operate.DeleteRecommendByTypeName(keyname); if (flag >= 1) { Alert.ShowInParent("删除成功"); BindData(); } else { Alert.ShowInParent("删除失败"); } } else if (e.CommandName == "CheckBox1") { string keyname = Grid1.Rows[e.RowIndex].Values[1].ToString(); FineUI.CheckBoxField checkField = (FineUI.CheckBoxField)Grid1.FindColumn(e.ColumnIndex); bool checkState = checkField.GetCheckedState(e.RowIndex); int a = operate.UpdateRecommendByTypeName(keyname, checkState); if (a > 0) { Alert.ShowInParent("操作成功"); BindData(); } else { Alert.ShowInParent("操作失败"); } } else if (e.CommandName == "MoveUp") { int ID = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0].ToString()); operate.GetRecommendByMove(ID, "上移"); BindData(); } else if (e.CommandName == "MoveDown") { int ID = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0].ToString()); operate.GetRecommendByMove(ID, "下移"); BindData(); } }
protected void btnGroupUpdate_Click(object sender, EventArgs e) { try { int roleId = GetSelectedRoleId(); // 添加所有记录 FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField; int MenuId = 0; foreach (GridRow row in Grid2.Rows) { int rowIndex = row.RowIndex; object[] dataKeys = Grid2.DataKeys[rowIndex]; // 当前行对应的模块名称 MenuId = Convert.ToInt32(dataKeys[0]); bool canRead = canReadField.GetCheckedState(rowIndex); string sqlCmd = ""; if (canRead) { sqlCmd = "insert into OA_Sys_RoleMenu (roleId,menuId) values ("; sqlCmd += "'" + roleId + "','" + MenuId + "')"; SqlSel.ExeSql(sqlCmd); } if (!canRead) { sqlCmd = "delete from OA_Sys_RoleMenu where roleId='" + roleId + "' and menuId='" + MenuId + "'"; SqlSel.ExeSql(sqlCmd); } Alert.ShowInTop("角色权限更新成功!"); } } catch (Exception ex) { Alert.ShowInTop(ex.Message); } }
protected void btn_Add_Click(object sender, EventArgs e) { try { FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField; Label1.Text = ""; if (isOneItem()) { int sumCount = 0; StringBuilder sb_orderNo = new StringBuilder(); StringBuilder sb_msg = new StringBuilder();//超产订单信息 DataTable dt = new DataTable(); dt.Columns.Add("orderId"); dt.Columns.Add("orderCount"); int firstRowIndex = -1; int find = 0; for (int i = 0; i < Grid2.Rows.Count; i++) { bool canRead = canReadField.GetCheckedState(i); if (canRead) { find += 1; if (find == 1) { firstRowIndex = i; } //循环插入至隐藏业务订单列表 DataRow newRow = dt.NewRow(); GridRow grow = Grid2.Rows[i]; newRow["orderId"] = grow.DataKeys[0].ToString(); newRow["orderCount"] = grow.Values[8].ToString(); dt.Rows.Add(newRow); //拼接订单号 sb_orderNo.AppendFormat("{0}/", Grid2.Rows[i].Values[1].ToString()); sumCount += Convert.ToInt32(Grid2.Rows[i].Values[8]); //超产订单提示 if (Convert.ToInt32(Grid2.Rows[i].Values[6]) <= Convert.ToInt32(Grid2.Rows[i].Values[7])) { sb_msg.AppendFormat("订单号:{0} 排产数量已达到计划数量,请确认是否继续排产;\r\n", Grid2.Rows[i].Values[1].ToString()); } } } Label1.Text = sb_msg.ToString(); Grid_hidden.DataSource = dt; Grid_hidden.DataBind(); if (firstRowIndex >= 0) { txb_itemNo.Text = Grid2.Rows[firstRowIndex].Values[2].ToString().Trim(); //物料编码 string childrenItemInfo = getChildrenItemInfo(Grid2.Rows[firstRowIndex].Values[2].ToString().Trim()); txb_itemName.Text = Grid2.Rows[firstRowIndex].Values[5].ToString().Trim(); //品名 TextArea_parm.Text = Grid2.Rows[firstRowIndex].Values[4].ToString().Trim() + "/" + childrenItemInfo; //规格 txb_workNo.Text = sb_orderNo.ToString().Substring(0, sb_orderNo.ToString().Length - 1); //合并订单,删除最后一个‘/’标记 numb_planCount.Text = sumCount.ToString(); //合并排产数量 txb_itemTech.Text = Grid2.Rows[firstRowIndex].Values[9].ToString().Trim(); //工艺要求 } else { Alert.ShowInTop("未选中任何数据!"); return; } } else { Alert.ShowInTop("不同物料编码不可合并排产!"); return; } } catch (Exception ex) { Alert.ShowInTop(ex.Message); return; } }