Beispiel #1
0
 private void 保存_Click(object sender, EventArgs e)
 {
     using (var context = new BruceContext("MasterDb"))
     {
         var            selectItems     = ((Bruce.GuoPan.DataDealWith.Model.C_Ticket)cb_platform.SelectedItem);
         var            gametype_select = ((Bruce.GuoPan.DataDealWith.Model.C_TicketMethodGroup)cb_gametype.SelectedItem);
         var            id     = context.Set <C_TicketMethod>().Max(m => m.ID);
         C_TicketMethod method = new C_TicketMethod
         {
             ID             = id + 1,
             Name           = txtName.Text,
             OutCode        = txtOutCode.Text,
             Memo           = txtMomo.Text,
             MethodGroupID  = gametype_select.ID,
             Order          = 243,
             GroupNum       = 1,
             AddUser        = 1,
             AddTime        = DateTime.Now,
             Enable         = 1,
             LastModifyTime = DateTime.Now,
             LastModifyUser = 1
         };
         int data = context.Set <C_TicketMethod>().Insert(method);
         if (data > 0)
         {
             MessageBox.Show("保存成功");
         }
     }
 }
Beispiel #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            using (var context = new BruceContext("MasterDb"))
            {
                //初始化平台
                var tickets = context.Set <C_Ticket>().ToList();
                var ticket  = tickets.FirstOrDefault();
                cb_platform.DataSource    = tickets;
                cb_platform.ValueMember   = nameof(ticket.ID);
                cb_platform.DisplayMember = nameof(ticket.Name);

                var data = context.Set <V_GameMethod>();
                dg_game.DataSource = data.ToList();
            }
        }
Beispiel #3
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            var selectItems     = ((Bruce.GuoPan.DataDealWith.Model.C_Ticket)cb_platform.SelectedItem);
            var gametype_select = ((Bruce.GuoPan.DataDealWith.Model.C_TicketMethodGroup)cb_gametype.SelectedItem);

            using (var context = new BruceContext("MasterDb"))
            {
                var data = context.Set <V_GameMethod>().Where(m => m.TicketId == selectItems.ID && m.MethodGroupID == gametype_select.ID);
                dg_game.DataSource = data.ToList();
            }
        }
Beispiel #4
0
        private void cb_platform_SelectedIndexChanged(object sender, EventArgs e)
        {
            var selectItems = ((Bruce.GuoPan.DataDealWith.Model.C_Ticket)cb_platform.SelectedItem);

            if (!string.IsNullOrEmpty(selectItems.Name.ToString()))
            {
                var ticketId = selectItems.ID;
                using (var context = new BruceContext("MasterDb"))
                {
                    var groups = context.Set <C_TicketMethodGroup>().Where(m => m.TicketID == ticketId).ToList();
                    if (groups.Count > 0)
                    {
                        var group = groups.FirstOrDefault();
                        cb_gametype.DataSource    = groups;
                        cb_gametype.ValueMember   = nameof(group.ID);
                        cb_gametype.DisplayMember = nameof(group.Name);
                    }
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// 条件删除
 /// </summary>
 /// <param name="whereExpression"></param>
 public void delete(Expression <Func <T, bool> > whereExpression)
 {
     _context.Set <T>().Delete(whereExpression);
 }