Example #1
0
        private void AddWindow()
        {
            Control ct = this.Page.LoadControl("../Base/Form/Form.ascx");

            if (string.IsNullOrEmpty(ComboName))
            {
                ct.ID = this.ID + "frmAddWindow";
            }
            else
            {
                ct.ID = ComboName;
            }

            plcInput.Controls.Add(ct);
            var frm = ct as BaseForm;

            frm.TableName        = this.TableName;
            frm.WindowHidden     = true;
            frm.AllowChangeTable = false;
            frm.CommandButton    = BaseForm.Command.insert;
            frm.FormType         = BaseForm.FormKind.Window;

            //Tiến hành update lại bảng nếu thay đổi Table
            if (CurrentUser.User.IsSuperUser)
            {
                FormInfo frmInfo = FormController.GetInstance().GetForm(ct.ID);
                if (frmInfo != null)
                {
                    if (frmInfo.TableName != this.TableName)
                    {
                        frmInfo.DeleteFormElement();
                        frmInfo.TableName = this.TableName;
                        FormController.GetInstance().UpdateForm(frmInfo);
                    }
                }
            }
        }