Пример #1
0
 private void gridViewBudget_RowClick(object sender, RowClickEventArgs e)
 {
     if (e.Button == MouseButtons.Left && e.Clicks == 2)
     {
         DataRow row = gridViewBudget.GetDataRow(e.RowHandle);
         if (row == null) return;
         var frm = new FrmKeHoachBudget(HelpNumber.ParseInt64(row[KE_HOACH_BUDGET.KHBG_ID]), null, null);
         frm.buttonExpand.Visible = false;
         HelpProtocolForm.ShowModalDialog(this, frm);
     }
 }
        public static void ShowWindow(long id, bool? IsAdd, IPhieuFix fix, bool isCopy)
        {
            FrmKeHoachBudget form = null;
            if (isCopy == false)
            {
                if (id > 0)
                {
                    foreach (Form child in FrameworkParams.MainForm.MdiChildren)
                    {
                        if (child is FrmKeHoachBudget)
                        {
                            FrmKeHoachBudget fkh = child as FrmKeHoachBudget;
                            if (fkh.DOKeHoachBudget.KHBG_ID == id)
                            {
                                if (IsAdd == false && fkh.IsAdd == null)
                                {
                                    fkh.UpdateIsAdd(false);
                                    if (!User.isAdmin(FrameworkParams.currentUser.username))
                                    {
                                        Feature featureQLTV = Permission.loadFeature(AppPermission.OKeHoachBudget.id, AppPermission.OKeHoachBudget.featureName, FrameworkParams.currentUser.username);
                                        if (featureQLTV.isRead)
                                        {
                                            fkh.btnCopy.Visible = true;
                                            fkh.btnDelete.Visible = true;
                                            fkh.btnSave.Visible = true;
                                        }
                                    }
                                    else
                                    {
                                        fkh.btnCopy.Visible = true;
                                        fkh.btnDelete.Visible = true;
                                        fkh.btnSave.Visible = true;
                                    }
                                }
                                fkh.Activate();
                                return;
                            }
                        }
                    }
                }
                form = new FrmKeHoachBudget(id, IsAdd, fix);
            }
            else
            {
                DOKeHoachBudget lps = DAKeHoachBudget.I.LoadAll(id);
                lps.KHBG_ID = -1;
                //lps.DSDetail=DALichPhatSongNew.I.LoadDetailDataSet(-1);
                form = new FrmKeHoachBudget(lps, true, fix);
                form.SetCopy();
            }

            if (IsAdd == true)
            {
                form.Text = (isCopy ? "Copy " : "Tạo") + " kế hoạch BUDGET";
            }
            else
            {
                form.Text = "KHBG: " + (form.DOKeHoachBudget.TEN_KE_HOACH.Trim() == "" ? form.DOKeHoachBudget.MA_KHBG : form.DOKeHoachBudget.TEN_KE_HOACH.Trim());

            }
            if (HelpPermission.CanShowForm(form) == false)
            {
                ApplyPermissionAction.getPermissionFormFail().ShowDialog();
                form.Dispose();
                return;
            }

            try
            {
                if (form.IsDisposed) return;

                HelpUserLog.logOpenForm(form);
                PLPlugin.HookShowAllPlugin(form);

                form.FormClosed += new System.Windows.Forms.FormClosedEventHandler(form_FormClosed);
                //form.Disposed += new EventHandler(form_Disposed);

                form.MdiParent = FrameworkParams.MainForm;
                form.MinimizeBox = false;
                form.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                form.ShowInTaskbar = false;
                form.Icon = FrameworkParams.ApplicationIcon;
                XtraForm f = form as XtraForm;
                ProtocolForm.pl_wrapper(ref f, FrameworkParams.isFormat, FrameworkParams.isPermision);

                form.Shown += new EventHandler(wait);

                if (form is frmPermissionFail)
                    form.ShowDialog(FrameworkParams.MainForm);
                else
                    form.Show();
            }
            catch (Exception ex)
            {
                PLException.AddException(ex);
                HelpMsgBox.ShowSystemErrorMessage(ex.ToString());
            }
        }