public static bool RefreshLdbQCHStatistics() { try { //LogManager.SetCommonLog("RefreshLdbQCStatistics starting... just today="+ JustTodayStatistics); // generate new statistic List <QCHStatistics> lstNewPS = StatisticsActs.GetHQCStatistics(); if (lstNewPS != null) { // get instanse of ldb LiteDatabase db = new LiteDatabase(ldbConfig.ldbQCStatisticsConnectionString); // get old ldb ps lst LiteCollection <QCHStatistics> dbPS = db.GetCollection <QCHStatistics>("QCHStatistics"); // delete old lst dbPS.Delete(Query.All()); // insetr new lst dbPS.Insert(lstNewPS); //LogManager.SetCommonLog("RefreshLdbQCStatistics insert successfully" + lstNewPS.Count); db.Dispose(); return(true); } else { return(false); } } catch (Exception ex) { LogManager.SetCommonLog("RefreshLdbQCHStatistics_err:" + ex.Message.ToString()); return(false); } }
public static bool RefreshLiveLdbBodyModelProductStatistics(string _Type) { try { //LogManager.SetCommonLog("RefreshLdbProductStatistics_ starting..." ); // generate new statistic List <BodyModelProductStatistics> lstNewPS = StatisticsActs.GetLiveBodyModelProdStatistics(_Type); if ((lstNewPS != null) && (lstNewPS.Count != 0)) { // get instanse of ldb LiteDatabase db = new LiteDatabase(ldbConfig.ldbConnectionString); // get old ldb ps lst LiteCollection <BodyModelProductStatistics> dbPS = db.GetCollection <BodyModelProductStatistics>("BodyModelProductStatistics"); // delete old lst dbPS.Delete(Query.EQ("DateIntervalType", _Type)); // insetr new lst dbPS.Insert(lstNewPS); //LogManager.SetCommonLog("RefreshLdbProductStatistics_ insert successfully" + lstNewPS.Count); db.Dispose(); return(true); } return(false); } catch (Exception ex) { //DBHelper.LogFile(ex); LogManager.SetCommonLog("RefreshLdbBodyModelProductStatistics_" + ex.Message.ToString()); return(false); } }
public List <ProductStatistics> GetDayProdStatistics()//[FromBody] ProductStatistics _ps { try { List <ProductStatistics> ListPS; // --- ListPS = (List <ProductStatistics>)MemoryCacher.GetValue("DayProductStatistics"); if (ListPS == null) { //LogManager.SetCommonLog("api/Statistics/GetDayProdStatistics_request catch Day is null"); ListPS = StatisticsActs.GetLiveProdStatistics("D"); if (ListPS == null) { return(null); // ListPS = StatisticsActs.GetYearProdStatistics("D"); } MemoryCacher.Add("DayProductStatistics", ListPS, DateTimeOffset.Now.AddMinutes(1)); } //else //LogManager.SetCommonLog("api/Statistics/GetDayProdStatistics_request catch DayNot Null,isCount ="+ ListPS.ToString()); // --- return(ListPS); } catch (Exception e) { LogManager.SetCommonLog("api/Statistics/GetDayProdStatistics_request Error=" + e.Message.ToString()); return(null); } }
public static bool RefreshLdbQCStatistics(bool JustTodayStatistics) { try { string strToday = CommonUtility.GetNowDateFaNum(); ldbUpdStatus l = ldbRefresh.GetLdbUpdateStatus(); if ((!JustTodayStatistics) && (l.ArchiveQCStatistics_UDate == strToday)) { return(true); } //LogManager.SetCommonLog("RefreshLdbQCStatistics starting... just today="+ JustTodayStatistics); // generate new statistic List <QCStatistics> lstNewPS = StatisticsActs.GetArchiveQCStatistics(JustTodayStatistics); if (lstNewPS != null) { // get instanse of ldb LiteDatabase db; if (JustTodayStatistics) { db = new LiteDatabase(ldbConfig.ldbQCStatisticsConnectionString); } else { db = new LiteDatabase(ldbConfig.ldbArchiveQCStatisticsConnectionString); } // get old ldb ps lst LiteCollection <QCStatistics> dbPS = db.GetCollection <QCStatistics>("QCStatistics"); // delete old lst dbPS.Delete(Query.All()); // insetr new lst dbPS.Insert(lstNewPS); //LogManager.SetCommonLog("RefreshLdbQCStatistics insert successfully" + lstNewPS.Count); db.Dispose(); if (!JustTodayStatistics) { l.ArchiveQCStatistics_UDate = strToday; bool result = ldbRefresh.SetLdbUpdateStatus(l); } return(true); } else { return(false); } } catch (Exception ex) { LogManager.SetCommonLog("RefreshArchiveLdbQCStatistics_err:" + ex.Message.ToString()); return(false); } }
public static bool RefreshLdbCarStatus() { int i = 0; try { //LogManager.SetCommonLog("RefreshLdbQCStatistics starting... just today="+ JustTodayStatistics); // generate new statistic List <CarStatus> lstNew = StatisticsActs.GetCarStatus(); // get instanse of ldb i = 1; if ((lstNew != null) && (lstNew.Count > 0)) { i = 2; LiteDatabase db; db = new LiteDatabase(ldbConfig.ldbCarStatusConnectionString); // get old ldb ps lst i = 3; LiteCollection <CarStatus> dbPS = db.GetCollection <CarStatus>("CarStatus"); i = 4; // delete old lst if (dbPS.Count() > 0) { i = 5; dbPS.Delete(Query.All()); } i = 6; // insetr new lst dbPS.Insert(lstNew); i = 7; //LogManager.SetCommonLog("RefreshLdbQCStatistics insert successfully" + lstNewPS.Count); db.Dispose(); return(true); } else { return(false); } } catch (Exception ex) { LogManager.SetCommonLog("RefreshLdbCarStatus_err: ->" + i.ToString() + "_" + ex.Message.ToString()); return(false); } }
public static bool RefreshLdbAuditStatisticsMDTrend() { try { string strToday = CommonUtility.GetNowDateFaNum(); ldbUpdStatus l = ldbRefresh.GetLdbUpdateStatus(); //if (l.ArchiveAuditStatisticsMDTrend_UDate == strToday) //{ // return true; //} //LogManager.SetCommonLog("RefreshLdbQCStatistics starting... just today="+ JustTodayStatistics); // generate new statistic List <AuditStatisticsMDTrend> lstNewPS = StatisticsActs.GetArchiveMDTrendAuditStatistics("841,961,962,963"); if (lstNewPS == null) { // get instanse of ldb LiteDatabase db; db = new LiteDatabase(ldbConfig.ldbArchiveAuditStatisticsConnectionString); // get old ldb ps lst LiteCollection <AuditStatisticsMDTrend> dbPS = db.GetCollection <AuditStatisticsMDTrend>("AuditStatisticsMDTrend"); // delete old lst dbPS.Delete(Query.All()); // insetr new lst dbPS.Insert(lstNewPS); //LogManager.SetCommonLog("RefreshLdbQCStatistics insert successfully" + lstNewPS.Count); db.Dispose(); l.ArchiveAuditStatisticsMDTrend_UDate = strToday; bool result = ldbRefresh.SetLdbUpdateStatus(l); } return(true); } catch (Exception ex) { LogManager.SetCommonLog("RefreshLdbAuditStatisticsMDTrend:" + ex.Message.ToString()); return(false); } }
public static bool RefreshArchiveLdbCompanyProductStatistics() { try { string strToday = CommonUtility.GetNowDateFaNum(); ldbUpdStatus l = ldbRefresh.GetLdbUpdateStatus(); if (l.ArchiveCompanyProductStatistics_UDate != strToday) { //LogManager.SetCommonLog("RefreshLdbProductStatistics_ starting..." ); // generate new statistic List <CompanyProductStatistics> lstNewPS = StatisticsActs.GetArchiveCompanyProdStatistics(); // get instanse of ldb LiteDatabase db = new LiteDatabase(ldbConfig.ldbArchiveConnectionString); // get old ldb ps lst LiteCollection <CompanyProductStatistics> dbPS = db.GetCollection <CompanyProductStatistics>("CompanyProductStatistics"); // delete old lst dbPS.Delete(Query.All()); // insetr new lst dbPS.Insert(lstNewPS); //LogManager.SetCommonLog("RefreshLdbCompanyProductStatistics_ insert successfully" + lstNewPS.Count); db.Dispose(); l.ArchiveCompanyProductStatistics_UDate = strToday; bool result = ldbRefresh.SetLdbUpdateStatus(l); return(true); } else { return(true); } } catch (Exception ex) { LogManager.SetCommonLog("RefreshArchiveLdbCompanyProductStatistics" + ex.Message.ToString()); return(false); } }
public static bool RefreshLdbASPQCCASTT(bool JustTodayStatistics) { int trc = 1; try { string strToday = CommonUtility.GetNowDateFaNum(); trc = 2; ldbUpdStatus l = ldbRefresh.GetLdbUpdateStatus(); trc = 3; if ((!JustTodayStatistics) && (l.ArchiveASPQCCASTT == strToday)) { trc = 4; return(true); } trc = 5; List <Qccastt> lstNewPS = StatisticsActs.GetASPQccastt(JustTodayStatistics); if (lstNewPS != null) { trc = 6; // get instanse of ldb LiteDatabase db; trc = 7; if (JustTodayStatistics) { db = new LiteDatabase(ldbConfig.ldbQccasttConnectionString); } else { db = new LiteDatabase(ldbConfig.ldbQCArchiveQccasttConnectionString); } trc = 8; // get old ldb ps lst LiteCollection <Qccastt> dbPS = db.GetCollection <Qccastt>("QCCASTT"); trc = 81; // delete old lst if (dbPS != null) { trc = 82; dbPS.Delete(Query.All()); trc = 83; // insetr new lst dbPS.Insert(lstNewPS); trc = 9; //LogManager.SetCommonLog("RefreshLdbQCStatistics insert successfully" + lstNewPS.Count); db.Dispose(); trc = 10; if (!JustTodayStatistics) { trc = 10; l.ArchiveASPQCCASTT = strToday; bool result = ldbRefresh.SetLdbUpdateStatus(l); trc = 11; } trc = 12; return(true); } else { return(false); } } else { return(false); } } catch (TimeoutException ex) { return(false); } catch (Exception ex) { //if (!ex.Message.Contains("timed out")) LogManager.SetCommonLog(trc.ToString() + "RefreshLdbASPQCCASTT_Err:" + JustTodayStatistics + ex.Message.ToString()); return(false); } }