Exemplo n.º 1
0
        private void ClickEvent(string ID, string NAME, string Group)
        {
            switch (Group.ToUpper())
            {
            case "MASTER":
                if (NAME == "NEW ENTRY")
                {
                    frmPatientMas ObjPatientMas = new frmPatientMas();
                    ObjPatientMas.MdiParent = this;
                    ObjPatientMas.Show();
                }
                else if (NAME == "PRINT BILL")
                {
                    frmBill objbill = new frmBill();
                    objbill.MdiParent = this;
                    objbill.Show();
                }
                break;

            case "REPORT":
                DataRow[] rw = GLOBAL.ds.Tables["PARA_TYPE_MAS"].Select("PARA_TYPE='" + NAME + "'");
                if (rw.Length != 0)
                {
                    frmReport objReport = new frmReport(Convert.ToInt32(rw[0]["PARA_TYPE_CODE"]));
                    objReport.MdiParent = this;
                    objReport.Show();
                }
                break;

            case "USER":
                if (NAME == "USER SETTINGS")
                {
                    frmUserSettings objUser = new frmUserSettings();
                    objUser.MdiParent = this;
                    objUser.Show();
                }
                else if (NAME == "DATABASE")
                {
                    frmDatabase objDB = new frmDatabase();
                    objDB.MdiParent = this;
                    objDB.Show();
                }
                else if (NAME == "VIEW")
                {
                    frmExtraReport objDB = new frmExtraReport();
                    objDB.MdiParent = this;
                    objDB.Show();
                }
                break;

            case "SETTINGS":
                if (NAME == "REPORT SETTINGS")
                {
                    frmParameter objpara = new frmParameter();
                    objpara.MdiParent = this;
                    objpara.Show();
                }
                else if (NAME == "LABORATORY SETTINGS")
                {
                    frmCompanySettings objpara = new frmCompanySettings();
                    objpara.MdiParent = this;
                    objpara.Show();
                }
                else if (NAME == "MENU SETTINGS")
                {
                    frmMenuSettings objpara = new frmMenuSettings();
                    objpara.MdiParent = this;
                    objpara.Show();
                }
                else if (NAME == "TEST PRICE SETTINGS")
                {
                    frmPriceList objpara = new frmPriceList();
                    objpara.MdiParent = this;
                    objpara.Show();
                }
                break;
            }
        }
Exemplo n.º 2
0
        private void MdiMain_Load(object sender, EventArgs e)
        {
            toolStripStatusLabel.Text = GLOBAL.UserGroup + " : " + GLOBAL.loginUserName;
            if (GLOBAL.ds.Tables["MENU_MAS"].Rows.Count > 0)
            {
                for (int i = 0; i < GLOBAL.ds.Tables["MENU_MAS"].Rows.Count; i++)
                {
                    bool Right = false;
                    if (GLOBAL.UserGroup.ToUpper() != "ADMIN")
                    {
                        DataRow[] row = GLOBAL.ds.Tables["USER_RIGHTS"].Select("U_CODE='" + GLOBAL.loginUserId + "' AND MENU_CODE='" + Convert.ToString(GLOBAL.ds.Tables["MENU_MAS"].Rows[i]["MENU_CODE"]) + "'");

                        if (row.Length != 0)
                        {
                            if (Convert.ToInt32(row[0]["RIGHTS"]) == 1)
                            {
                                Right = true;
                            }
                        }
                    }
                    else
                    {
                        Right = true;
                    }

                    if (Right)
                    {
                        string name = Convert.ToString(GLOBAL.ds.Tables["MENU_MAS"].Rows[i]["MENU_CODE"]) + "ToolStripMenuItem";
                        System.Windows.Forms.ToolStripMenuItem MenuItem = new System.Windows.Forms.ToolStripMenuItem();
                        MenuItem.Name   = name;
                        MenuItem.Text   = Convert.ToString(GLOBAL.ds.Tables["MENU_MAS"].Rows[i]["MENU_NAME"]);
                        MenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);

                        switch (Convert.ToString(GLOBAL.ds.Tables["MENU_MAS"].Rows[i]["MENU_GROUP"]).ToUpper())
                        {
                        case "MASTER":
                            this.patientsToolStripMenuItem.DropDownItems.Add(MenuItem);
                            break;

                        case "REPORT":
                            this.reportsToolStripMenuItem.DropDownItems.Add(MenuItem);
                            break;

                        case "USER":
                            this.viewMenu.DropDownItems.Add(MenuItem);
                            break;

                        case "SETTINGS":
                            this.settingsToolStripMenuItem.DropDownItems.Add(MenuItem);
                            break;
                        }
                    }
                }
            }

            //this.NewReportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            //this.NewReportToolStripMenuItem.Name = "NewReportToolStripMenuItem";
            //this.NewReportToolStripMenuItem.Size = new System.Drawing.Size(262, 22);
            //this.NewReportToolStripMenuItem.Text = "New Report";
            //this.NewReportToolStripMenuItem.Click += new System.EventHandler(this.heamogramReportToolStripMenuItem_Click);
            //this.reportsToolStripMenuItem.DropDownItems.Add(NewReportToolStripMenuItem);
            if (GLOBAL.ds.Tables["COMP_MAS"].Rows.Count == 0)
            {
                frmCompanySettings objpara = new frmCompanySettings();
                objpara.MdiParent = this;
                objpara.Show();
            }
        }