/// <summary> /// yyyyMMddHHmmss, yyyyMMdd를 Datetime형식으로 변환 /// </summary> public static DateTime StringToDatetime(string DateTimeString) { DateTime RtnDt = new DateTime(0); libCommon.clsUtil objUtil = new libCommon.clsUtil(); try { if (DateTimeString.Length == 8) { RtnDt = new DateTime( objUtil.ToInt32(DateTimeString.Substring(0, 4)), objUtil.ToInt32(DateTimeString.Substring(4, 2)), objUtil.ToInt32(DateTimeString.Substring(6)) ); } else if (DateTimeString.Length == 14) { RtnDt = new DateTime( objUtil.ToInt32(DateTimeString.Substring(0, 4)), objUtil.ToInt32(DateTimeString.Substring(4, 2)), objUtil.ToInt32(DateTimeString.Substring(6, 2)), objUtil.ToInt32(DateTimeString.Substring(8, 2)), objUtil.ToInt32(DateTimeString.Substring(10, 2)), objUtil.ToInt32(DateTimeString.Substring(12)) ); } } catch (Exception ex) { objUtil.writeLog(ex.Message); } return(RtnDt); }
private int rcvTimeOut; //큐 대기시간 private void Form1_Load(object sender, EventArgs e) { objUtil = new libCommon.clsUtil(); this.objType = new Type[] { typeof(libMyUtil.pageCallingInfo) }; this.qPath = objUtil.getAppCfg("queuePath"); this.qPath_retry = objUtil.getAppCfg("queuePath_retry"); this.encodeType = objUtil.getAppCfg("encodeType").ToUpper(); this.sleep = objUtil.ToInt32(objUtil.getAppCfg("sleep")) * 1000; if (this.sleep == 0) { this.sleep = 1000; } this.MaxCallingFailCnt = objUtil.ToInt32(objUtil.getAppCfg("MaxCallingFailCnt")); if (this.MaxCallingFailCnt == 0) { this.MaxCallingFailCnt = 10; } this.rcvTimeOut = objUtil.ToInt32(objUtil.getAppCfg("rcvTimeout")); if (this.rcvTimeOut == 0) { this.rcvTimeOut = 1; } this.retryInterval = objUtil.ToInt32(objUtil.getAppCfg("retryInterval")) * 1000; if (this.retryInterval == 0) { this.retryInterval = 60 * 1000; } Application.ApplicationExit += new EventHandler(Application_ApplicationExit); MainCallerState.Text = "정지됨"; RetryCallerState.Text = "정지됨"; button1.PerformClick(); }
/// <summary> /// 실패시 FAIL 리턴 /// </summary> public static string getNewID(System.Data.SqlClient.SqlConnection dbCon, System.Data.SqlClient.SqlTransaction TRX, string tbName, string kcol, string Wcols, string Wvals, int len) { StringBuilder strBuilder = new StringBuilder(); DataSet DS = new DataSet(); string Result = "FAIL"; string dKey = "".PadLeft(len, '0'); int i; ArrayList arrWCols = new ArrayList(); ArrayList arrWVals = new ArrayList(); arrWCols.AddRange(objUtil.Split(Wcols, "|")); arrWVals.AddRange(objUtil.Split(Wvals, "|")); strBuilder.Append("SELECT ISNULL(MAX(" + kcol + "), '" + dKey + "') FROM " + tbName); strBuilder.Append(" WHERE 1 = 1"); for (i = 0; i < arrWCols.Count; i++) { if (arrWCols[i].ToString().Length > 0) { strBuilder.Append(" AND "); strBuilder.Append("["); strBuilder.Append(objUtil.ToDb(arrWCols[i].ToString())); strBuilder.Append("]"); strBuilder.Append(" = "); strBuilder.Append("'"); strBuilder.Append(objUtil.ToDb(arrWVals[i].ToString())); strBuilder.Append("'"); } } objUtil.writeLog("GET NEW ID QUERY : " + strBuilder.ToString()); DS = objDB.ExecuteDSQuery(dbCon, TRX, strBuilder.ToString()); if (validateDS(DS)) { Result = (objUtil.ToInt32(DS.Tables[0].Rows[0][0].ToString()) + 1).ToString().PadLeft(len, '0'); } objUtil.writeLog("GET NEW ID : " + Result); return(Result); }