public List <ResultOptions> getOptions(OleDbConnection db, int id) { DataSet ds = new DataSet(); List <ResultOptions> lstresult = new List <ResultOptions>(); try { OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM (TB_VOTATION_OPTIONS O INNER JOIN TB_VOTATION_GRAPHIC G ON O.VOTATIONID = G.VOTATIONID) INNER JOIN TB_VOTATION V ON V.ID = G.VOTATIONID WHERE V.ID =" + id, db); da.Fill(ds); db.Close(); DataTable dt = ds.Tables[0]; foreach (DataRow rows in dt.Rows) { ResultOptions result = new ResultOptions(); result.title = rows["Title"].ToString(); result.option = rows["ValueOption"].ToString(); result.color = rows["Color"].ToString(); result.graphic = rows["GraphicId"].ToString(); result.imagefondo = rows["ImageG"].ToString(); result.height = int.Parse(rows["Heigth"].ToString()); result.width = int.Parse(rows["Width"].ToString()); result.visible = rows["Visible"].ToString(); lstresult.Add(result); } } catch (Exception) { throw; } return(lstresult); }
//denna metod ska anropas när gissningen låses in //metod som jämför den låsta gisningen mot facit från GameKey public ResultOptions[] Results(Guess guess, GameKey key) { ResultOptions[] results = new ResultOptions[level]; for (int i = 0; i < level; i++) { if (guess.guessRow[i] == key.gameKey[i]) { results[i] = ResultOptions.RightIconRightPlace; } else if (key.gameKey.Contains(guess.guessRow[i])) { results[i] = ResultOptions.RightIconWrongPlace; } else { results[i] = ResultOptions.WrongIcon; } } return(results); }
public void ParseRoll(ResultOptions outcome) { if ((ResultOptions.Advantage & outcome) == ResultOptions.Advantage) { posativeOutcome[0]++; } if ((ResultOptions.TwoAdvantages & outcome) == ResultOptions.TwoAdvantages) { posativeOutcome[0] += 2; } if ((ResultOptions.Success & outcome) == ResultOptions.Success) { posativeOutcome[1]++; } if ((ResultOptions.TwoSuccesses & outcome) == ResultOptions.TwoSuccesses) { posativeOutcome[1] += 2; } if ((ResultOptions.Triumph & outcome) == ResultOptions.Triumph) { posativeOutcome[2]++; } }
public void ParseRoll(ResultOptions result) { if ((ResultOptions.Threat & result) == ResultOptions.Threat) { negativeOutcome[0]++; } if ((ResultOptions.TwoThreat & result) == ResultOptions.TwoThreat) { negativeOutcome[0] += 2; } if ((ResultOptions.Failure & result) == ResultOptions.Failure) { negativeOutcome[1]++; } if ((ResultOptions.TwoFailures & result) == ResultOptions.TwoFailures) { negativeOutcome[1] += 2; } if ((ResultOptions.Despair & result) == ResultOptions.Despair) { negativeOutcome[2]++; } }
public ResultOptions[] submitGuessRow() { //tar in resultatet för gissningsraden genom metoden Results från klassen Guess ResultOptions[] results = guessRows[numberOfGuesses].Results(guessRows[numberOfGuesses], gameKey); //sortera resultaten så att det inte blir för lätt att se vilka färger som var rätt och inte ResultOptions[] temp = new ResultOptions[5]; int filledSpaces = 0; for (int i = 0; i < 5; i++) { if (results[i] == ResultOptions.RightIconRightPlace) { temp[filledSpaces] = results[i]; filledSpaces++; } } for (int j = 0; j < 5; j++) { if (results[j] == ResultOptions.RightIconWrongPlace) { temp[filledSpaces] = results[j]; filledSpaces++; } } for (int k = 0; k < 5; k++) { if (results[k] == ResultOptions.WrongIcon) { temp[filledSpaces] = results[k]; filledSpaces++; } } return(results); }
public DlgPhotoDraw(Waypoint wpt, PhotoDescr photoDescr) { if(photoDescr != null) { // from DlgPhotoFullSize, wpt may be null m_photoDescr = PhotoDescr.FromPhotoDescr(photoDescr); // with null image m_photoDescr.imageDisposable = false; m_photoDescr.ensureOriginalImageExists(); // local will be still invoked if not a gallery } else { // from right-click on a waypoint; wpt must be non-null try { m_photoDescr = PhotoDescr.FromThumbnail(wpt.ThumbSource); m_photoDescr.imageDisposable = false; m_photoDescr.ensureOriginalImageExists(); // local will be still invoked if not a gallery } // An invalid image will throw an OutOfMemoryException // exception catch (OutOfMemoryException) { throw new Exception("Corrupted image file?"); } } originalOrientation = m_photoDescr.Orientation; m_photoDescr.Orientation = 1; // will force display to actual orientation, no adjustment originalBitmap = new Bitmap(m_photoDescr.image); whRatio = (double)originalBitmap.Width / (double)originalBitmap.Height; foreach(PropertyItem item in m_photoDescr.image.PropertyItems) { //string str = "" + item.Type + ": " + item.Id + "=" + item.Value; //LibSys.StatusBar.Trace(str); originalBitmap.SetPropertyItem(item); } m_wpt = wpt; InitializeComponent(); addExifCoordsCheckBox.Enabled = (m_wpt != null); addExifCoordsCheckBox.Checked = m_addExifCoords; this.linkToWptLinkLabel.Enabled = (m_wpt == null || m_wpt.TrackId == -1); this.photoViewerControl = new LibSys.PhotoViewerControl(); this.picturePanel.Controls.AddRange(new System.Windows.Forms.Control[] { this.photoViewerControl}); // // photoViewerControl // this.photoViewerControl.Dock = System.Windows.Forms.DockStyle.Fill; this.photoViewerControl.Name = "photoViewerControl"; //this.photoViewerControl.photoDescr = null; this.photoViewerControl.TabIndex = 1; photoViewerControl.fitToSize = m_fitToSize; fitToSizeCheckBox.Checked = m_fitToSize; this.fitToSizeCheckBox.CheckedChanged += new System.EventHandler(this.fitToSizeCheckBox_CheckedChanged); if(m_wpt != null && m_wpt.TrackId != -1) { timeTptRadioButton.Checked = true; this.timePanel.Enabled = true; } else { timeExifRadioButton.Checked = true; timePanel.Enabled = false; } setTextTextBox(); widthTextBox.Text = "" + originalBitmap.Width; // Y will be set in validation widthTextBox_Validating(null, null); draw(false); if(Project.fitsScreen(m_dlgSizeX, m_dlgSizeY, m_dlgSizeWidth, m_dlgSizeHeight)) { inResize = true; this.Location = new Point(m_dlgSizeX, m_dlgSizeY); this.ClientSize = new System.Drawing.Size(m_dlgSizeWidth, m_dlgSizeHeight); // causes Resize() } // PhotoProperties related: // Create an instance of a ListView column sorter and // assign it to the _listView control. lvwColumnSorter = new ListViewColumnSorter(); this._listView.ListViewItemSorter = lvwColumnSorter; _resultOptions = new ResultOptions(); // end of PhotoProperties related. positionComboBox.SelectedIndex = m_position; this.positionComboBox.SelectedIndexChanged += new System.EventHandler(this.positionComboBox_SelectedIndexChanged); m_fontSize = (int)Math.Round(Math.Max(originalBitmap.Width / 50.0d, m_fontSize)); fontNumericUpDown.Value = Math.Min(m_fontSize, fontNumericUpDown.Maximum); qualityNumericUpDown.Value = Project.photoSaveQuality; this.qualityNumericUpDown.ValueChanged += new System.EventHandler(this.qualityNumericUpDown_ValueChanged); applyTextCheckBox.Checked = true; pickColorButton.BackColor = m_color; pickBgColorButton.BackColor = m_bgColor; this.useBgColorCheckBox.Checked = m_useBgColor; this.Text += " - " + m_photoDescr.imageName; switch(originalOrientation) { // see PhotoDescr.cs for EXIF orientation codes: // case 4: // //thumb.RotateFlip(RotateFlipType.Rotate180FlipNone); // break; case 8: this.rotate270RadioButton.Checked = true; //thumb.RotateFlip(RotateFlipType.Rotate270FlipNone); break; case 6: this.rotate90RadioButton.Checked = true; //thumb.RotateFlip(RotateFlipType.Rotate90FlipNone); break; default: this.rotate0RadioButton.Checked = true; break; } this.saveButton.Enabled = false; this.previewLinkLabel.Enabled = false; Project.setDlgIcon(this); }
protected JsonResult Success(DTOResult result, ResultOptions option, params string[] redirectToUrls) { var ajRes = new AjaxResult(); ajRes.Mode = option.Mode; ajRes.Status = result.IsResult; ajRes.button = Request.GetRequest("button"); if (result.IsResult) { ajRes.Style = AlertStyles.Success; if (option.Mode == StandardActionName.Delete) { /* * ชื่อปุ่มต้องมี Length > 6 และตามด้วย ชื่อGrid เสมอเพื่อนำกลับไป Refresh grid * เช่น buttonGridName จะตัดคำว่า button ทิ้ง * */ ajRes.Message = Translation.CenterLang.Center.DeleteCompleted; if (!option.GridName.IsNullOrEmpty()) { ajRes.button = option.GridName; } else if (ajRes.button.Length > 6) { ajRes.button = ajRes.button.Substring(6, ajRes.button.Length - 6); } } else { ajRes.Message = Translation.CenterLang.Center.SaveCompleted; } if (!option.SuccessMessage.IsNullOrEmpty()) { ajRes.Message = option.SuccessMessage; } if (redirectToUrls != null && redirectToUrls.Count() > 0) { ajRes.RedirectToUrl = new List <string>(); ajRes.RedirectToUrl.AddRange(redirectToUrls); } ajRes.ExistsChioce = option.ExistsChioce; } else { ajRes.Style = AlertStyles.Error; if (option.Mode == StandardActionName.Delete) { ajRes.Message = Translation.CenterLang.Center.DeleteNotComplete; } else { ajRes.Message = Translation.CenterLang.Center.SaveNotComplete; } if (!option.ErrorMessage.IsNullOrEmpty()) { ajRes.Message = option.ErrorMessage; } ajRes.Errors = new List <ValidationError> { new ValidationError(result.ResultCode, result.ResultMsg) }; } return(Json(ajRes)); }