//protected void ButtonBatch_Click(object sender, EventArgs e) //{ // var start = Int32.Parse(this.TextBoxStart.Text.Trim()); // var end = Int32.Parse(this.TextBoxEnd.Text.Trim()); // var dst = new AwardDataSet(); // for (int i = start; i <= end; i++) // { // var item = dst.TmpTicket.NewTmpTicketRow(); // var ticketNO = i.ToString(); // if (ticketNO.Length < 4) ticketNO = ticketNO.PadLeft(4, '0'); // ticketNO = this.RadioButtonList1.SelectedValue +"-"+ ticketNO; // item.TicketNO = ticketNO; // dst.TmpTicket.AddTmpTicketRow(item); // } // DataContext.Update(dst.TmpTicket); //} //protected void ButtonSingle_Click(object sender, EventArgs e) //{ // var ticketNO =this.TextBoxSingle.Text.Trim(); // if (ticketNO.Length <4) ticketNO=ticketNO.PadLeft(4,'0'); // ticketNO = this.RadioButtonList1.SelectedValue + "-" + ticketNO; // var dst = new AwardDataSet(); // var item = dst.TmpTicket.NewTmpTicketRow(); // item.TicketNO = ticketNO; // dst.TmpTicket.AddTmpTicketRow(item); // DataContext.Update(dst.TmpTicket); //} //protected void ButtonClearTicket_Click(object sender, EventArgs e) //{ //} protected void ButtonClearAward_Click(object sender, EventArgs e) { using (TMAwardEntities context = new TMAwardEntities()) { if (context.TmpAward.Count() > 0) { foreach (var item in context.TmpAward) { context.DeleteObject(item); } context.SaveChanges(); } } Response.Write("清空中奖号码完成!"); }
public void DiscardAward(string ticketNO) { using (TMAwardEntities context = new TMAwardEntities()) { var dt = (from ent in context.TmpAward where ent.TicketNO==ticketNO select ent).FirstOrDefault(); if (dt != null) { context.DeleteObject(dt); context.SaveChanges(); } } }