public override void ShowViewForm(long id)
 {
     frmBangGiaBudget frm = new frmBangGiaBudget(id,null,fix);
     HelpProtocolForm.ShowModalDialog(this, frm);
 }
 public override void ShowUpdateForm(long id)
 {
     frmBangGiaBudget frm = new frmBangGiaBudget(id, false, fix);
     HelpProtocolForm.ShowModalDialog(this, frm);
 }
 private void barButtonItemCopy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     DataRow r = gridViewMaster.GetFocusedDataRow();
     if (r == null) return;
     frmBangGiaBudget frm = new frmBangGiaBudget(HelpNumber.ParseInt64(r[BANG_GIA_BUDGET.BGBG_ID]), false, fix);
     frm.SetCopy();
     HelpProtocolForm.ShowModalDialog(this, frm);
 }
 public override long[] ShowAddForm()
 {
     frmBangGiaBudget frm = new frmBangGiaBudget("-2",true,fix);
     HelpProtocolForm.ShowModalDialog(this, frm);
     return null;
 }
示例#5
0
        public static void InitCtrlBangGiaBudget(PLDMGrid dmGrid, bool readOnly)
        {
            GroupElementType type = (readOnly ? GroupElementType.ONLY_CHOICE : GroupElementType.CHOICE_N_ADD);
            const string sql = "select * from  BANG_GIA_BUDGET where (is_delete='N' or is_delete is null)";
            var ds = HelpDB.getDBService().LoadDataSet(sql);
            dmGrid._init(type, ds.Tables[0], BANG_GIA_BUDGET.BGBG_ID, BANG_GIA_BUDGET.MA_BGBG,
                         new[] { BANG_GIA_BUDGET.BGBG_ID }, new[] { BANG_GIA_BUDGET.BGBG_ID }, InitColumnBGBudget, null
                         , null, null, null, null);

            //dmGrid.GetDMGrid.Grid.ValidateRow += delegate(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
            //{
            //    GridView grid = (GridView)sender;
            //    DataRow row = grid.GetDataRow(e.RowHandle);
            //    if (row == null) return;
            //    HelpInputData.CheckDuplicateField(grid, row.Table.DataSet, e, "MA_BGBG", nameTitle);
            //};
            dmGrid.isFixPopupContainer = true;
            dmGrid.popupContainerControl1.Size = new Size(450, dmGrid.popupContainerControl1.Size.Height);
            // dmGrid.DefinePermission(AppDanhMuc.GetPermission(dmGrid, AppPermission.OBangGiaBudget.featureName, string.Empty));
            // HelpPermission.CheckCtrl(dmGrid);
            dmGrid.GetDMGrid._UseAddEvent = false;
            dmGrid.GetDMGrid._UseDeleteEvent = false;
            dmGrid.GetDMGrid._UseUpdateEvent = false;
            dmGrid.GetDMGrid.btnSave.Visible = false;
            dmGrid.GetDMGrid.btnNoSave.Visible = false;
            dmGrid.GetDMGrid.btnDel.Visible = false;

            if (User.isAdmin() == false && AppPermission.FeatureBangGiaBudget.isInsert == false)
            {
                dmGrid.GetDMGrid.btnAdd.Visible = false;
            }
            else
            {

                dmGrid.GetDMGrid.btnAdd.Click += delegate
                                                     {
                                                         var frm = new frmBangGiaBudget("-2", true, dmGrid);
                                                         dmGrid.popupContainerEdit1.ClosePopup();
                                                         HelpProtocolForm.ShowDialog((XtraForm)dmGrid.FindForm(), frm);
                                                     };
            }

            if (User.isAdmin() == false && AppPermission.FeatureBangGiaBudget.isUpdate == false)
            {
                dmGrid.GetDMGrid.btnUpdate.Visible = false;
            }
            else
            {
                dmGrid.GetDMGrid.btnUpdate.Click += delegate
                                                        {
                                                            DataRow r = dmGrid.GetDMGrid.Grid.GetFocusedDataRow();
                                                            if (r == null) return;
                                                            var frm =
                                                                new frmBangGiaBudget(
                                                                    HelpNumber.ParseInt64(r[BANG_GIA_BUDGET.BGBG_ID]),
                                                                    false, dmGrid);
                                                            dmGrid.popupContainerEdit1.ClosePopup();
                                                            HelpProtocolForm.ShowDialog((XtraForm)dmGrid.FindForm(),
                                                                                        frm);
                                                        };
            }

            if (User.isAdmin() || AppPermission.FeatureBangGiaBudget.isRead)
            {

                var btnView = new ToolStripButton
                                  {
                                      ImageTransparentColor = Color.Magenta,
                                      Name = "btnView",
                                      Padding = new Padding(10, 0, 0, 0),
                                      Size = new Size(47, 22),
                                      Text = "&Xem",
                                      Image = FWImageDic.VIEW_IMAGE20
                                  };
                dmGrid.GetDMGrid.btnBar.Items.Insert(1, btnView);
                btnView.Click += delegate
                                     {
                                         DataRow r = dmGrid.GetDMGrid.Grid.GetFocusedDataRow();
                                         if (r == null) return;
                                         var frm =
                                             new frmBangGiaBudget(HelpNumber.ParseInt64(r[BANG_GIA_BUDGET.BGBG_ID]),
                                                                  null, dmGrid);
                                         dmGrid.popupContainerEdit1.ClosePopup();
                                         HelpProtocolForm.ShowDialog((XtraForm)dmGrid.FindForm(), frm);
                                     };
            }
        }