//设置UnFinish信息 public static bool SetUnFinish() { try { ChangeAppConfig.ChangeConfig("UnFinish", UnFinish.ToString()); return(true); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(false); } }
//获取TimeOut信息 public static int GetTimeOut() { try { TimeOut = ChangeAppConfig.getValueFromKey("TimeOut") == null ? 5 : int.Parse(ChangeAppConfig.getValueFromKey("TimeOut")); return(TimeOut); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(5); } }
public static int GetUnFinish() { try { UnFinish = ChangeAppConfig.getValueFromKey("UnFinish") == null ? 20 : int.Parse(ChangeAppConfig.getValueFromKey("UnFinish")); return(UnFinish); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(5); } }
public static void makeExcel2(List <Summary> list, string destFile, out string path) { if (!Directory.Exists(destFile)) { Directory.CreateDirectory(destFile); } destFile = destFile + "\\Summary(" + DateTime.Now.ToString("hh mm ss") + ").xls"; path = destFile; byte[] bytes; if (ChangeAppConfig.getValueFromKey(GlobalData.LANGUAGE).Equals(GlobalData.CHINESE)) { bytes = Resources.Summary; } else { bytes = Resources.Summary_en; } FileStream outputExcelFile = new FileStream(destFile, FileMode.Create, FileAccess.Write); outputExcelFile.Write(bytes, 0, bytes.Length); outputExcelFile.Close(); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + destFile + ";Extended Properties='Excel 8.0;IMEX=10;HDR=YES;'"; //string strConn = "Provider=Microsoft.Ace.OleDb.12.0;Persist Security Info=False;" + "data source=" + @path + ";Extended Prop"; OleDbConnection conn = new OleDbConnection(); conn.ConnectionString = strConn; OleDbCommand cmd = null; try { conn.Open(); //向"Sheet1"表中插入几条数据,访问Excel的表的时候需要在表名后添加"$"符号,Insert语句可以不指定列名 foreach (Summary summary in list) { cmd = new OleDbCommand("Insert Into [Sheet1$] Values('" + summary.callerNum + "', '" + summary.zoneName + "', '" + summary.employeeName + "', '" + summary.employeeNum + "', '" + summary.count + "', '" + summary.total + "','" + summary.percent + "')", conn); //(A,B,C,D,E,F,G) cmd.ExecuteNonQuery(); } } catch (System.Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); } finally { conn.Close(); } }
//获取OrderBy信息 public static OrderBy GetOrederBy() { try { OrderBy orderby = new OrderBy(); orderby.ordertype = ChangeAppConfig.getValueFromKey("orderby") == null ? OrderBy.OrderType.ASC : (OrderBy.OrderType) int.Parse(ChangeAppConfig.getValueFromKey("orderby")); return(orderby); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(null); } }
public static bool SetComInfo() { try { ChangeAppConfig.ChangeConfig("COMID", com.COMID); ChangeAppConfig.ChangeConfig("DataBits", com.DataBits.ToString()); ChangeAppConfig.ChangeConfig("StopBit", com.StopBit.ToString()); ChangeAppConfig.ChangeConfig("BaudRate", com.BaudRate.ToString()); ChangeAppConfig.ChangeConfig("duration", com.duration.ToString()); return(true); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(false); } }
//获取TimeColor信息 public static TimeColor GetTimeColor() { try { TimeColor timecolor = new TimeColor(); timecolor.WaitTime = ChangeAppConfig.getValueFromKey("waittimecolor") == null ? 0 : int.Parse(ChangeAppConfig.getValueFromKey("waittimecolor")); timecolor.TimeOutTime = ChangeAppConfig.getValueFromKey("timeouttimecolor") == null ? 0 : int.Parse(ChangeAppConfig.getValueFromKey("timeouttimecolor")); timecolor.FinishedTime = ChangeAppConfig.getValueFromKey("finishedtimecolor") == null ? 0 : int.Parse(ChangeAppConfig.getValueFromKey("finishedtimecolor")); return(timecolor); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(null); } }
//设置OrdreBy信息 public static bool SetOrdreBy() { try { if (orderby != null) { ChangeAppConfig.ChangeConfig("orderby", ((int)orderby.ordertype).ToString()); } return(true); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(false); } }
//设置TimeColor信息 public static bool SetTimeColor() { try { if (timecolor != null) { ChangeAppConfig.ChangeConfig("waittimecolor", JsonConvert.SerializeObject(timecolor.WaitTime)); ChangeAppConfig.ChangeConfig("timeouttimecolor", JsonConvert.SerializeObject(timecolor.TimeOutTime)); ChangeAppConfig.ChangeConfig("finishedtimecolor", JsonConvert.SerializeObject(timecolor.FinishedTime)); } return(true); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(false); } }
//设置CallBtnSetting信息 public static bool SetCallBtnSetting() { try { if (callbtnsetting != null && callbtnsetting.callBtnSettings != null) { foreach (var set in callbtnsetting.callBtnSettings) { ChangeAppConfig.ChangeConfig(set.Key.ToString().ToUpper(), set.Value); } } return(true); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(false); } }
//获取COM信息 public static COM GetComInfo() { COM com = new COM(); //if (string.IsNullOrWhiteSpace(ChangeAppConfig.getValueFromKey("COMID"])) //{ // var tmp = Common.GetComNum(); // if (tmp != -1) // { // com.COMID = string.Format("COM{0}", tmp); // ChangeAppConfig.ChangeConfig("COMID", com.COMID); // } //} //else // com.COMID = ChangeAppConfig.getValueFromKey("COMID"]; var tmp = Common.GetComNum(); if (tmp != -1) { com.COMID = string.Format("COM{0}", tmp); } if (string.IsNullOrWhiteSpace(ChangeAppConfig.getValueFromKey("DataBits"))) { com.DataBits = 8; ChangeAppConfig.ChangeConfig("DataBits", com.DataBits.ToString()); } else { com.DataBits = int.Parse(ChangeAppConfig.getValueFromKey("DataBits")); } if (string.IsNullOrWhiteSpace(ChangeAppConfig.getValueFromKey("StopBit"))) { com.StopBit = 7; ChangeAppConfig.ChangeConfig("StopBit", com.StopBit.ToString()); } else { com.StopBit = double.Parse(ChangeAppConfig.getValueFromKey("StopBit")); } if (string.IsNullOrWhiteSpace(ChangeAppConfig.getValueFromKey("BaudRate"))) { com.BaudRate = 115200; ChangeAppConfig.ChangeConfig("BaudRate", com.BaudRate.ToString()); } else { com.BaudRate = int.Parse(ChangeAppConfig.getValueFromKey("BaudRate")); } if (string.IsNullOrWhiteSpace(ChangeAppConfig.getValueFromKey("duration"))) { com.duration = 5; ChangeAppConfig.ChangeConfig("duration", com.duration.ToString()); } else { com.duration = int.Parse(ChangeAppConfig.getValueFromKey("duration")); } return(com); }
//获取CallBtnSetting信息 public static CallBtnSetting GetCallBtnSetting() { try { CallBtnSetting set = new CallBtnSetting(); System.Type tmp = typeof(CallBtnSetting.CallBtnType); foreach (var type in Enum.GetNames(tmp)) { if (set.callBtnSettings == null) { set.callBtnSettings = new Dictionary <CallBtnSetting.CallBtnType, string>(); } set.callBtnSettings.Add((CallBtnSetting.CallBtnType)Enum.Parse(typeof(CallBtnSetting.CallBtnType), type), ChangeAppConfig.getValueFromKey(type) == null ? "" : ChangeAppConfig.getValueFromKey(type)); } return(set); } catch (Exception ex) { LogHelper.LibraryLogger.Instance.WriteLog(LogHelper.LibraryLogger.libLogLevel.Error, ex.ToString()); return(null); } }