コード例 #1
0
ファイル: OldQubeCRUDForm.cs プロジェクト: darkguy2008/qube
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _qs = new QSManager(Page.Request);
            if (!String.IsNullOrEmpty(DataQuerystringField))
            {
                if (_qs.Contains(DataQuerystringField))
                {
                    DataId = _qs[DataQuerystringField];
                    FormMode = EPanelType.Update;
                }
                if (_qs.Contains(DataQuerystringDeleteField))
                    FormMode = EPanelType.Delete;
            }

            FormMode = ViewState[VSID + "_FormMode"] == null ? FormMode : (EPanelType)ViewState[VSID + "_FormMode"];

            InvokeFirstLoad();
        }
コード例 #2
0
ファイル: QubeCRUDForm.cs プロジェクト: darkguy2008/qube
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            _qs = new QSManager(Page.Request);

            KeyFormMode = VSID + "_FormMode";
            btnNew.Text = NewButtonText;
            btnSubmit.Text = SubmitButtonText;
            btnDelete.Text = DeleteButtonText;
            btnCancel.Text = CancelButtonText;

            btnNew.ID = string.Format("{0}_{1}", ID, "btnCreate");
            btnNew.CausesValidation = false;
            btnNew.Click += BtnCreate_Click;

            btnSubmit.ID = string.Format("{0}_{1}", ID, "btnSave");
            btnSubmit.Click += btnSubmit_Click;

            btnDelete.ID = string.Format("{0}_{1}", ID, "btnDelete");
            btnDelete.Click += btnSubmit_Click;

            btnCancel.ID = string.Format("{0}_{1}", ID, "btnCancel");
            btnCancel.CausesValidation = false;
            btnCancel.Click += BtnCancel_Click;

            if (SwitchMode == ECRUDFormSwitchMode.QueryString)
            {
                if (_qs.Contains(DataQueryStringNewField))
                    FormMode = ECRUDPanelType.Create;
                if (_qs.Contains(DataQueryStringEditField))
                {
                    DataId = _qs[DataQueryStringEditField];
                    FormMode = ECRUDPanelType.Update;
                }
                if (_qs.Contains(DataQueryStringDeleteField))
                {
                    DataId = _qs[DataQueryStringDeleteField];
                    FormMode = ECRUDPanelType.Delete;
                }
            }

            FormMode = ViewState[KeyFormMode] == null ? FormMode : (ECRUDPanelType)ViewState[KeyFormMode];
            ViewState[KeyFormMode] = FormMode;

            foreach (QubeCRUDFormPanel p in GetAllPanels())
            {
                p.Visible = false;
                p.IsCurrent = false;
            }

            GetPanel(FormMode).Visible = true;
            GetPanel(FormMode).IsCurrent = true;
        }
コード例 #3
0
ファイル: JSONWebService.cs プロジェクト: darkguy2008/qube
        public object Run(string fnName, QSManager qs)
        {
            List<object> args = new List<object>();
            MethodInfo fn = this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name.ToLowerInvariant().Trim() == fnName.ToLowerInvariant().Trim()).SingleOrDefault();
            if (fn == null)
                throw new Exception("Invalid function name");

            foreach (ParameterInfo pi in fn.GetParameters())
            {
                if (!qs.Contains(pi.Name))
                    throw new Exception("The parameter " + pi.Name + " does not exist");
                args.Add(Convert.ChangeType(qs[pi.Name], pi.ParameterType));
            }

            return fn.Invoke(this, args.ToArray());
        }