Exemplo n.º 1
0
        protected void Button_Save_Click(object sender, EventArgs e)
        {
            string exception = "";

            if (!CheckNull(new string[] { TextBox_Level1.Text, TextBox_Level2.Text, TextArea_Quota1.Text, TextArea_Quota2.Text, TextArea_Quota3.Text, TextArea_Quota4.Text }))
            {
                Alert.ShowInTop("项目不可为空!");
                return;
            }
            string level1 = TextBox_Level1.Text.Trim();
            string level2 = TextBox_Level2.Text.Trim();

            string[] quotas = new string[] { TextArea_Quota1.Text.Trim(), TextArea_Quota2.Text.Trim(), TextArea_Quota3.Text.Trim(), TextArea_Quota4.Text.Trim() };
            if (!checkNull(level1, level2, quotas[0], quotas[1], quotas[2], quotas[3]))
            {
                Alert.ShowInTop("请填写完整!", MessageBoxIcon.Error);
                return;
            }
            if (QuotaManagementCtrl.AddQuota(level1, level2, quotas, ref exception))
            {
                Alert.ShowInTop("保存成功!", MessageBoxIcon.Information);
            }
            else
            {
                Alert.ShowInTop("保存失败!\n原因:" + exception, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void bindQuotaLibToGrid()
        {
            string    exception = "";
            DataTable table     = new DataTable();

            if (QuotaManagementCtrl.GetQuotaLib(ref table, ref exception))
            {
                Grid1.DataSource = table;
                Grid1.DataBind();
            }
            else
            {
                table.Clear();
                Grid1.DataSource = table;
                Grid1.DataBind();
            }
        }
Exemplo n.º 3
0
        protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
        {
            string exception = "";

            if (e.CommandName == "Delete")
            {
                object[] keys   = Grid1.DataKeys[e.RowIndex];
                string   level1 = (string)keys[0];
                string   level2 = (string)keys[1];
                if (QuotaManagementCtrl.DeleteQuota(level1, level2, ref exception))
                {
                    Alert.ShowInTop("删除成功!", MessageBoxIcon.Information);
                }
                else
                {
                    Alert.ShowInTop("删除失败!\n原因:" + exception, MessageBoxIcon.Error);
                }
                bindQuotaLibToGrid();
            }
        }