Example #1
0
        private void thChkAlive(object obj)
        {
            try
            {
                string msg;

                if (iChkCnt == 0)
                {
                    msg     = "NewLists 프로그램이 시작 되었음.";
                    iChkCnt = 1;
                }
                else
                {
                    msg = "NewLists 프로그램이 동작중.....";
                }

                //시작시간
                Function.form.control.Invoke_usrInputBox_Value(inpHeadChkTime, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));
                Function.form.control.Invoke_usrInputBox_Value(inpHeadNext, string.Format("(+{0}분){1}", vari.ChkInterval, Fnc.Date2String(DateTime.Now.AddMinutes(vari.ChkInterval), Fnc.enDateType.DateTime)));


                TelegramMsgSend("Error", msg);
            }
            catch (Exception ex)
            {
                ProcException(ex, "thChkAlive", false);
            }
        }
Example #2
0
        /// <summary>
        /// 신규 여부를 확인 하고 추가한다.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="i_name"></param>
        /// <returns></returns>
        public static bool isNewList(string site, string i_name)
        {
            bool rtn;

            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"SELECT COUNT(*) cnt
FROM ICO
WHERE SITE = '{0}'
AND I_NAME = '{1}'", site, i_name);



            using (DataSet ds = db.dsExcute_Query(sql))
            {
                rtn = Fnc.obj2int(ds.Tables[0].Rows[0]["cnt"]) < 1;
            }

            //신규 처리
            if (rtn)
            {
                sql = string.Format(@"INSERT INTO ICO ( SITE, I_NAME, DATE )
VALUES ('{0}', '{1}', '{2}' )", site, i_name, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

                db.intExcute_Query(sql);
            }

            return(rtn);
        }
Example #3
0
        /// <summary>
        /// ¸Þ½ÃÁö â¿¡ ³»¿ëÀ» º¸¿© ÁØ´Ù.(¸Þ½ÃÁö ŸÀÔ »ç¿ë)
        /// </summary>
        /// <param name="msgType"></param>
        /// <param name="strMessage"></param>
        /// <param name="isLog"></param>
        protected virtual void SetMessage(enMsgType msgType, string strMessage, bool isLog)
        {
            if (stBar.InvokeRequired)
            {
                stBar.Invoke(new delSetMessage(SetMessage), new object[] { msgType, strMessage, isLog });
                return;
            }



            if (msgType != enMsgType.Error && strMessage.Equals(string.Empty))
            {
                tsLabel.Image = null;
                tsLabel.Text  = string.Empty;
                return;
            }

            //¾ÆÀÌÄÜ ¼³Á¤
            SetMessageIcon(msgType);


            tsLabel.Text     = LastMessage = string.Format("[{0}] {1}", Fnc.Date2String(DateTime.Now, Fnc.enDateType.Time), strMessage);
            LastMessageError = msgType == enMsgType.Error;

            if (clsLog != null && isLog)
            {
                clsLog.WLog(strMessage);
            }

            if (_onMessageChanged != null)
            {
                _onMessageChanged(LastMessageError, strMessage);
            }
        }
Example #4
0
        public static bool isNewNotice(string site, string key, string title)
        {
            bool rtn;

            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"SELECT COUNT(*) cnt
FROM Notice
WHERE SITE = '{0}'
AND Key = '{1}'", site, key);

            using (DataSet ds = db.dsExcute_Query(sql))
            {
                rtn = Fnc.obj2int(ds.Tables[0].Rows[0]["cnt"]) < 1;
            }

            //신규 처리
            if (rtn)
            {
                sql = string.Format(@"INSERT INTO Notice ( SITE, Key, Title, DATE )
VALUES ('{0}', '{1}', '{2}', '{3}' )", site, key, title, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

                db.intExcute_Query(sql);
            }

            return(rtn);
        }
Example #5
0
        private void frmBaseForm_Load(object sender, EventArgs e)
        {
            //title에 시간 관련 처리..
            lblStartTime.Text = Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime);
            tmrDtNow          = new System.Threading.Timer(new TimerCallback(UpdateDtNow), null, 0, 1000);

            this.Text += "  v" + Application.ProductVersion;

#if (DEBUG && TEST)
            this.Text += " --- Debug/TEST Mode";
#elif (DEBUG)
            this.Text += " --- Debug Mode";
#else
            //this.WindowState = FormWindowState.Maximized;
#endif

            //Logo파일..
            if (File.Exists(@".\logo.bmp"))
            {
                picLogo.Load(@".\logo.bmp");
            }

            Thread thInitForm = new Thread(new ThreadStart(initForm));

            thInitForm.IsBackground = true;
            thInitForm.Start();
        }
Example #6
0
        /// <summary>
        /// 모니터링 로그를 추가한다.
        /// </summary>
        /// <param name="gbn"></param>
        /// <param name="log"></param>
        private void MoniLogAdd(DateTime dtm, string gbn, string log, bool isError = false, Function.enStringLocation loc = enStringLocation.Front)
        {
            if (lstMoniLog.InvokeRequired)
            {
                lstMoniLog.Invoke(new delMoniLogAdd(MoniLogAdd), dtm, gbn, log, isError, loc);
                return;
            }

            ListViewItem li = new ListViewItem(new string[] { string.Empty, Fnc.Date2String(dtm, Fnc.enDateType.DateTime), gbn, log });

            if (loc == enStringLocation.Front)
            {
                lstMoniLog.Items.Insert(0, li);
            }
            else
            {
                lstMoniLog.Items.Add(li);
            }

            //최대 로그 수를 유지한다.
            while (lstMoniLog.Items.Count > vari.iLogMaxCnt)
            {
                lstMoniLog.Items.RemoveAt(lstMoniLog.Items.Count - 1);
            }
        }
Example #7
0
        /// <summary>
        /// 등록버튼
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnInput_Click(object sender, EventArgs e)
        {
            if (strCartype == string.Empty)
            {
                Fnc.ShowMsg(this, "CarType를 선택 하여 주십시요", string.Empty, frmMessage.enMessageType.OK);
                return;
            }

            if (cmbPartCode.SelectedIndex == -1)
            {
                Fnc.ShowMsg(this, strCode + "를 선택 하여 주십시요", string.Empty, frmMessage.enMessageType.OK);
                return;
            }

            if (txtTargetCnt.Value == 0)
            {
                Fnc.ShowMsg(this, "수량을 입력 하여 주십시요.", string.Empty, frmMessage.enMessageType.OK);
                return;
            }

            string strDt = Fnc.Date2String(dtPlan.Value, Fnc.enDateType.DBType);
            //string strCarType = ((DataRowView)cmbCarType.SelectedItem)["CODEVALUE"].ToString();
            //string strCarTypeName = ((DataRowView)cmbCarType.SelectedItem)["CODEVALUENAME"].ToString();
            string strPartCode     = ((DataRowView)cmbPartCode.SelectedItem)["CODEVALUE"].ToString();
            string strPartCodeName = ((DataRowView)cmbPartCode.SelectedItem)["CODEVALUEName"].ToString();
            string strTarget_Cnt   = txtTargetCnt.Value.ToString();
            string strNo           = string.Format("{0}", lstPlan.Items.Count + 1);

            lstPlan.Items.Add(new ListViewItem(new string [] { strNo, strDt, strCarTypeName, strCarType, strPartCodeName, strPartCode, strTarget_Cnt }));

            ResetInput();
        }
Example #8
0
        /// <summary>
        /// 사이트에 신규 심볼을 추가한다.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="i_name"></param>
        public static void NewList_Add(string site, string i_name)
        {
            Function.Db.SQLite db = new Function.Db.SQLite(vari.db_path);

            string sql = string.Format(@"INSERT INTO ICO ( SITE, I_NAME, DATE )
VALUES ('{0}', '{1}', '{2}' )", site, i_name, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));

            db.intExcute_Query(sql);
        }
Example #9
0
        private void log_add(string log)
        {
            if (lstLog.InvokeRequired)
            {
                lstLog.Invoke(new dellog_add(log_add), new object[] { log });
                return;
            }

            int log_max_cnt = 100;

            ListViewItem item = new ListViewItem(new string[] { "", Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime), log });

            lstLog.Items.Insert(0, item);

            while (lstLog.Items.Count > log_max_cnt)
            {
                lstLog.Items.RemoveAt(lstLog.Items.Count - 1);
            }
        }
Example #10
0
        /// <summary>
        /// 메시지 창에 내용을 보여 준다.
        /// </summary>
        /// <param name="isError">에러 여부</param>
        /// <param name="strMessage"></param>
        /// <param name="isLog"></param>
        protected virtual void SetMessage(bool isError, string strMessage, bool isLog)
        {
            if (lblMessage.InvokeRequired)
            {
                lblMessage.Invoke(new delSetMessage(SetMessage), new object[] { isError, strMessage, isLog });
                return;
            }

            if (isError)
            {
                lblMessage.BackColor = Color.Tomato;
            }
            else
            {
                lblMessage.BackColor = Color.Black;
            }

            lblMessage.Text = string.Format("[{0}] {1}", Fnc.Date2String(DateTime.Now, Fnc.enDateType.Time), strMessage);

            if (clsLog != null && isLog)
            {
                clsLog.WLog(strMessage);
            }
        }
Example #11
0
        private void frmNewLists_Load(object sender, EventArgs e)
        {
#if (DEBUG)
            this.Text += "[DEBUG]";
#endif
            this.Text += " v." + Application.ProductVersion;

            //시작시간
            inpHeadStartTime.Value = Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime);


            //텔레그램 전송 로그
            cTelLg = new Function.Util.Log(vari.pgm_path + "\\LOG", "TEL_SEND_LOG", 30, true);



            vari.Setting.Group_Select("PGM");
            //설정된 전화번호 가져오기
            vari.HP     = vari.Setting.Value_Get("PGM", "HP", "");
            inpHP.Value = vari.HP;

            //텔래그램 연결
            btnHPConn_Click(null, null);


            sItems = new string[] {
                "Binance"                                        //0
                , "Bithumb"                                      //1
                , "BinanceWallet"                                //2
                , "Upbit"                                        //3
                , "bittrex(미동작)"                                 //4
                , "Upbit공지"                                      //5
                , "Bithumb공지"                                    //6
                , "huobi코리아공지"                                   //7
                , "huobi프로공지"                                    //8
                , "Coinnest공지(미사용)"                              //9
            };
            sUrls = new string[]
            {
                "https://www.binance.com/api/v1/ticker/allPrices"                                                           //바이낸스 가격
                , "https://api.bithumb.com/public/ticker/all"                                                               //빗썸
                , "https://www.binance.com/assetWithdraw/getAllAsset.html"                                                  //바이낸스 지갑
                , "https://crix-api.upbit.com/v1/crix/trends/change_rate"                                                   //upbit 가격
                , "https://bittrex.com/api/v1.1/public/getmarketsummaries"                                                  //비트렉스 가격
                , "https://api-manager.upbit.com/api/v1/notices?page=1&per_page=5"                                          //업비트 공지
                , "https://bithumb.cafe/notice"                                                                             //빗썸공지
                , "https://api.huobi.co.kr/v1/notice/list?language=ko-KR&limit=5&currPage=1"                                //후오비코리아 공지
                , ""
                , "https://www.coinnest.co.kr/gonggao/"                                                                     //코인네스트 공지
            };

            cItems  = new clsItem[sItems.Length];
            tmrWork = new System.Threading.Timer[cItems.Length];

            int idx = 0;

            foreach (string item in sItems)
            {
                cItems[idx]         = new clsItem(idx, item, sUrls[idx]);
                cItems[idx].lstItem = new ListViewItem(new string[] { "", item, "0", "" });

                lstNew.Items.Add(cItems[idx].lstItem);

#if (!no_tmr)
                switch (idx)
                {
                case 0:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thBinance), cItems[idx], 1000, 5000);
                    break;

                case 1:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thBithumb), cItems[idx], 1000, 5000);
                    break;

                case 2:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thBinanceWallet), cItems[idx], 1000, 5000);
                    break;

                case 3:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thUpbit), cItems[idx], 1000, 5000);
                    break;

                case 5:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thUpbitNotice), cItems[idx], 1000, 5000);
                    break;

                case 6:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thBithumbNotice), cItems[idx], 1000, 5000);
                    break;

                case 7:
                    tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thHoubiNotice), cItems[idx], 1000, 5000);
                    break;

                case 8:
                    //tmrWork[idx] = new System.Threading.Timer(new TimerCallback(thCoinnestNotice), cItems[idx], 1000, 5000);
                    break;
                }
#endif

                idx++;
            }


            //설정 ?분 간격으로 문자 보냄
            tmrChkAlive = new System.Threading.Timer(new TimerCallback(thChkAlive), null, 1000, 1000 * 60 * vari.ChkInterval);
        }
Example #12
0
        public static DataTable Data_Search(DateTime dtFrom, DateTime dtTo, string cartype, string pono, string vin, string trimin, string rst, string stationid)
        {
            MsSQL sql = new MsSQL(vari.conn);

            string col;
            string nm   = string.Empty;
            string cols = string.Empty;

            string where = string.Empty;
            DataRow[] rows;

            //조회 컬럼 이름 변경
            for (int t = 1; t <= vari.tool_max_lenth; t++)
            {
                for (int n = 1; n <= vari.rst_max_lenth; n++)
                {
                    nm = string.Empty;

                    col = $"T{t:D2}";

                    rows = vari.dt_tool_name.Select($"CODEVALUE = '{col}'");

                    if (rows.Length > 0)
                    {
                        nm = Fnc.obj2String(rows[0]["CODEVALUENAME"]);
                    }

                    if (!nm.Equals(string.Empty))
                    {
                        col = $"N{n:D2}";

                        rows = vari.dt_rst_name.Select($"CODEVALUE = '{col}'");

                        if (rows.Length > 0)
                        {
                            nm = $"'{nm}[{rows[0]["CODEVALUENAME"]}]'";
                        }
                        else
                        {
                            nm = string.Empty;
                        }
                    }

                    if (nm.Equals(string.Empty))
                    {
                        break;
                    }

                    cols += $", T{t:D2}_N{n:D2} {nm}";
                }

                if (nm.Equals(string.Empty))
                {
                    break;
                }
            }


            //조회 조건 만듦
            where = string.Format("AND CreateDate between  CONVERT(datetime,'{0}') and CONVERT(datetime,'{1}')", Fnc.Date2String(dtFrom, Fnc.enDateType.DateTime), Fnc.Date2String(dtTo, Fnc.enDateType.DateTime));

            if (!cartype.Equals(string.Empty))
            {
                where += $"\r\n\t AND CARTYPE = '{cartype}' ";
            }
            if (!pono.Equals(string.Empty))
            {
                where += $"\r\n\t AND PONO = '{pono}' ";
            }
            if (!vin.Equals(string.Empty))
            {
                where += $"\r\n\t AND VIN = '{vin}' ";
            }
            if (!trimin.Equals(string.Empty))
            {
                where += $"\r\n\t AND TRIMINSEQ = '{trimin}' ";
            }
            if (!rst.Equals(string.Empty))
            {
                where += $"\r\n\t AND TOTALRESULT = '{cartype}' ";
            }
            if (!stationid.Equals(string.Empty))
            {
                where += $"\r\n\t AND STATION_ID = '{stationid}' ";
            }


            string qry = string.Format(@"
SELECT TOP {2}  CONVERT(nvarchar,CreateDate,120) 작업시간, PONO, TrimInSeq, VIN, CarType--, TotalResult 'FASTENING FINAL'  
	{0}
FROM     T_Result
WHERE 1=1
{1}	
ORDER BY CreateDate
", cols, where, vari.Search_Max_Row);

            return(sql.Excute_Query(qry, "").Tables[0]);
        }
Example #13
0
 private void UpdateDtNow(object obj)
 {
     form.control.Invoke_Control_Text(lblNowTime, Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));
 }
Example #14
0
        private void print_status_log_write(string header, DataTable dt)
        {
            string filename = string.Format("window_prt_log_{0}.csv", DateTime.Now.ToString("yyyyMM"));


            if (!Function.system.clsFile.FileExists(csv_folder + filename))
            {
                Function.system.clsFile.FileCopy("prt_status.csv", csv_folder + filename);
            }

            DataRow dr = dt.Rows[0];

            Function.Db.OleDB db = new Function.Db.OleDB(Function.Db.OleDB.enProvider.CSV, csv_folder, string.Empty, string.Empty, string.Empty);

            string q = string.Format("select top 1 * from [{0}] ", filename);

            //string v = string.Empty;

            using (DataSet ds = db.dsExcute_Query(q))
            {
                /*db 방식으로 처리 하려 하였으나 길이문제(예상)으로 인해 쿼리 오류..
                 * q = string.Format("insert into [{0}]  ( ", filename);
                 * q = q + "CreateDate, Header";
                 * v = string.Format(" Values ( '{0}', '{1}'", Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime), header);
                 *
                 * foreach (DataColumn c in ds.Tables[0].Columns)
                 * {
                 *      if (c.ColumnName.ToUpper().Equals("CREATEDATE") || c.ColumnName.ToUpper().Equals("HEADER")) continue;
                 *
                 *
                 *      try
                 *      {
                 *              if (Fnc.obj2String(dr[c.ColumnName]) == string.Empty) continue;
                 *
                 *              q = q + string.Format(", {0}", c.ColumnName);
                 *              v = v + string.Format(", '{0}'", dr[c.ColumnName]);
                 *      }
                 *      catch
                 *      {
                 *
                 *      }
                 * }
                 *
                 * q = q + " ) ";
                 * v = v + " ) ";
                 *
                 * db.intExcute_Query(q + v);
                 */
                string str = string.Empty;
                using (FileStream fs = new FileStream(csv_folder + filename, FileMode.Open, FileAccess.Write))
                {
                    fs.Position = fs.Length;

                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        foreach (DataColumn c in ds.Tables[0].Columns)
                        {
                            if (c.ColumnName.ToUpper().Equals("CREATEDATE"))
                            {
                                str = csv_string_get(Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime));
                                continue;
                            }

                            if (c.ColumnName.ToUpper().Equals("HEADER"))
                            {
                                str = str + "," + csv_string_get(header);
                                continue;
                            }


                            try
                            {
                                str = str + string.Format(", {0}", csv_string_get(Fnc.obj2String(dr[c.ColumnName])));
                            }
                            catch
                            {
                                str = str + ",";
                            }
                        }

                        //str = str + "\\r\\n";

                        sw.WriteLine(str);
                        sw.Close();
                    }

                    fs.Close();
                }

                GC.Collect();
            }
        }
Example #15
0
 public override void Timer_1min(object obj)
 {
     Function.form.control.Invoke_Control_Text(lblFormTime,
                                               string.Format("시작: {0}\r\n종료: {1}", Fnc.Date2String(dtFormStart, Fnc.enDateType.DateTime), Fnc.Date2String(DateTime.Now, Fnc.enDateType.DateTime)));
 }
Example #16
0
        private void cmsOldVersion_Click(object obj, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)obj;
            DataRow           dr = dicOldVersion[mi.Name];



            if (Function.clsFunction.ShowMsg("아래 버전으로 DB에 내용을 변경 하시겠습니까?",
                                             string.Format("[FileName]{0} [Version]{1} [UPLOADDATE]{2}", dr["FILENAME"], dr["Version"], Fnc.Date2String((DateTime)dr["UPLOADDATE"], Fnc.enDateType.DateTime))
                                             , frmMessage.enMessageType.YesNo) != DialogResult.Yes)
            {
                return;
            }


            try
            {
                string strMsg = clsDBFunc.FileInfo_Restore_OldVersion(strConn, strUpdateType, UType, Fnc.obj2String(dr["FILENAME"]), Fnc.obj2String(dr["Version"]));
                if (strMsg != string.Empty)
                {
                    SetMessage(true, strMsg, false);
                }
                else
                {
                    SetMessage(false, string.Format("버젼 원복 : [FileName]{0} [Version]{1} [UPLOADDATE]{2}", dr["FILENAME"], dr["Version"], Fnc.Date2String((DateTime)dr["UPLOADDATE"], Fnc.enDateType.DateTime))
                               , false);

                    ListSetFile(OldVersionRow);
                }
            }
            catch (Exception ex)
            {
                ProcException(ex, "tsiOldVersion_DropDownOpening");
            }
        }