/// <summary> /// Click event for Add button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { TitleDetail findTitle = this.CurrentTitles.Find(r => r._ID == ((TitleDetail)this.lstOptions.SelectedValue)._ID); if (findTitle == null) { this.CurrentTitles.Add(new TitleDetail() { ActionCode = ActionCode.New, CreateTimeStamp = System.DateTime.Now, CreateTimeStampSpecified = true, EditTimeStamp = System.DateTime.Now, Sequence = this.GetNextSequenceNumber(), SequenceSpecified = true, _ID = ((TitleDetail)this.lstOptions.SelectedValue)._ID, Code = ((TitleDetail)this.lstOptions.SelectedValue).Code, Description = ((TitleDetail)this.lstOptions.SelectedValue).Description, _CountyID = ((TitleDetail)this.lstOptions.SelectedValue)._CountyID }); } else { if (findTitle.ActionCode == ActionCode.Delete) { findTitle.ActionCode = ActionCode.None; } } this.UpdateLists(); }
/// <summary> /// Click event for Add All buttons /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddAll_Click(object sender, EventArgs e) { foreach (TitleDetail td in this.AllTitles) { TitleDetail findTitle = this.CurrentTitles.Find(r => r._ID == td._ID); if (findTitle == null) { this.CurrentTitles.Add(new TitleDetail() { ActionCode = ActionCode.New, CreateTimeStamp = System.DateTime.Now, CreateTimeStampSpecified = true, EditTimeStamp = System.DateTime.Now, Sequence = this.GetNextSequenceNumber(), SequenceSpecified = true, _ID = td._ID, Code = td.Code, Description = td.Description, _CountyID = td._CountyID }); } else { if (td._ID == findTitle._ID) { findTitle.ActionCode = findTitle.ActionCode == ActionCode.New ? ActionCode.New : ActionCode.None; } } } this.UpdateLists(); }
public TitleDetail GetTitleById(int id) { using (var ctx = new ApplicationDbContext()) { var entity = ctx.Titles .Single(e => e.Id == id && e.OwnerId == _userId); var newTitle = new TitleDetail { TitleId = entity.Id, TitleName = entity.TitleName, //IsStarred = entity.IsStarred, DateEstablished = entity.DateEstablished, PromotionName = entity.Promotion.PromotionName, WrestlerName = "Vacant", CreatedUtc = entity.CreatedUtc }; if (entity.Wrestler != null) { newTitle.WrestlerName = entity.Wrestler.RingName; } return(newTitle); } }
private CarrierDetailModel GetDetail(CarrierTitleModel carrierTitle, TitleDetail detail) { return(new CarrierDetailModel() { InvNum = detail.invNum, CardNo = detail.cardNo, CardEncrypt = carrierTitle.CardEncrypt, InvDate = $"{Convert.ToInt32(detail.invDate.year) + 1911}/{detail.invDate.month}/{detail.invDate.date}" }); }
//查询题目信息表 数据 public static List <TitleDetail> getTitleResultset(MySqlCommand mySqlCommand) { //MySqlCommand mySqlCommand = getSqlCommand(sqlSearch, mysql); List <TitleDetail> a = new List <TitleDetail>(); MySqlDataReader reader = mySqlCommand.ExecuteReader(); try { while (reader.Read()) { if (reader.HasRows) { TitleDetail a1 = new TitleDetail(); if (reader[0].ToString() != "") { a1.ID1 = reader.GetInt16(0); } if (reader[1].ToString() != "") { a1.TitleID = reader.GetInt16(1); } if (reader[2].ToString() != "") { a1.TestID = reader.GetInt16(2); } if (reader[3].ToString() != "") { a1.TitleAddress = reader.GetString(3); } if (reader[4].ToString() != "") { a1.ErrorRate = reader.GetDouble(4); } if (reader[5].ToString() != "") { a1.AnswerAddress = reader.GetString(5); } a.Add(a1); } } } catch (Exception) { Console.WriteLine("查询失败了!"); } finally { reader.Close(); } return(a); }
/// <summary> /// Event method for when the selection within a listbox changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstDataIndex_SelectedIndexChanged(object sender, EventArgs e) { if (this.lstDataIndex.SelectedItem != null) { string title = this.lstDataIndex.SelectedItem.ToString(); object cachedData = this._currentData[title]; this.flpDataContents.Visible = false; this.flpDataContents.Controls.Clear(); Type selectedType = cachedData.GetType(); if (selectedType == typeof(IndexOptionDetail)) { IndexOptionDetail indexOptionDetail = ((IndexOptionDetail)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new IndexOptionDetailControl() { IndexOptionDetail = indexOptionDetail } }); } else if (selectedType == typeof(CountyInfo)) { CountyInfo countyInfo = ((CountyInfo)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new CountyInfoControl() { CountyInfo = countyInfo }, new PictureBox() { Image = this.GetImageFromCounty(countyInfo), SizeMode = PictureBoxSizeMode.AutoSize } }); } else if (selectedType == typeof(CityDetail)) { CityDetail cityDetail = ((CityDetail)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new CityDetailControl() { CityDetail = cityDetail } }); } else if (selectedType == typeof(ProcessQueueDetail)) { ProcessQueueDetail pqDetail = ((ProcessQueueDetail)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new ProcessQueueDetailControl() { ProcessQueueDetail = pqDetail } }); } else if (selectedType == typeof(TitleDetail)) { TitleDetail titleDetail = ((TitleDetail)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new TitleDetailControl() { TitleDetail = titleDetail } }); } else if (selectedType == typeof(RequestingPartyInfo)) { RequestingPartyInfo rpInfo = ((RequestingPartyInfo)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new RequestingPartyInfoControl() { RequestingPartyInfo = rpInfo } }); } else if (selectedType == typeof(SubmittingPartyInfo)) { SubmittingPartyInfo spInfo = ((SubmittingPartyInfo)cachedData); this.flpDataContents.Controls.AddRange(new Control[] { new SubmittingPartyInfoControl() { SubmittingPartyInfo = spInfo } }); } foreach (Control control in this.flpDataContents.Controls) { control.Width = this.flpDataContents.Width - 10; this.RecursiveReadOnlySet(control); } this.flpDataContents.Visible = true; } }