protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitDropDownBoxBudgetType();
                InitDropDownProvince();

                int budgetID = GetQueryIntValue("id");
                if (budgetID > 0)
                {
                    Infobasis.Data.DataEntity.BudgetTemplate data = DB.BudgetTemplates
                                                                    .Where(u => u.ID == budgetID).FirstOrDefault();
                    if (data == null)
                    {
                        // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                        Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                        return;
                    }
                    tbxCode.Text                        = data.Code;
                    tbxName.Text                        = data.Name;
                    tbxRemark.Text                      = data.Remark;
                    tbxDisplayOrder.Text                = data.DisplayOrder.ToString();
                    DropDownProvince.SelectedValue      = data.ProvinceID.ToString();
                    DropDownBoxBudgetType.SelectedValue = data.BudgetTypeID.ToString();
                    tbxIsActive.Checked                 = data.BudgetTemplateStatus == BudgetTemplateStatus.Enabled ? true : false;
                }
            }
        }
Exemple #2
0
        protected void Grid1_RowDataBound(object sender, FineUIPro.GridRowEventArgs e)
        {
            // e.DataItem  -> System.Data.DataRowView or custom class.
            // e.RowIndex -> Current row index.
            // e.Values -> Rendered html for each column of this row.

            Infobasis.Data.DataEntity.BudgetTemplate data = e.DataItem as Infobasis.Data.DataEntity.BudgetTemplate;

            BudgetTemplateStatus status = (BudgetTemplateStatus)data.BudgetTemplateStatus;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int budgetTemplateID = GetQueryIntValue("id");
                Infobasis.Data.DataEntity.BudgetTemplate budgetTemplateData = DB.BudgetTemplates.Find(budgetTemplateID);
                panelTopRegion.Title = budgetTemplateData.Name;

                btnAddItem.OnClientClick = Window1.GetShowReference("~/Pages/Budget/BudgetItem_Form.aspx?pid=" + budgetTemplateID.ToString(), "添加模版房间");
                LoadData();
            }
        }
Exemple #4
0
        protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
        {
            int id = GetSelectedDataKeyID(Grid1);

            Infobasis.Data.DataEntity.BudgetTemplate data = DB.BudgetTemplates.Find(id);

            string name = data.Name;

            if (e.CommandName == "Delete")
            {
                // 在操作之前进行权限检查

                if (data.Code == "system")
                {
                    Alert.ShowInTop("不能删除默认的数据!");
                }
                else
                {
                    DB.BudgetTemplates.Where(u => u.ID == id).Delete();

                    BindGrid();
                }
            }
        }
Exemple #5
0
        // 超级管理员(admin)不可编辑,也不会检索出来
        protected void Grid1_PreRowDataBound(object sender, FineUIPro.GridPreRowEventArgs e)
        {
            Infobasis.Data.DataEntity.BudgetTemplate data = e.DataItem as Infobasis.Data.DataEntity.BudgetTemplate;

            FineUIPro.LinkButtonField deleteField = Grid1.FindColumn("deleteField") as FineUIPro.LinkButtonField;
        }
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            int budgetID = GetQueryIntValue("id");

            if (budgetID > 0)
            {
                Infobasis.Data.DataEntity.BudgetTemplate data = DB.BudgetTemplates
                                                                .Where(u => u.ID == budgetID).FirstOrDefault();
                if (data == null)
                {
                    // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                    Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                    return;
                }
                data.Code         = tbxCode.Text.Trim();
                data.Name         = tbxName.Text;
                data.DisplayOrder = Change.ToInt(tbxDisplayOrder.Text);

                if (Change.ToInt(DropDownProvince.SelectedValue) > 0)
                {
                    data.ProvinceID   = Change.ToInt(DropDownProvince.SelectedValue);
                    data.ProvinceName = DropDownProvince.SelectedText;
                }

                if (Change.ToInt(DropDownBoxBudgetType.SelectedValue) > 0)
                {
                    data.BudgetTypeID   = Change.ToInt(DropDownBoxBudgetType.SelectedValue);
                    data.BudgetTypeName = DropDownBoxBudgetType.SelectedText;
                }

                data.IsActive             = tbxIsActive.Checked;
                data.BudgetTemplateStatus = tbxIsActive.Checked ? BudgetTemplateStatus.Enabled : BudgetTemplateStatus.Disabled;
                data.LastUpdateDatetime   = DateTime.Now;
                data.Remark           = tbxRemark.Text;
                data.LastUpdateByID   = UserInfo.Current.ID;
                data.LastUpdateByName = UserInfo.Current.ChineseName;
            }
            else
            {
                Infobasis.Data.DataEntity.BudgetTemplate data = new Infobasis.Data.DataEntity.BudgetTemplate()
                {
                    CreateDatetime       = DateTime.Now,
                    Code                 = tbxCode.Text.Trim(),
                    Name                 = tbxName.Text,
                    Remark               = tbxRemark.Text,
                    BudgetTemplateStatus = Infobasis.Data.DataEntity.BudgetTemplateStatus.Enabled
                };

                data.DisplayOrder = Change.ToInt(tbxDisplayOrder.Text);

                if (Change.ToInt(DropDownProvince.SelectedValue) > 0)
                {
                    data.ProvinceID   = Change.ToInt(DropDownProvince.SelectedValue);
                    data.ProvinceName = DropDownProvince.SelectedText;
                }

                if (Change.ToInt(DropDownBoxBudgetType.SelectedValue) > 0)
                {
                    data.BudgetTypeID   = Change.ToInt(DropDownBoxBudgetType.SelectedValue);
                    data.BudgetTypeName = DropDownBoxBudgetType.Text;
                }

                data.IsActive             = tbxIsActive.Checked;
                data.BudgetTemplateStatus = tbxIsActive.Checked ? BudgetTemplateStatus.Enabled : BudgetTemplateStatus.Disabled;

                DB.BudgetTemplates.Add(data);
            }

            SaveChanges();
            ShowNotify("添加成功");
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }