Esempio n. 1
0
        private void timerLogout_Tick(object sender, EventArgs e)
        {
            //휴식시간 자동 로그아웃
            string sNowTime = DateTime.Now.ToString("HHmmss");
            //Console.WriteLine("now time = " + sNowTime  );

            Boolean isLogOut      = false;
            string  getLogTimeOut = "";
            string  sSql          = "";

            sSql += " SELECT OP_CODE, TIME_SET      ";
            sSql += " FROM pop_logout_Set           ";
            sSql += " WHERE 1=1                     ";
            sSql += " AND OP_CODE = 'M100'          ";  //관리자는 OP_CODE가 없으므로 M100의 값으로 로그아웃시킨다
            sSql += " ORDER BY  to_number(time_set) ";
            //Console.WriteLine("중메뉴=" + sSql);
            dc = new DataCommon();
            dt = this.dc.getTable(sSql);
            try
            {
                for (int d = 0; dt.Rows.Count > d; d++)
                {
                    getLogTimeOut = dt.Rows[d].ItemArray[1].ToString() + "00";

                    if (sNowTime == getLogTimeOut)
                    {
                        isLogOut = true;
                        break;
                    }
                }
                //Console.WriteLine("isLogOut=" + isLogOut + " ::: " + sNowTime);
                if (isLogOut)
                {
                    //트리노드이름으로 창이 있는지 검색
                    foreach (Form tmpFrm in this.MdiChildren)
                    {
                        tmpFrm.Close();
                    }

                    sLoginChk = false;

                    lblTop.Text = "";
                    tree_Menu.Nodes.Clear();

                    Main_Load(sender, e);
                }
            }
            catch { }
        }
Esempio n. 2
0
        private void clickMenuItem(object sender, EventArgs e)
        {
            Form frm = null;


            //트리노드이름으로 창이 있는지 검색

            foreach (Form tmpFrm in this.MdiChildren)
            {
                if (tmpFrm.Name == (sender as ToolStripMenuItem).Tag.ToString())
                {
                    frm = tmpFrm;
                }
            }

            //이미 창이 있다면
            if (frm != null)
            {
                //해당 창으로 이동
                frm.Focus();
            }
            else //창이 없다면
            {
                #region < 프로그램 assem을 가지고 콘트롤 하는 방법 : 복잡 응용가능 >
                try
                {
                    //if (this.tree_Menu.SelectedNode.Parent == null) return;

                    //프로그램에 검색자 만듬
                    string sMenuName = "Sekonix_pop.Page." + (sender as ToolStripMenuItem).OwnerItem.Tag.ToString() + "." + (sender as ToolStripMenuItem).Tag.ToString();

                    //권한체크
                    try
                    {
                        //if (this.tree_Menu.SelectedNode.Parent.Parent.Parent.Name == "ALL_MENU")
                        //{
                        //메뉴 권한 체크
                        //SYS_AUTHORITY테이블에서 조회하여 컬럼명이 NAME에서 값이 "화면"일경우 권한 여부 체크
                        //조회조건 : 아이디, DEL_YN, CODE
                        string sSql = "";
                        sSql  = "  SELECT NAME  ";
                        sSql += " FROM SYS_AUTHORITY ";
                        sSql += " WHERE 1 = 1      ";
                        sSql += " AND DEL_YN = 'Y' ";
                        sSql += " AND SCREEN = '" + sender + "' ";
                        sSql += " AND UPPER(ID)   = '" + Sekonix_pop.Para.USER.ID.ToUpper() + "' ";

                        Console.WriteLine("NAME=" + sSql);
                        dc = new DataCommon();
                        dt = this.dc.getTable(sSql);

                        Console.WriteLine("dt.Rows.Count=" + dt.Rows.Count);

                        try
                        {
                            if (dt.Rows.Count <= 0)
                            {
                                MessageBox.Show("메뉴 권한이 없습니다");
                                return;
                            }
                        }
                        catch
                        {
                            //MessageBox.Show("ID :" + Sekonix_pop.Para.USER.ID + " 대메뉴 권한이 없습니다");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                        return;
                    }


                    //현재 프로그램에 어셈블리를 가져옴
                    Assembly assem = Assembly.GetExecutingAssembly();

                    //노드이름과 같은 클래스를 신규생성
                    object o = assem.CreateInstance(sMenuName);

                    //클래스생성 체크
                    if (o == null)
                    {
                        return;
                    }

                    //생성된 클래스에 MdiParent 속성을 가져옴
                    PropertyInfo pMdiParnet = assem.GetType(sMenuName).GetProperty("MdiParent");
                    //속성값으로 자신(this)를 지정
                    pMdiParnet.SetValue(o, this, null);

                    //Show 멤버 실행
                    assem.GetType(sMenuName).InvokeMember("Show", BindingFlags.InvokeMethod, null, o, new object[] { });
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                #endregion
            }
        }
Esempio n. 3
0
        private void Main_Load(object sender, EventArgs e)
        {
            Sekonix_pop.Page.SYS.Main.Login Login = new Sekonix_pop.Page.SYS.Main.Login();

            Login.ShowDialog(this);

            if (!Login.bLogin)
            {
                sLoginChk = false;
                this.Close();
            }

            sLoginChk = true;

            lblTop.Text = Sekonix_pop.Para.USER.NAME + "님 수고하세요. [비밀번호 변경]";



            /*
             * //버전체크
             * if (VersionChk())
             * {
             *  MessageBox.Show("버전이 동일합니다");
             * }
             * else
             * {
             *  if (MessageBox.Show("새로운 버전으로 업그레이드합니다.", "공지", MessageBoxButtons.YesNo).ToString() == "Yes")
             *  {
             *      //FTP 다운로드 팝업 호출
             *  }
             *
             * }
             * */


            #region 대메뉴 생성
            string sSql = "";
            sSql  = " SELECT CODE , D_CATEGORY  ";
            sSql += "   FROM SYS_AUTHORITY ";
            sSql += " WHERE NAME = '대'      ";
            sSql += " AND UPPER(ID) = '" + Sekonix_pop.Para.USER.ID.ToUpper() + "' ";
            sSql += " ORDER BY SEQ                                ";
            dc    = new DataCommon();
            dt    = this.dc.getTable(sSql);
            try
            {
                if (dt.Rows.Count > 0)
                {
                    tree_Menu.Nodes.Add(dt.Rows[0].ItemArray[1].ToString());
                    tree_Menu.Nodes[0].Name = dt.Rows[0].ItemArray[0].ToString();
                }
                else
                {
                    MessageBox.Show("메뉴생성에 문제가 발생하였습니다. 관리자를 호출하세요");
                }
            }
            catch
            {
                //MessageBox.Show("ID :" + Sekonix_pop.Para.USER.ID + " 대메뉴 권한이 없습니다");
            }
            #endregion

            #region 중메뉴 생성
            sSql  = " SELECT CODE , D_CATEGORY , J_CATEGORY   ";
            sSql += "   FROM SYS_AUTHORITY ";
            sSql += " WHERE NAME = '중'      ";
            sSql += " AND UPPER(ID) = '" + Sekonix_pop.Para.USER.ID.ToUpper() + "' ";
            sSql += " ORDER BY  SEQ";
            Console.WriteLine("중메뉴=" + sSql);
            dc = new DataCommon();
            dt = this.dc.getTable(sSql);
            try
            {
                for (int d = 0; dt.Rows.Count > d; d++)
                {
                    for (int td = 0; tree_Menu.Nodes.Count > td; td++)
                    {
                        if (tree_Menu.Nodes[td].Text == dt.Rows[d].ItemArray[1].ToString())
                        {
                            tree_Menu.Nodes[td].Nodes.Add(dt.Rows[d].ItemArray[2].ToString());
                            tree_Menu.Nodes[td].Nodes[tree_Menu.Nodes[td].Nodes.Count - 1].Name = dt.Rows[d].ItemArray[0].ToString();
                            tree_Menu.Nodes[td].Expand();
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("중메뉴의 권한이 문제가 생겼습니다 \n 관리자에게 연락바랍니다");
            }
            #endregion

            #region 소메뉴 관리
            sSql  = " SELECT CODE , D_CATEGORY , J_CATEGORY , S_CATEGORY  ";
            sSql += "   FROM SYS_AUTHORITY ";
            sSql += " WHERE NAME = '소'      ";
            sSql += " AND UPPER(ID) = '" + Sekonix_pop.Para.USER.ID.ToUpper() + "' ";
            Console.WriteLine("소메뉴=" + sSql);
            dc = new DataCommon();
            dt = this.dc.getTable(sSql);

            try
            {
                for (int d = 0; dt.Rows.Count > d; d++)
                {
                    for (int td = 0; tree_Menu.Nodes.Count > td; td++)
                    {
                        if (tree_Menu.Nodes[td].Text == dt.Rows[d].ItemArray[1].ToString())
                        {
                            for (int jd = 0; tree_Menu.Nodes[td].Nodes.Count > jd; jd++)
                            {
                                if (tree_Menu.Nodes[td].Nodes[jd].Text == dt.Rows[d].ItemArray[2].ToString())
                                {
                                    tree_Menu.Nodes[td].Nodes[jd].Nodes.Add(dt.Rows[d].ItemArray[3].ToString());
                                    tree_Menu.Nodes[td].Nodes[jd].Nodes[tree_Menu.Nodes[td].Nodes[jd].Nodes.Count - 1].Name = dt.Rows[d].ItemArray[0].ToString();
                                    tree_Menu.Nodes[td].Nodes[jd].Expand();
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("소메뉴의 권한이 문제가 생겼습니다 관리자에게 연락바랍니다");
            }
            #endregion

            #region 화면관리
            sSql  = " SELECT CODE , D_CATEGORY , J_CATEGORY , S_CATEGORY , SCREEN ";
            sSql += "   FROM SYS_AUTHORITY ";
            sSql += " WHERE NAME = '화면'      ";
            sSql += " AND UPPER(ID) = '" + Sekonix_pop.Para.USER.ID.ToUpper() + "' ";
            sSql += " ORDER BY SEQ ";

            dt = this.dc.getTable(sSql);
            try
            {
                for (int d = 0; dt.Rows.Count > d; d++)
                {
                    for (int td = 0; tree_Menu.Nodes.Count > td; td++)
                    {
                        if (tree_Menu.Nodes[td].Text == dt.Rows[d].ItemArray[1].ToString())
                        {
                            for (int jd = 0; tree_Menu.Nodes[td].Nodes.Count > jd; jd++)
                            {
                                if (tree_Menu.Nodes[td].Nodes[jd].Text == dt.Rows[d].ItemArray[2].ToString())
                                {
                                    for (int sd = 0; tree_Menu.Nodes[td].Nodes[jd].Nodes.Count > sd; sd++)
                                    {
                                        if (tree_Menu.Nodes[td].Nodes[jd].Nodes[sd].Text == dt.Rows[d].ItemArray[3].ToString())
                                        {
                                            tree_Menu.Nodes[td].Nodes[jd].Nodes[sd].Nodes.Add(dt.Rows[d].ItemArray[4].ToString());
                                            tree_Menu.Nodes[td].Nodes[jd].Nodes[sd].Nodes[tree_Menu.Nodes[td].Nodes[jd].Nodes[sd].Nodes.Count - 1].Name = dt.Rows[d].ItemArray[0].ToString();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("화면단위 권한이 문제가 생겼습니다 관리자에게 연락바랍니다");
            }
            #endregion
        }