Beispiel #1
0
        private WordLanguageView OpenWordLanguage(WordLanguageModel wordLanguageModel)
        {
            var form = new Form();
            var view = (WordLanguageForm)DBViewsFactory.GetView(MODELS.WordLanguage);

            wordLanguageModel.WordId = Model.Id;
            view.SetModel(wordLanguageModel);
            view.Dock = DockStyle.Fill;
            form.Controls.Add(view);
            form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.Size            = new System.Drawing.Size(430, 430);
            view.SetNewButtonEnabled(false);
            view.SetDeleteButtonEnabled(false);
            view.DisableChangeWord();
            view.AfterNew = delegate(bool status) {
                view.SetModel(new WordLanguageModel()
                {
                    WordId = Model.Id
                });
            };
            view.AfterSave += delegate(bool status) {
                if (status)
                {
                    form.Close();
                }
            };
            form.Show();
            return(view);
        }
Beispiel #2
0
        private ProfileEntitlementView OpenProfileEntitlement(ProfileEntitlementModel pe)
        {
            var form = new Form();
            var view = (ProfileEntitlementForm)DBViewsFactory.GetView(MODELS.ProfileEntitlement);

            pe.ProfileId = Model.Id;
            view.SetModel(pe);
            view.Dock = DockStyle.Fill;
            form.Controls.Add(view);
            form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.Size            = new System.Drawing.Size(430, 430);
            view.SetNewButtonEnabled(false);
            view.SetDeleteButtonEnabled(false);
            view.DisableChangeProfile();
            bool isnew = pe.Id == 0;

            view.AfterSave += (b) => {
                pe.EntitlementId = view.Model.EntitlementId;
                pe.ProfileId     = view.Model.ProfileId;
                var model = DBControllersFactory.ProfileEntitlement().Find(pe, "ProfileId", "EntitlementId");
                if (isnew)
                {
                    profileEntitlements.Add(model);
                }
                else
                {
                    profileEntitlements[profileEntitlements.IndexOf(profileEntitlements.Where(x => x.Id == pe.Id).First())] = model;
                }
                RequeryEntitlements();
                form.Close();
            };
            form.Show();
            return(view);
        }
Beispiel #3
0
        private void BtnAddContact_Click(object sender, EventArgs e)
        {
            var form = new Form()
            {
                Text = "Add Contact"
            };

            ContactFormView           = ((ContactForm)DBViewsFactory.GetView(Common.MODELS.Contact));
            ContactFormView.AfterSave = AfterModelSave;
            ContactFormView.Dock      = DockStyle.Fill;
            form.Controls.Add(ContactFormView);
            form.Size = new System.Drawing.Size(430, 430);
            form.Show();
        }
Beispiel #4
0
        private void TreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();
            TreeNode node = e.Node;

            if (node.Tag == null)
            {
                return;
            }
            var entity = CntrlET.Find(new EntityModel {
                EntityName = node.Tag.ToString()
            }, "EntityName");

            // = (UserControl)DBViewsFactory.GetView((MODELS)Enum.Parse(typeof(MODELS), entity.EntityName));
            foreach (TabPage tp in tabControl1.TabPages)
            {
                Control c = tp.Controls[0];
                if (c.Tag != null && c.Tag.Equals(node.Tag))
                {
                    tabControl1.SelectedTab = tp;
                    return;
                }
            }
            SuspendLayout();
            tabControl1.SuspendLayout();
            //new Thread(() => {
            //    BeginInvoke((Action)(() => {
            Application.DoEvents();
            UserControl view = (UserControl)DBViewsFactory.GetView((MODELS)Enum.Parse(typeof(MODELS), entity.EntityName));

            view.SuspendLayout();
            view.Tag = node.Tag;
            //lblHeading.Text = node.Text;
            ShowView(view, node.Text, () => {
                Thread.Sleep(1000);
                Cursor.Current = Cursors.Default;
                view.ResumeLayout();
                tabControl1.ResumeLayout();
                ResumeLayout();
            });
            //    }));
            //}).Start();
        }
Beispiel #5
0
        private void BtnAddIdentification_Click(object sender, EventArgs e)
        {
            var form = new Form();
            var view = ((IdentificationForm)DBViewsFactory.GetView(Common.MODELS.Identification));

            view.AfterSave = delegate(bool status) {
                CntrlCI.Save(new ClientIdentificationModel()
                {
                    ClientId         = this.Model.Id,
                    IdentificationId = view.Model.Id
                });
                form.DialogResult = DialogResult.OK;
                form.Close();
                RequeryIdentification();
            };
            form.Controls.Add(view);
            form.Size = new System.Drawing.Size(430, 430);
            form.Show();
        }
Beispiel #6
0
        private ServiceView OpenService(ServiceModel service)
        {
            var form = new Form();
            var view = (ServiceForm)DBViewsFactory.GetView(MODELS.Service);

            service.ContractId = Model.Id;
            view.SetModel(service);
            view.Dock = DockStyle.Fill;
            form.Controls.Add(view);
            form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.Size            = new System.Drawing.Size(430, 430);
            view.SetNewButtonEnabled(false);
            view.SetDeleteButtonEnabled(false);
            view.DisableChangeContract();
            view.AfterNew = delegate(bool status) {
                view.SetModel(new ServiceModel()
                {
                    ContractId = Model.Id
                });
            };
            form.Show();
            return(view);
        }