public int InsertSetting(String configName, String value) { int lastInsertID = 0; using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO user_setting (config_name, `value`) VALUES (@configName, @value) "; command.Parameters.AddWithValue("@configName", configName); command.Parameters.AddWithValue("@value", value); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("user_sett_dao_impl_msg2"), configName, value)); } else { transaction.Commit(); lastInsertID = base.GetLastInsertedID(command); } } return(lastInsertID); }
public override void CreateModel(String mlDataSetsPath) { // Load Data InvokeProcessingStatus(ResourcesUtils.GetMessage("mac_lrn_bldr_log_1")); IDataView trainingDataView = mlContext.Data.LoadFromTextFile <DrawResultWinCountInputModel>( path: @mlDataSetsPath, hasHeader: true, separatorChar: ',', allowQuoting: true, allowSparse: false); // Build training pipeline InvokeProcessingStatus(ResourcesUtils.GetMessage("mac_lrn_bldr_log_2")); IEstimator <ITransformer> trainingPipeline = BuildTrainingPipeline(mlContext); // Train Model InvokeProcessingStatus(ResourcesUtils.GetMessage("mac_lrn_bldr_log_3")); ITransformer mlModel = RetrainModel(mlContext, trainingDataView, trainingPipeline); // Evaluate quality of Model InvokeProcessingStatus(ResourcesUtils.GetMessage("mac_lrn_bldr_log_4")); Evaluate(mlContext, trainingDataView, trainingPipeline, OUTPUT_COLUMN_NAME); // Save model InvokeProcessingStatus("\r\n\r\n\r\n" + ResourcesUtils.GetMessage("mac_lrn_bldr_log_5")); SaveModel(mlContext, mlModel, MODEL_FILE, trainingDataView.Schema); }
public void RemoveOutlet(LotteryOutlet modelToRemove) { if (IsLotteryOutletUsed(modelToRemove.GetOutletCode())) { throw new Exception(ResourcesUtils.GetMessage("lot_dao_impl_msg1")); } using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_outlet SET active = false " + " WHERE ID = @id AND outlet_cd = @outlet_cd " + " AND description = @outlet_desc AND active = true "; command.Parameters.AddWithValue("@id", modelToRemove.GetId()); command.Parameters.AddWithValue("@outlet_cd", modelToRemove.GetOutletCode()); command.Parameters.AddWithValue("@outlet_desc", modelToRemove.GetDescription()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("lot_dao_impl_msg2"), modelToRemove.GetDescription())); } transaction.Commit(); } }
public bool AreParametersValueValid(out string errMessage) { errMessage = ""; try { DateTime dtFromDate = (DateTime)GetFieldParamValue(GeneratorParamType.FROMDATE); DateTime dtToDate = (DateTime)GetFieldParamValue(GeneratorParamType.TODATE); if (!IsDateFromAndToValid(dtFromDate, dtToDate, out errMessage)) { return(false); } String pattern = (String)GetFieldParamValue(GeneratorParamType.PATTERN); if (String.IsNullOrWhiteSpace(pattern)) { errMessage = ResourcesUtils.GetMessage("pick_class_validate_pattern_1"); return(false); } } catch (Exception ex) { errMessage = ex.Message; return(false); } return(true); }
public int InsertAppVersioning(AppVersioning appVersion) { int modified = 0; using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO `app_versioning` " + " (`major`, `minor`, `patch`, `releaseversion`, `remarks`, `datetimeapplied`) " + " VALUES(@major, @minor, @patch, @releaseversion, @remarks, @datetimeapplied); "; command.Connection = conn; command.Parameters.AddWithValue("@major", appVersion.GetMajor()); command.Parameters.AddWithValue("@minor", appVersion.GetMinor()); command.Parameters.AddWithValue("@patch", appVersion.GetPatch()); command.Parameters.AddWithValue("@releaseversion", appVersion.GetReleaseCycle()); command.Parameters.AddWithValue("@remarks", appVersion.GetRemarks()); command.Parameters.AddWithValue("@datetimeapplied", appVersion.GetDateTimeApplied().ToString()); conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(ResourcesUtils.GetMessage("lot_dao_impl_msg14")); } else { transaction.Commit(); modified = base.GetLastInsertedID(command); } } return(modified); }
private void btnSaveModDesc_Click(object sender, EventArgs e) { try { LotteryOutlet outlet = GetSelectedLotteryOutlet(); if (outlet == null) { MessageBox.Show(ResourcesUtils.GetMessage("lot_sett_val_lot_out_msg3")); return; } else if (IsValidateLotteryOutletDescription(txtOutletCodeDesc.Text)) { return; } LotteryOutletSetup setup = new LotteryOutletSetup() { Id = outlet.GetId(), OutletCode = outlet.GetOutletCode(), Description = txtOutletCodeDesc.Text }; this.lotteryDataServices.UpdateLotteryOutletDescription(setup); LoadLotteryOutlet(); FocusItemOnLotteryOutletList(outlet.GetOutletCode()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnLotSchedSave_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show(ResourcesUtils.GetMessage("lott_sched_msg4"), ResourcesUtils.GetMessage("lott_sched_msg3"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.No) { return; } Lottery lottery = (Lottery)cmbLotSchedLotteries.SelectedItem; LotteryScheduleSetup lotSchedNew = (LotteryScheduleSetup)this.lotteryDataServices.GetLotterySchedule(lottery.GetGameMode()); lotSchedNew.Monday = chkbLotSchedMon.Checked; lotSchedNew.Tuesday = chkbLotSchedTue.Checked; lotSchedNew.Wednesday = chkbLotSchedWed.Checked; lotSchedNew.Thursday = chkbLotSchedThurs.Checked; lotSchedNew.Friday = chkbLotSchedFri.Checked; lotSchedNew.Saturday = chkbLotSchedSat.Checked; lotSchedNew.Sunday = chkbLotSchedSun.Checked; this.lotteryDataServices.AddNewLotterySchedule(lotSchedNew); MessageBox.Show(ResourcesUtils.GetMessage("lott_sched_msg2")); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private List <DashboardReportItemSetup> GetLotteriesNextBetDrawDate() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); List <LotteryDrawResult> latestDrawResults = LotteryDataServices.GetLatestDrawResults(); List <Lottery> lotteriesGameList = LotteryDataServices.GetLotteries(); foreach (Lottery lottery in lotteriesGameList) { if (lottery == null) { continue; } LotteryDataServices lotteryDataServicesTMP = new LotteryDataServices(new LotteryDetails(lottery.GetGameMode())); String valueLabel = "drpt_lot_next_drawdate_per_lottery_value"; DateTime nextDrawDate = lotteryDataServicesTMP.GetNextDrawDate(); if (nextDrawDate.Date.CompareTo(DateTime.Now.Date) == 0) { valueLabel += "_today"; } String key = lottery.GetDescription(); String value = ResourcesUtils.GetMessage(valueLabel, DateTimeConverterUtils.ConvertToFormat(nextDrawDate, DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK)); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_next_drawdate_per_lottery_lbl"); itm.ReportItemDecoration.IsHyperLink = true; itm.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; itm.Tag = lottery.GetGameMode(); itemsList.Add(itm); } return(itemsList); }
private void ObjectLstVwLatestBetClipboardCopy() { try { StringBuilder sb = new StringBuilder(); foreach (LotteryBet bet in objectLstVwLatestBet.SelectedObjects) { if (sb.Length > 0) { sb.Append(","); } sb.Append(bet.GetGNUFormat()); } if (sb.Length > 0) { Clipboard.SetDataObject( sb.ToString(), // Text to store in clipboard false, // Do not keep after our application exits 10, // Retry 10 times 200); // 100 ms delay between retries } } catch (Exception ex) { AddProcessingStatusLogs(LOG_STATUS_MODULE_NAME_CLIPBOARD_COPY, ResourcesUtils.GetMessage("mainf_labels_57", ex.Message)); } }
private List <DashboardReportItemSetup> GetLatestDrawResultsPerLotteryGame() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); List <LotteryDrawResult> latestDrawResults = LotteryDataServices.GetLatestDrawResults(); List <Lottery> lotteriesGameList = LotteryDataServices.GetLotteries(); foreach (LotteryDrawResult draw in latestDrawResults) { if (draw == null) { continue; } Lottery lottery = lotteriesGameList.Find((lotteryObj) => (int)lotteryObj.GetGameMode() == draw.GetGameCode()); DateTime today = DateTime.Now; TimeSpan diffWithToday = today - draw.GetDrawDate(); String key = lottery.GetDescription(); String value = ResourcesUtils.GetMessage("drpt_lot_draw_value", DateTimeConverterUtils.ConvertToFormat(draw.GetDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK), ((int)diffWithToday.TotalDays).ToString()); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_draw_group_lbl"); itm.ReportItemDecoration.IsHyperLink = true; itm.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; itm.Tag = lottery.GetGameMode(); itemsList.Add(itm); } return(itemsList); }
private List <DashboardReportItemSetup> GetLatestDrawResultsJackpotPerLotteryGame() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); List <LotteryDrawResult> latestDrawResults = LotteryDataServices.GetLatestDrawResults(); List <Lottery> lotteriesGameList = LotteryDataServices.GetLotteries(); foreach (LotteryDrawResult draw in latestDrawResults) { if (draw == null) { continue; } Lottery lottery = lotteriesGameList.Find((lotteryObj) => (int)lotteryObj.GetGameMode() == draw.GetGameCode()); String valueLabel = "drpt_lot_draw_jackpot_winners_lbl"; if (draw.GetWinnersCount() > 1) { valueLabel += "_plural"; } String key = lottery.GetDescription(); String value = (draw.HasWinners()) ? ResourcesUtils.GetMessage(valueLabel, draw.GetJackpotAmtFormatted(), draw.GetWinnersCount().ToString()) : draw.GetJackpotAmtFormatted(); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_draw_jackpot_lbl"); itm.ReportItemDecoration.IsHyperLink = true; itm.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; itm.Tag = lottery.GetGameMode(); itemsList.Add(itm); } return(itemsList); }
private List <DashboardReportItemSetup> GetLotteryBetsInQueue() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); LotteryDetails lotteryDetails = LotteryDataServices.LotteryDetails; foreach (Lottery lottery in LotteryDataServices.GetLotteries()) { if (lotteryDetails.GameMode != lottery.GetGameMode()) { List <LotteryBet> lotteryBetList = LotteryDataServices.GetLotterybetsQueued(lottery.GetGameMode()); if (lotteryBetList.Count <= 0) { continue; } foreach (LotteryBet bet in lotteryBetList) { String key = DateTimeConverterUtils.ConvertToFormat(bet.GetTargetDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK); String value = bet.GetGNUFormat(); DashboardReportItemSetup dshSetup = GenModel(key, value); dshSetup.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; dshSetup.Tag = lottery.GetGameMode(); dshSetup.GroupTaskLabel = ResourcesUtils.GetMessage("drpt_lot_bet_group_lbl_task"); dshSetup.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_bet_group_lbl", lottery.GetDescription(), lotteryBetList.Count.ToString()); dshSetup.ReportItemDecoration.IsHyperLink = true; itemsList.Add(dshSetup); } } } return(itemsList); }
private void FormSetup() { this.Text = ResourcesUtils.GetMessage("procs_stat_log_frm_msg_1"); this.btnExit.Text = ResourcesUtils.GetMessage("common_btn_exit"); this.btnClear.Text = ResourcesUtils.GetMessage("common_btn_clear"); this.HandleCreated += ProcessingStatusLogFrm_HandleCreated; }
public int InsertSequenceGenerator(LotterySequenceGenerator seqGen) { int modified = 0; using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO `lottery_seq_gen` (`seqgencd`, `description`, `active`) VALUES(@seqgencd, @desc, true); "; command.Connection = conn; command.Parameters.AddWithValue("@seqgencd", seqGen.GetSeqGenCode()); command.Parameters.AddWithValue("@desc", seqGen.GetDescription()); conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(ResourcesUtils.GetMessage("lot_dao_impl_msg13")); } else { transaction.Commit(); modified = base.GetLastInsertedID(command); } } return(modified); }
private bool InputFormDataValidation() { DateTime nextDrawDate = (radioBtnPreferredDate.Checked) ? dtPickPreferredDate.Value : this.lotteryDataServices.GetNextDrawDate(); DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_31")); //RADIO BUTTON if (nextDrawDate.Date.CompareTo(DateTime.Now.Date) < 0) { DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_32")); } DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_33")); if (cmbOutlet.SelectedItem == null || String.IsNullOrWhiteSpace(cmbOutlet.SelectedItem.ToString())) { throw new Exception(ResourcesUtils.GetMessage("abtmlt_form_msg_34")); } DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_35")); if (!radioBtnNextDrawDate.Checked && !radioBtnPreferredDate.Checked) { throw new Exception(ResourcesUtils.GetMessage("abtmlt_form_msg_36")); } if (radioBtnPreferredDate.Checked) { if (!lotterySchedule.IsDrawDateMatchLotterySchedule(dtPickPreferredDate.Value)) { String msg = String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_37"), Environment.NewLine) + String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_38"), dtPickPreferredDate.Value.Date.ToString("MMMM d - dddd"), this.lotterySchedule.DrawDateEvery()); throw new Exception(msg); } } return(true); }
internal async void StartUpdate() { await Task.Run(() => { IsUpdateStarted(true); log(ResourcesUtils.GetMessage("mac_lrn_log_6")); log(ResourcesUtils.GetMessage("mac_lrn_log_11")); foreach (TrainerProcessorAbstract trainer in trainerProcessorAbstractList) { if (IsProcessingStop()) { break; } ; trainer.TrainerProcessorProcessingStatus += Trainer_TrainerProcessorProcessingStatus; //bind trainer.StartUpdate(); trainer.TrainerProcessorProcessingStatus -= Trainer_TrainerProcessorProcessingStatus; //unbind } if (!isUpdateProcessingStarted) { log(ResourcesUtils.GetMessage("mac_lrn_log_14")); } IsUpdateStarted(false); }); }
private void SetupForm() { this.Text = String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_1"), this.lotteryDataServices.LotteryDetails.Description); this.tabPageDelimiters.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_2"); this.tabPageClick.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_3"); this.textBoxInstruction.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_4", lotteryTicketPanel.GetGameDigitCount().ToString(), Environment.NewLine, Environment.NewLine, Environment.NewLine); this.btnAdd.Text = ResourcesUtils.GetMessage("common_btn_save_sequences"); this.btnExit.Text = ResourcesUtils.GetMessage("common_btn_exit"); this.groupDetails.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_5"); this.label3.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_6"); this.label4.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_7"); this.label5.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_8"); this.groupBoxDateSelection.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_9"); this.radioBtnNextDrawDate.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_10"); this.radioBtnPreferredDate.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_11"); this.groupBox1.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_12"); this.label1.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_13"); this.label6.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_14"); this.label2.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_15"); this.linkLblClrSelNum.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_16"); this.groupBoxTicketPanel.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_17"); this.lblCutoffTime.Text = ResourcesUtils.GetMessage("abtmlt_form_msg_44"); this.lblTicketCutoffTimeValue.Text = this.lotteryDataServices.GetTicketCutOffTimeOnly(); }
internal void Init() { Stream mainXmlStream = ResourcesUtils.GetEmbeddedResourceStream(null, "main.xml"); if (mainXmlStream == null) { mainXmlStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes("<Main><Products></Products></Main>")); } Stream configXmlStream = ResourcesUtils.GetEmbeddedResourceStream(null, "config.xml"); if (configXmlStream == null) { #if DEBUG Logger.GetLogger().Error("No resource called config.xml"); #endif } XmlParser.OnXpathProcessing += ParseSessionData; ReadXmlFiles(new Stream[] { mainXmlStream, configXmlStream }); ReadResourcesToXml(); ReadCmdToXml(); ReadConfigSettings(); SetFormDesign(); SetPagesDesign(); }
private void btnLAWPASaveChanges_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show(ResourcesUtils.GetMessage("lott_lwpa_msg3"), ResourcesUtils.GetMessage("lott_lwpa_msg2"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.No) { return; } Lottery lottery = (Lottery)cmbLWPAGameMode.SelectedItem; LotteryWinningCombination originalCombination = this.lotteryDataServices.GetLotteryWinningCombinations(lottery.GetGameMode()); LotteryWinningCombinationSetup lotteryUpdated = (LotteryWinningCombinationSetup)originalCombination.Clone(); lotteryUpdated.Match1 = int.Parse(txtbLWPABet1.Value.ToString()); lotteryUpdated.Match2 = int.Parse(txtbLWPABet2.Value.ToString()); lotteryUpdated.Match3 = int.Parse(txtbLWPABet3.Value.ToString()); lotteryUpdated.Match4 = int.Parse(txtbLWPABet4.Value.ToString()); lotteryUpdated.Match5 = int.Parse(txtbLWPABet5.Value.ToString()); lotteryUpdated.Match6 = int.Parse(txtbLWPABet6.Value.ToString()); this.lotteryDataServices.SaveWinningCombination(lotteryUpdated); MessageBox.Show(ResourcesUtils.GetMessage("lott_lwpa_msg1")); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void InsertDrawDate(LotteryDrawResult lotteryDrawResult) { using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO draw_results (draw_date,jackpot_amt,winners,game_cd,num1,num2,num3,num4,num5,num6) " + " VALUES (@draw_date,@jackpot_amt,@winners,@game_cd,@num1,@num2,@num3,@num4,@num5,@num6)"; command.Parameters.AddWithValue("@draw_date", lotteryDrawResult.GetDrawDate()); command.Parameters.AddWithValue("@jackpot_amt", lotteryDrawResult.GetJackpotAmt()); command.Parameters.AddWithValue("@winners", lotteryDrawResult.GetWinnersCount()); command.Parameters.AddWithValue("@game_cd", lotteryDrawResult.GetGameCode()); command.Parameters.AddWithValue("@num1", lotteryDrawResult.GetNum1()); command.Parameters.AddWithValue("@num2", lotteryDrawResult.GetNum2()); command.Parameters.AddWithValue("@num3", lotteryDrawResult.GetNum3()); command.Parameters.AddWithValue("@num4", lotteryDrawResult.GetNum4()); command.Parameters.AddWithValue("@num5", lotteryDrawResult.GetNum5()); command.Parameters.AddWithValue("@num6", lotteryDrawResult.GetNum6()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(ResourcesUtils.GetMessage("lot_dao_impl_msg9")); } transaction.Commit(); } }
public ManyKeywordsBenchmark() { var keywords = ResourcesUtils.GetKeywords().ToArray(); _treeBaseline = new AhoCorasickTreeBaseline(keywords); _treeImproved = new AhoCorasickTreeImproved(keywords); }
private void ObjectListViewBets_CellEditFinished(object sender, BrightIdeasSoftware.CellEditEventArgs e) { try { if (e.NewValue.ToString() == e.Value.ToString()) { e.Cancel = true; } if (e.Cancel == false) { int newValue = int.Parse(e.NewValue.ToString()); if (!lotteryTicketPanel.IsWithinMinMax(newValue)) { throw new Exception(String.Format(ResourcesUtils.GetMessage("mod_clm_stat_msg_6"), lotteryTicketPanel.GetMin(), lotteryTicketPanel.GetMax())); } ObjectListView lv = (ObjectListView)sender; LotteryBetSetup setup = (LotteryBetSetup)e.RowObject; setup.FillNumberBySeq(e.SubItemIndex - 1, newValue); e.ListViewItem.Tag = MODIFIED_TAG; lv.RefreshObject(e.RowObject); lv.Refresh(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ResourcesUtils.GetMessage("mod_clm_stat_msg_7")); e.Cancel = true; } finally { ColorListViewItemIfModified(e.ListViewItem); } }
private void UpdateFor1008() { //version 1.0.0.8 update AppVersioningSetup appVersion = new AppVersioningSetup() { Major = 1, Minor = 0, Patch = 0, ReleaseVersion = "8", DateTimeApplied = DateTime.Now, Remarks = ResourcesUtils.GetMessage("app_ver_1008_remarks") }; AppVersioning appVersionInDB = AppVersioningDaoObj.GetVersion(appVersion); if (appVersionInDB == null) { RaiseNewEntryEvent(appVersion); LotterySequenceGeneratorSetup genModel = new LotterySequenceGeneratorSetup(); genModel.SeqGenCode = (int)GeneratorType.DRAW_RESULT_WIN_COUNT_PREDICTION_FAST_TREE_REGRESSION; genModel.Description = ResourcesUtils.GetMessage("app_ver_1008_pick_gen_desc"); lotteryDataServicesObj.InsertLotterySequenceGenerator(genModel); AppVersioningDaoObj.InsertAppVersioning(appVersion); } else { RaiseSkippedVersionEvent(appVersion); } }
//fontCacheTextLoading #region public string GetUsedText() { string m_gameString = ""; var textFilePath = "Texts/texts_loading.lang"; textFilePath = ResourcesUtils.GetAssetRealPath(textFilePath); #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_IOS if (DevelopSetting.IsUsePersistent) { textFilePath = textFilePath.Replace("file:///", ""); } else { textFilePath = textFilePath.Replace("file://", ""); } #elif UNITY_ANDROID if (DevelopSetting.IsUsePersistent) { textFilePath = textFilePath.Replace("file:///", ""); } #endif var filelength = 0L; var data = FileUtils.OpenFile(textFilePath, out filelength); if (data != null && filelength != 0L) { string textContents = System.Text.Encoding.UTF8.GetString(data); m_gameString = textContents; } return(m_gameString); }
public static Image LoadImage(string imageName, string decode) { Image res = null; try { Stream imageStream; if (decode.ToLower() == CryptUtils.EncDec.BASE64) { imageStream = CryptUtils.Decode(imageName, decode); } else { imageStream = ResourcesUtils.GetEmbeddedResourceStream(null, imageName); } if (imageStream != null) { res = Image.FromStream(imageStream); } } #if DEBUG catch (Exception e) #else catch (Exception) #endif { #if DEBUG Logger.GetLogger().Error($"error while loading the image {imageName}: {e}"); #endif } return(res); }
private bool IsValidated() { DateTime newDateTime = dtDrawDate.Value.Date; if (!lotterySchedule.IsDrawDateMatchLotterySchedule(newDateTime)) { log(String.Format(ResourcesUtils.GetMessage("mdd_form_validation_msg2"), newDateTime.Date.ToString("dddd"), lotterySchedule.DrawDateEvery())); return(false); } else if (newDateTime.CompareTo(DateTimeConverterUtils.GetYear2011()) < 0) //if earlier { log(ResourcesUtils.GetMessage("mdd_form_validation_msg5")); return(false); } else if (newDateTime.CompareTo(DateTime.Now.Date) == 0) //if the same { if (lotteryDataServices.IsPastTicketSellingCutoffTime()) { DialogResult drPassCutOfftime = MessageBox.Show(ResourcesUtils.GetMessage("mdd_form_validation_msg8"), ResourcesUtils.GetMessage("mdd_form_others_mgs7"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (drPassCutOfftime != DialogResult.OK) { log(ResourcesUtils.GetMessage("mdd_form_validation_msg6")); return(false); } } } return(true); }
static void Drivers() { Console.ForegroundColor = ConsoleColor.Blue; Console.Write("Extracting drivers... "); ResourcesUtils.SaveTo("Drivers.zip", temp); Console.WriteLine("OK."); Console.Write("Unpacking drivers... "); System.IO.Compression.ZipFile.ExtractToDirectory(Path.Combine(temp, "Drivers.zip"), temp); Console.WriteLine("OK."); Console.Write("Executing... "); Process prc = new Process(); prc.StartInfo.Verb = "runas"; prc.StartInfo.FileName = Path.Combine(temp, $"VB Cable/VBCABLE_Setup_x64.exe"); prc.Start(); prc.WaitForExit(); ClearFolder(log: true); Reset(); }
private bool ValidateCutoffTime() { if (this.lotteryDataServices.IsUserToNotifyTicketCutoffIsNear()) { String msg = String.Format(ResourcesUtils.GetMessage("abtmlt_form_msg_39"), this.lotteryDataServices.GetTicketCutOffTimeOnly()); MessageBox.Show(msg, ResourcesUtils.GetMessage("abtmlt_form_msg_20"), MessageBoxButtons.OK); DisplayLog(msg); } //DateTime currentDate = DateTime.Now; DateTime selectedTargetDate = GetUserSelectedDrawDate(); if (preSelectedDrawDateOnLoad.Date.CompareTo(selectedTargetDate.Date) == 0 && this.lotteryDataServices.IsPastTicketSellingCutoffTime()) { String msg = ResourcesUtils.GetMessage("abtmlt_form_msg_40"); DialogResult dr = MessageBox.Show(msg, ResourcesUtils.GetMessage("abtmlt_form_msg_20"), MessageBoxButtons.YesNo); DisplayLog(msg); if (dr == DialogResult.No) { DisplayLog(ResourcesUtils.GetMessage("abtmlt_form_msg_41")); AttemptReloadCurrentSelectedDrawDate(); return(true); } DisplayLog(ResourcesUtils.GetMessage("common_answer_yes")); } return(false); }
public void UpdateDescription(LotteryOutlet updatedModel) { using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_outlet SET description = @description " + " WHERE ID = @id AND outlet_cd = @outlet_cd AND active = true"; command.Parameters.AddWithValue("@description", StringUtils.Truncate(updatedModel.GetDescription(), MAX_LEN_DESCRIPTION)); command.Parameters.AddWithValue("@id", updatedModel.GetId()); command.Parameters.AddWithValue("@outlet_cd", updatedModel.GetOutletCode()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("lot_dao_impl_msg2"), updatedModel.GetDescription())); } transaction.Commit(); } }
public void InsertWinningBet(LotteryWinningBet lotteryWinningBet) { using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO lottery_winning_bet " + " (bet_id, winning_amt, active, claim_status, num1, num2, num3, num4, num5, num6)" + " VALUES (@lotteryBetID, @winningAmt, true, @claimStatus, @num1, @num2, @num3, @num4, @num5, @num6)"; command.Parameters.AddWithValue("@lotteryBetID", lotteryWinningBet.GetLotteryBetId()); command.Parameters.AddWithValue("@winningAmt", lotteryWinningBet.GetWinningAmount()); command.Parameters.AddWithValue("@claimStatus", lotteryWinningBet.IsClaimed()); command.Parameters.AddWithValue("@num1", lotteryWinningBet.GetNum1()); command.Parameters.AddWithValue("@num2", lotteryWinningBet.GetNum2()); command.Parameters.AddWithValue("@num3", lotteryWinningBet.GetNum3()); command.Parameters.AddWithValue("@num4", lotteryWinningBet.GetNum4()); command.Parameters.AddWithValue("@num5", lotteryWinningBet.GetNum5()); command.Parameters.AddWithValue("@num6", lotteryWinningBet.GetNum6()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("lot_dao_impl_msg10"), lotteryWinningBet.GetLotteryBetId())); } transaction.Commit(); } }