Esempio n. 1
0
        /// <summary>
        /// 먹스 인포가 변경되었을 때
        /// </summary>
        void optionForm_evtMUXInfoChanged()
        {
            //0. 오라클 접속 변수 얻어오기
            odec = DbConn.GetDbConn();

            try
            {
                // MUX 인포를 DB에서 읽어 와 세팅한다.
                StringBuilder sBuilder = new StringBuilder(100);
                sBuilder.Append(" SELECT  useflag , muxid, muxdesc, status, ip ");
                sBuilder.Append(" FROM muxInfo ");

                DataTable dTable = new DataTable();

                if (odec.openDb())
                {
                    dTable = odec.getDataTable(sBuilder.ToString(), "muxInfo");
                }


                if (dTable.Rows.Count > 0)
                {
                    //초기화
                    this.mainviewform.lvMUXInfos.Items.Clear();

                    int    i         = 0;
                    string strUse    = "사용";
                    string strStatus = "정상";
                    foreach (DataRow dRow in dTable.Rows)
                    {
                        if (dRow[0].ToString().Equals(0))
                        {
                            strUse = "미사용";
                        }
                        if (dRow[3].ToString().Equals(0))
                        {
                            strStatus = "이상";
                        }


                        ListViewItem lvItem = new ListViewItem(new string[] { strUse
                                                                              , dRow[1].ToString()
                                                                              , dRow[2].ToString()
                                                                              , strStatus
                                                                              , dRow[4].ToString() });
                        this.mainviewform.lvMUXInfos.Items.Insert(i, lvItem);
                        i++;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("EWSSystem.MainForm.optionForm_evtMUXInfoChanged()| " + ex.Message);
                Log.WriteLog("EWSSystem.MainForm.optionForm_evtMUXInfoChanged()| " + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 추가 버튼 눌렀을 때
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //0. MUX Id 구하기 (DB-Select)
            int       dTableCnt = 0;
            DataTable dTable    = null;

            try
            {
                StringBuilder sBuilder = new StringBuilder(100);
                sBuilder.Append(" SELECT max(muxid)+1 FROM muxinfo ");

                //DataTable dTable = new DataTable();

                if (odec.openDb())
                {
                    dTable    = odec.getDataTable(sBuilder.ToString(), "muxInfo");
                    dTableCnt = Convert.ToInt32(dTable.Rows[0][0].ToString());
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("EWSSystem.OptionDialog.btnAdd_Click(DB-Select)| " + ex.Message);
                Log.WriteLog("EWSSystem.OptionDialog.btnAdd_Click(DB-Select)| " + ex.Message);
            }

            //1. (DB -Insert)

            if (CheckInputValue() == true) //유효성 검사
            {
                if (odec.openDb())
                {
                    int intChecked = 1;
                    if (this.cbxIsUse.Checked == false)
                    {
                        intChecked = 0;
                    }

                    try
                    {
                        StringBuilder sBuilder = new StringBuilder();
                        sBuilder.Append("INSERT INTO muxInfo VALUES(:1, :2, :3, :4, :5) ");
                        List <oracle_parameter> inner_parameters = new List <oracle_parameter>();

                        //사용여부, 구분, IP, 설명, 상태
                        inner_parameters.Add(
                            new oracle_parameter("muxid", oracle_parameter.OracleDataType.Int32, dTableCnt, ParameterDirection.Input));
                        inner_parameters.Add(
                            new oracle_parameter("ip", oracle_parameter.OracleDataType.Varchar2, this.txtIP.Text, ParameterDirection.Input));
                        inner_parameters.Add(
                            new oracle_parameter("muxdesc", oracle_parameter.OracleDataType.Varchar2, this.txtDescription.Text, ParameterDirection.Input));
                        inner_parameters.Add(
                            new oracle_parameter("useflag", oracle_parameter.OracleDataType.Int32, intChecked, ParameterDirection.Input));
                        inner_parameters.Add(
                            new oracle_parameter("status", oracle_parameter.OracleDataType.Int32, 0, ParameterDirection.Input));

                        int i = odec.WorkSql(sBuilder.ToString(), inner_parameters, "muxInfo");
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine("EWSSystem.OptionDialog.btnAdd_Click(DB-Insert)| " + ex.Message);
                        Log.WriteLog("EWSSystem.OptionDialog.btnAdd_Click(DB-Insert)| " + ex.Message);
                    }
                }


                // 2. 리스트 추가
                DataTable dTable2 = new DataTable();

                try
                {
                    StringBuilder sBuilder2 = new StringBuilder(100);
                    sBuilder2.Append(" SELECT muxid,  useflag , ip, muxdesc ");
                    sBuilder2.Append(" FROM muxInfo ");

                    if (odec.openDb())
                    {
                        dTable2 = odec.getDataTable(sBuilder2.ToString(), "muxInfo");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("EWSSystem.OptionDialog.btnAdd_Click(DB-Select All 리스트 추가)| " + ex.Message);
                    Log.WriteLog("EWSSystem.OptionDialog.btnAdd_Click(DB-Select All 리스트 추가)| " + ex.Message);
                }

                if (dTable2.Rows.Count > 0)
                {
                    this.lvMUXList.Items.Clear();
                    int    num    = 1;
                    string strUse = "사용";
                    foreach (DataRow dRow in dTable2.Rows)
                    {
                        if (dRow[1].ToString().Equals(0))
                        {
                            strUse = "미사용";
                        }

                        ListViewItem lvItem = new ListViewItem(new string[] { dRow[0].ToString()
                                                                              , num.ToString()
                                                                              , strUse
                                                                              , dRow[2].ToString()
                                                                              , dRow[3].ToString() });
                        this.lvMUXList.Items.Add(lvItem);
                        num++;
                    }
                }


                //3. 메세지 박스 출력
                MessageBox.Show(" MUX 정보가 추가되었습니다. ");

                //4. 메세지 박스 초기화
                this.cbxIsUse.Checked    = true;
                this.txtDescription.Text = "";
                this.txtIP.Text          = "";
                this.txtMuxId.Text       = "";

                this.evtMUXInfoChanged();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 폼이 로드될 때
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OptionForm_Load(object sender, EventArgs e)
        {
            //0. 오라클 접속 변수 얻어오기
            odec = DbConn.GetDbConn();

            //1. 설정창
            //TCP Server
            this.txtPort.Text = ConfigurationManager.AppSettings["TCPPort"];
            //MUX 기본
            this.txtMUXTcId.Text  = ConfigurationManager.AppSettings["MUXTcId"];
            this.txtMUXRetry.Text = ConfigurationManager.AppSettings["MUXRetry"];

            //특수메세지
            this.txtSpcMaxId.Text     = ConfigurationManager.AppSettings["SpcMaxId"];
            this.txtSpcRepeatNum.Text = ConfigurationManager.AppSettings["SpcRepeatNum"];
            this.txtSpcWaitTime.Text  = ConfigurationManager.AppSettings["SpcWaitTime"];
            this.txtSpcCycle.Text     = ConfigurationManager.AppSettings["SpcCycle"];

            //일반메세지
            this.txtNorMaxId.Text     = ConfigurationManager.AppSettings["NorMaxId"];
            this.txtNorProcNum.Text   = ConfigurationManager.AppSettings["NorProcNum"];
            this.txtNorRepeatNum.Text = ConfigurationManager.AppSettings["NorRepeatNum"];
            this.txtNorCycle.Text     = ConfigurationManager.AppSettings["NorCycle"];
            this.txtNorTransTime.Text = ConfigurationManager.AppSettings["NorTransTime"];
            this.txtNorWaitTime.Text  = ConfigurationManager.AppSettings["NorWaitTime"];


            //2. 먹스 관리 창
            // 먹스 정보 DB 로드
            StringBuilder sBuilder = new StringBuilder(100);

            sBuilder.Append(" SELECT muxid,  useflag , ip, muxdesc ");
            sBuilder.Append(" FROM muxInfo ");

            DataTable dTable = new DataTable();

            try
            {
                if (odec.openDb())
                {
                    dTable = odec.getDataTable(sBuilder.ToString(), "muxInfo");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("EWSSystem.OptionDialog.OptionForm_Load()| " + ex.Message);
                Log.WriteLog("EWSSystem.OptionDialog.OptionForm_Load()| " + ex.Message);
            }


            if (dTable.Rows.Count > 0)
            {
                this.lvMUXList.Items.Clear();
                int    num    = 1;
                string strUse = "사용";
                foreach (DataRow dRow in dTable.Rows)
                {
                    if (dRow[1].ToString().Equals(0))
                    {
                        strUse = "미사용";
                    }

                    ListViewItem lvItem = new ListViewItem(new string[] { dRow[0].ToString()
                                                                          , num.ToString()
                                                                          , strUse
                                                                          , dRow[2].ToString()
                                                                          , dRow[3].ToString() });
                    this.lvMUXList.Items.Add(lvItem);
                    num++;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 조회 버튼을 눌렀을 때
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            ////1. 조건 받아오기
            ////1)메세지 종류 (일반 OR 특수)
            ////2) 기간 (FROM - TO)
            ////3) 상태

            //0. 결과를 저장한 DataTable
            this.lvHistoryList.Items.Clear();
            DataTable dTable = new DataTable();

            try
            {
                //1. 쿼리문 만들기
                StringBuilder sBuilder = new StringBuilder(100);
                sBuilder.Append(" SELECT msgType, msgid, sourcedept, revtime, status, tstarttime, tendtime ");
                sBuilder.Append(" FROM message ");

                // 1-1. 메세지 종류
                sBuilder.Append(" WHERE msgType = ");
                if (this.rbNormal.Checked == true)
                {
                    sBuilder.Append(" 0 ");
                }
                else
                {
                    sBuilder.Append(" 1 ");
                }

                //1-2. 수신 시간 (기존 포멧 : yyyy-MM-dd HH:mm)
                string startTime = this.dtStartTime.Text.Substring(0, 4);
                startTime += this.dtStartTime.Text.Substring(5, 2);
                startTime += this.dtStartTime.Text.Substring(8, 2);
                startTime += this.dtStartTime.Text.Substring(11, 2);
                startTime += this.dtStartTime.Text.Substring(14, 2);
                startTime += "00";

                string endTime = this.dtEndTime.Text.Substring(0, 4);
                endTime += this.dtEndTime.Text.Substring(5, 2);
                endTime += this.dtEndTime.Text.Substring(8, 2);
                endTime += this.dtEndTime.Text.Substring(11, 2);
                endTime += this.dtEndTime.Text.Substring(14, 2);
                endTime += "59";

                sBuilder.Append(" AND revtime >= '" + startTime + "' AND revtime <= '" + endTime + "'");

                //1-3. 상태

                switch (this.cbStatus.Text)
                {
                case "대기":
                    sBuilder.Append(" AND status = 0 ");
                    break;

                case "전송중":
                    sBuilder.Append(" AND status = 1 ");
                    break;

                case "종료":
                    sBuilder.Append(" AND status = 2 ");
                    break;

                default:
                    break;
                }


                if (odec.openDb())
                {
                    dTable = odec.getDataTable(sBuilder.ToString(), "messege");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("EWSSystem.HistoryForm.btnSearch_Click(DB 조회)| " + ex.Message);
                Log.WriteLog("EWSSystem.HistoryForm.MainFobtnSearch_Clickrm_Load(DB조회)| " + ex.Message);
            }

            if (dTable.Rows.Count > 0)
            {
                try
                {
                    int    i       = 0;
                    string msgType = "일반";
                    string status  = "";

                    foreach (DataRow dRow in dTable.Rows)
                    {
                        if (dRow[0].ToString().Equals("1"))
                        {
                            msgType = "특수";
                        }

                        switch (dRow[4].ToString())
                        {
                        case "0":
                            status = "대기";
                            break;

                        case "1":
                            status = "전송중";
                            break;

                        case "2":
                            status = "종료";
                            break;

                        default:
                            break;
                        }


                        string revTime = dRow[3].ToString().Substring(0, 4)
                                         + "-"
                                         + dRow[3].ToString().Substring(4, 2)
                                         + "-"
                                         + dRow[3].ToString().Substring(6, 2)
                                         + " "
                                         + dRow[3].ToString().Substring(8, 2)
                                         + ":"
                                         + dRow[3].ToString().Substring(10, 2)
                                         + ":"
                                         + dRow[3].ToString().Substring(12, 2);

                        string tStartTime = dRow[5].ToString().Substring(0, 4)
                                            + "-"
                                            + dRow[5].ToString().Substring(4, 2)
                                            + "-"
                                            + dRow[5].ToString().Substring(6, 2)
                                            + " "
                                            + dRow[5].ToString().Substring(8, 2)
                                            + ":"
                                            + dRow[5].ToString().Substring(10, 2)
                                            + ":"
                                            + dRow[5].ToString().Substring(12, 2);

                        string tEndTime = dRow[6].ToString().Substring(0, 4)
                                          + "-"
                                          + dRow[6].ToString().Substring(4, 2)
                                          + "-"
                                          + dRow[6].ToString().Substring(6, 2)
                                          + " "
                                          + dRow[6].ToString().Substring(8, 2)
                                          + ":"
                                          + dRow[6].ToString().Substring(10, 2)
                                          + ":"
                                          + dRow[6].ToString().Substring(12, 2);

                        ListViewItem lvHistoryItem = new ListViewItem(new string[] { msgType
                                                                                     , dRow[1].ToString()
                                                                                     , dRow[2].ToString()
                                                                                     , revTime
                                                                                     , status
                                                                                     , tStartTime
                                                                                     , tEndTime });
                        this.lvHistoryList.Items.Insert(i, lvHistoryItem);
                        i++;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("EWSSystem.HistoryForm.btnSearch_Click(리스트 출력)| " + ex.Message);
                    Log.WriteLog("EWSSystem.HistoryForm.MainFobtnSearch_Clickrm_Load(리스트 출력)| " + ex.Message);
                }
            }
        }