Exemple #1
0
 /// <summary>
 /// 修改深圳票数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnsz_Click(object sender, EventArgs e)
 {
     try
     {
         using (TMAwardEntities context = new TMAwardEntities())
         {
             int ticketCount = Convert.ToInt32(txtSZ.Text);
             var dt          = (from ent in context.TmpTicket
                                where ent.TicketNO == "深圳"
                                select ent).FirstOrDefault();
             if (dt == null)
             {
                 dt             = new TmpTicket();
                 dt.TicketCount = ticketCount.ToString();
                 dt.TicketNO    = "深圳";
                 context.AddToTmpTicket(dt);
                 context.SaveChanges();
             }
             else
             {
                 dt.TicketCount = ticketCount.ToString();
                 context.SaveChanges();
             }
         }
         loadData();
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + ex.Message + "')</script>");
     }
 }
Exemple #2
0
 public void AddAward(string ticketNO, string level, string remark)
 {
     using (TMAwardEntities context = new TMAwardEntities())
     {
         var item = new TmpAward();
         item.TicketNO   = ticketNO;
         item.Level      = level;
         item.Remark     = remark;
         item.UpdateTime = DateTime.Now;
         context.AddToTmpAward(item);
         context.SaveChanges();
     }
 }
Exemple #3
0
 public void UpdateQuery(int ticketCount, string ticketNO)
 {
     using (TMAwardEntities context = new TMAwardEntities())
     {
         var dt = (from ent in context.TmpTicket
                   where ent.TicketNO == ticketNO
                   select ent).FirstOrDefault();
         if (dt == null)
         {
             dt             = new TmpTicket();
             dt.TicketCount = ticketCount.ToString();
             dt.TicketNO    = ticketNO;
             context.Attach(dt);
             context.SaveChanges();
         }
         else
         {
             dt.TicketCount = ticketCount.ToString();
             context.SaveChanges();
         }
     }
 }
Exemple #4
0
 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();
         }
     }
 }
Exemple #5
0
        //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("清空中奖号码完成!");
        }
Exemple #6
0
 public void AddAwardMany(AwardEntity[] awards)
 {
     using (TMAwardEntities context = new TMAwardEntities())
     {
         foreach (var q in awards)
         {
             var item = new TmpAward();
             item.TicketNO   = q.TicketNO;
             item.Level      = q.Level;
             item.Remark     = q.Remark;
             item.UpdateTime = DateTime.Now;
             context.AddToTmpAward(item);
         }
         context.SaveChanges();
     }
 }