/// <summary> /// 删除按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Delete_Click(object sender, RoutedEventArgs e) { foreach (var name in selectPrivilege) { WMS_Privilege_Bll.Delete_Privilege(" PrivilegeNo = " + name); } Page_Frush(); }
/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Save_Click(object sender, RoutedEventArgs e) { if (editFlag == 1) { WMS_Privilege_Bll.Insert_Privilege(wms_Privilege_Model); } else if (editFlag == 2) { WMS_Privilege_Bll.Update_Privilege(wms_Privilege_Model, " PrivilegeNo = " + privilegeNo); } editFlag = 0; Page_Frush(); PrivilegeDataGrid.CanUserAddRows = false; PrivilegeDataGrid.IsReadOnly = true; }
/// <summary> /// 获取列表 /// </summary> /// <returns></returns> public static List <WMS_Privilege_Model> GetPrivilegeList() { List <WMS_Privilege_Model> list = new List <WMS_Privilege_Model>(); DataTable dt = WMS_Privilege_Bll.Select_Privilege(string.Empty); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Privilege_Model wms_Privilege_Model = new WMS_Privilege_Model { PrivilegeNo = int.Parse(dt.Rows[i]["PrivilegeNo"].ToString()), PrivilegeName = dt.Rows[i]["PrivilegeName"].ToString() }; list.Add(wms_Privilege_Model); } return(list); }
/// <summary> /// 搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DMButton_Search_Click(object sender, RoutedEventArgs e) { permissionBase.PrivilegeList.Clear(); List <WMS_Privilege_Model> list = new List <WMS_Privilege_Model>(); DataTable dt = WMS_Privilege_Bll.Select_Privilege(" PrivilegeNo = " + int.Parse(SearchText.Text.Trim())); for (int i = 0; i < dt.Rows.Count; i++) { WMS_Privilege_Model wMS_Privilege_Model = new WMS_Privilege_Model { PrivilegeNo = int.Parse(dt.Rows[i]["PrivilegeNo"].ToString()), PrivilegeName = dt.Rows[i]["PrivilegeName"].ToString() }; list.Add(wMS_Privilege_Model); } foreach (var model in list) { permissionBase.PrivilegeList.Add(model); } this.PrivilegeDataGrid.ItemsSource = permissionBase.PrivilegeList; }