예제 #1
0
        protected void Button_Add_Click(object sender, EventArgs e)
        {
            string newDepart = TextBox_NewDepart.Text.Trim();

            if (newDepart == "")
            {
                Alert.ShowInTop("请输入新部门名称", MessageBoxIcon.Error);
                return;
            }
            if (newDepart.Length > 10)
            {
                Alert.ShowInTop("新部门名称过长,请重新输入", MessageBoxIcon.Error);
                return;
            }
            string exception = "";

            if (DataBaseManagementCtrl.AddDepart(newDepart, ref exception))
            {
                Alert.ShowInTop("设置成功!", MessageBoxIcon.Information);
                bindDepartsToGrid();
            }
            else
            {
                Alert.ShowInTop("设置失败!\n原因:" + exception, MessageBoxIcon.Error);
                return;
            }
        }
예제 #2
0
        protected void Button_DeleteTempFiles_Click(object sender, EventArgs e)
        {
            string exception = "";

            if (DataBaseManagementCtrl.ClearTempFiles(ref exception))
            {
                Alert.ShowInTop("删除成功!", MessageBoxIcon.Information);
            }
            else
            {
                Alert.ShowInTop("删除失败!\n原因" + exception, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        protected void Button_ClearQuotaLib_Click(object sender, EventArgs e)
        {
            string exception = "";

            if (DataBaseManagementCtrl.ClearQuotaLib(ref exception))
            {
                Alert.ShowInTop("清空成功!", MessageBoxIcon.Information);
            }
            else
            {
                Alert.ShowInTop("清空失败!\n原因" + exception, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void bindDepartsToGrid()
        {
            string    exception = "";
            DataTable table     = new DataTable();

            if (DataBaseManagementCtrl.GetAllDepart(ref table, ref exception))
            {
                Grid1.DataSource = table;
                Grid1.DataBind();
            }
            else
            {
                table.Clear();
                Grid1.DataSource = table;
                Grid1.DataBind();
                //Alert.ShowInTop("未能获取部门信息!/n原因:" + exception, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
        {
            string exception = "";

            if (e.CommandName == "Delete")
            {
                object[] keys = Grid1.DataKeys[e.RowIndex];
                string   id   = keys[0].ToString();
                if (DataBaseManagementCtrl.DeleteDepart(id, ref exception))
                {
                    Alert.ShowInTop("删除成功!", MessageBoxIcon.Information);
                    bindDepartsToGrid();
                }
                else
                {
                    Alert.ShowInTop("删除失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
            }
        }