public static bool SuaKyThiThu(DEMO_COMPETION t)
        {
            bool rt = true;

            using (var httn = new DBTracNghiemDataContext())
            {
                var rs = httn.DEMO_COMPETIONs.Where(s => (s.demoCompID == t.demoCompID && s.subtractID == t.subtractID)).SingleOrDefault();
                if (rs != null)
                {
                    rs.expDate    = t.expDate;
                    rs.gradeid    = t.gradeid;
                    rs.iddemotest = t.iddemotest;
                    try
                    {
                        httn.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        rt = false;
                    }
                }
                else
                {
                    rt = false;
                }
            }
            return(rt);
        }
Ejemplo n.º 2
0
        private void btnCreateDemoCompetition_Click(object sender, EventArgs e)
        {
            DEMO_COMPETION cNew = new DEMO_COMPETION();

            cNew.demoCompID = Convert.ToInt32(txtDemoTestID.Text);
            cNew.subtractID = cbMHDemo.SelectedValue.ToString();
            cNew.expDate    = dtExp.Value;
            cNew.gradeid    = Convert.ToInt32(cbDemoKhoi.SelectedValue);
            cNew.iddemotest = Convert.ToInt32(cbDemoDe.SelectedValue);

            TracNghiem.ThemKyThiThu(cNew);
            OnLoad(e);
        }
Ejemplo n.º 3
0
        private void btnEditDemoCompetition_Click(object sender, EventArgs e)
        {
            int            rowindex = dgvDemoCompetition.CurrentRow.Index;
            int            code     = Convert.ToInt32(dgvDemoCompetition[0, rowindex].Value);
            string         subtract = dgvDemoCompetition[1, rowindex].Value.ToString();
            DEMO_COMPETION cEdit    = new DEMO_COMPETION()
            {
                demoCompID = code,
                subtractID = cbSubtractCom.SelectedValue.ToString(),
                expDate    = dtExp.Value,
                gradeid    = Convert.ToInt32(cbDemoKhoi.SelectedValue),
                iddemotest = Convert.ToInt32(cbDemoDe.SelectedValue),
            };

            TracNghiem.SuaKyThiThu(cEdit);
            OnLoad(e);
        }
        public static bool ThemKyThiThu(DEMO_COMPETION t)
        {
            bool rt = true;

            using (var httn = new DBTracNghiemDataContext())
            {
                httn.DEMO_COMPETIONs.InsertOnSubmit(t);
                try
                {
                    httn.SubmitChanges();
                }
                catch (Exception)
                {
                    rt = false;
                }
            }
            return(rt);
        }