コード例 #1
0
        public static bool Restore(tblAppNavigation tbl)

        {
            bool rVal = false;

            foreach (Form frm in frmNavigate.ActiveForm.MdiChildren)
            {
                try
                {
                    clsForm f = (clsForm)frm;

                    if (f.tblNav.NAVID == tbl.NAVID)
                    {
                        frm.BringToFront();
                        frm.Focus();
                        frm.WindowState = FormWindowState.Normal;
                        rVal            = true;
                    }
                }
                catch (Exception ex)
                {
                    if (frm.Name == tbl.NAV_Item)
                    {
                        frm.BringToFront();
                        frm.Focus();
                        frm.WindowState = FormWindowState.Normal;
                        rVal            = true;
                    }
                }
            }

            return(rVal);
        }
コード例 #2
0
        public static frmNavigate ReturnFormInst(string strForm)
        {
            clsForm frm = new clsForm();

            foreach (clsForm f in Application.OpenForms)
            {
                if (f.Name == strForm)
                {
                    frm = f;
                }
            }

            return((frmNavigate)frm);
        }
コード例 #3
0
        public static void DropDownTBL(clsForm frm, TypeAhead txt, Int32 intAPPID, Int32 intNAVID, string strCol, string strCriteria, int intASID, string strDefault, int intVal)
        {
            var dy = new Dictionary <int, string>();

            try
            {
                string strSQL = "p_DropDown_TBL " + intAPPID.ToString() + ", " + intNAVID.ToString() + ", " + strCol + ", '" + strCriteria + "', " + intASID.ToString();

                DataSet ds = clsDAL.ProcessSQL(strSQL, "HRL");

                if (clsDAL.dsHasData(ds))
                {
                    DataTable dt = ds.Tables[0];
                    dy = dt.AsEnumerable()
                         .ToDictionary <DataRow, int, string>(row => row.Field <int>(0),
                                                              row => row.Field <string>(1));
                }

                else
                {
                    HRLEntities db = clsStart.efdb();

                    string strDebug = "p_DropDown " + intAPPID.ToString() + ", " + intNAVID.ToString() + ", " + strCol + ", '', " + intASID.ToString();

                    Debug.Print(strDebug);

                    var q = db.p_DropDown(intAPPID, intNAVID, strCol, "", intASID);

                    var qry = (from ct in q
                               select ct).ToList();
                    dy = qry.ToDictionary(x => x.ID, x => x.Display);
                }

                if (strDefault + "" != "")
                {
                    dy = (new Dictionary <int, string> {
                        { 0, strDefault }
                    }).Concat(dy).ToDictionary(k => k.Key, v => v.Value);
                }


                txt.ParentForm  = frm;
                txt.DefaultText = strDefault;
                txt.Text        = strDefault;
                txt.DataSource  = dy;
                txt.lstWidth    = txt.Width;             // * intVal;
                if (intVal > 0)
                {
                    txt.SelectedValue = intVal;
                    try
                    {
                        var q = (from ct in txt.DataSource
                                 where ct.Key == intVal
                                 select ct).First();

                        txt.Text = q.Value.ToString();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #4
0
        private void OpenForm(tblAppNavigation tbl)
        {
            string appName = Application.ProductName;
            string mForm   = tbl.NAV_Item;


            try
            {
                if (tbl.NAV_Option == 1) //open form
                {
                    if (clsUtility.IsOpen(tbl) == false)
                    {
                        Type            oFormType        = Type.GetType(appName + "." + mForm);
                        ConstructorInfo oConstructorInfo = oFormType.GetConstructor(System.Type.EmptyTypes);
                        //clsForm frm = (clsForm)oConstructorInfo.Invoke(null);

                        clsForm frm = (clsForm)Activator.CreateInstance(oFormType);

                        frm.Icon   = Icon.FromHandle(((Bitmap)lstImage.Images[tbl.NAV_Image]).GetHicon());
                        frm.tblNav = tbl;
                        frm.Text   = tbl.NAV_Desc;

                        frm.Token     = this.Token;
                        frm.Associate = this.Associate;
                        frm.AppName   = this.AppName;
                        frm.LNID      = this.LNID;
                        frm.TSID      = this.TSID;
                        frm.APPID     = this.APPID;

                        string strDev = clsUtility.ConfigVal("DEV");



                        var lstNav = new int[] { 51, 196, 198, 326, 374, 729 };

                        if (lstNav.Contains(tbl.NAVID))
                        {
                            frm.WindowState = FormWindowState.Maximized;
                            this.Cursor     = Cursors.WaitCursor;
                            frm.Show();
                            this.Cursor = Cursors.Default;
                        }
                        else if (tbl.NAVID == 311 && this.LNID == 1)
                        {
                            frm.WindowState = FormWindowState.Maximized;
                            this.Cursor     = Cursors.WaitCursor;
                            frm.Show();
                            this.Cursor = Cursors.Default;
                        }
                        else
                        {
                            frm.MdiParent = this;
                            this.Cursor   = Cursors.WaitCursor;
                            frm.Show();
                            this.Cursor = Cursors.Default;
                            FillActiveChildFormToClient();
                        }


                        //}
                    }
                    else
                    {
                        clsUtility.Restore(tbl);
                    }
                }

                else if (tbl.NAV_Option == 7) //open help
                {
                    var qry = (from ct in db.tblApp
                               where ct.APPID == this.APPID
                               select ct).First();

                    string strNav = tbl.NAV_Item + this.Associate.AS_User + "&ORGID=" + qry.APP_HelpdeskOrg.ToString();

                    Process training = new Process();
                    training.StartInfo.FileName = strNav;
                    training.Start();
                }
            }
            catch (System.NullReferenceException Err)
            {
                Debug.WriteLine(Err.Message.ToString());
            }
            catch (Exception ErrorObject)
            {
                MessageBox.Show("Error opening form " + tbl.NAV_Item + " " + ErrorObject.Message, this.AppName);
            }

            finally
            {
            }
        }