Ejemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            int selid = -1;

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if (dataGridView2.Rows[i].Selected == true)
                {
                    selid = int.Parse(dataGridView2.Rows[i].Cells[0].Value.ToString());
                }
            }
            if (selid != -1)
            {
                try
                {
                    exerDetail eed = ell.Find(x => x.qid == selid);
                    eed.score = int.Parse(comboBox5.Text);
                    pp.context.UpdateObject(eed);
                    pp.context.SaveChanges();
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int selid = -1;

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if (dataGridView2.Rows[i].Selected == true)
                {
                    selid = int.Parse(dataGridView2.Rows[i].Cells[0].Value.ToString());
                }
            }
            if (selid != -1)
            {
                exerDetail eed = ell.Find(x => x.qid == selid);
                pp.context.DeleteObject(eed);
                pp.context.SaveChanges();
                reload2(comboBox1.SelectedIndex);
                ////                Update lorder
                int i = 0;
                foreach (exerDetail e1 in ell)
                {
                    i         = i + 1;
                    e1.lorder = i;
                    pp.context.UpdateObject(e1);
                }
                pp.context.SaveChanges();


                ////////
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ///

        public void toexerl(exerL el, List <featurehelp> lfh, List <int> ss)
        {
            foreach (featurehelp fp in lfh)
            {
                exerDetail edl = new exerDetail();
                edl.lid   = el.id;
                edl.qid   = fp.qid;
                edl.score = ss[fp.type1];
                edl.typeq = fp.type1;
                pp.context.AddToexerDetail(edl);
            }
            pp.context.SaveChanges();
        }
Ejemplo n.º 4
0
        private void dataGridView2_SelectionChanged(object sender, EventArgs e)
        {
            int selid = -1;

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if (dataGridView2.Rows[i].Selected == true)
                {
                    selid = int.Parse(dataGridView2.Rows[i].Cells[1].Value.ToString());
                }
            }
            if (selid != -1)
            {
                exerDetail eed = ell.Find(x => x.qid == selid);
                comboBox5.Text = eed.score.ToString();
            }
        }
Ejemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int selid = -1;

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                if (dataGridView2.Rows[i].Selected == true)
                {
                    selid = int.Parse(dataGridView2.Rows[i].Cells[1].Value.ToString());
                }
            }
            if (selid != -1)
            {
                exerDetail eed = ell.Find(x => x.qid == selid);
                context.DeleteObject(eed);
                context.SaveChanges();
                reloadd2(comboBox1.SelectedIndex);
            }
        }
Ejemplo n.º 6
0
        //////////////////////startexerdetail
        private void saveExerD(exerDetail exl)
        {   // context.StudInfo1Set
            // exerDetail etemp = null;
            var q1 = from o in context.exerDetail
                     where o.lid == exl.lid && o.qid == exl.qid && o.typeq == exl.typeq
                     select o;


            if (q1.Count <exerDetail>() == 0)

            {
                context.AddToexerDetail(exl);
                context.SaveChanges();
            }
            else
            {
                MessageBox.Show("该题目已经存在!");
            }
        }
Ejemplo n.º 7
0
        private void copyedetail(exerL s, exerL target)
        {
            var q1 = from o in pp.context.exerDetail
                     where o.lid == s.id
                     select o;

            if (q1.Count <exerDetail>() > 0)
            {
                List <exerDetail> tlerd = q1.ToList <exerDetail>();
                foreach (exerDetail iexd in tlerd)
                {
                    exerDetail new_ed = new exerDetail();
                    new_ed.lid   = target.id;
                    new_ed.score = iexd.score;
                    new_ed.typeq = iexd.typeq;
                    new_ed.qid   = iexd.qid;
                    pp.context.AddToexerDetail(new_ed);
                }

                pp.context.SaveChanges();
            }
        }
Ejemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            int selid = -1;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Selected == true)
                {
                    selid = int.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString());
                }
            }
            if (selid != -1)
            {
                exerDetail edl = new exerDetail();
                edl.lid   = pp.exerl1;
                edl.qid   = selid;
                edl.score = int.Parse(comboBox5.Text);
                edl.typeq = comboBox1.SelectedIndex;
                saveExerD(edl);
                reloadd2(comboBox1.SelectedIndex);
            }
        }
Ejemplo n.º 9
0
        //


        protected void but_Click(object sender, EventArgs e)
        {
            Button        rbl    = (Button)sender;
            int           indexp = int.Parse(rbl.CommandArgument);
            HtmlInputFile tfb    = lfb[indexp];

            HttpPostedFile file = tfb.PostedFile;

            try
            {
                Stream objFile;
                objFile = file.InputStream;
                BinaryReader objReader = new BinaryReader(objFile);
                //读取文件内容
                byte[] byteFile = objReader.ReadBytes((int)objFile.Length);
                if (objFile.Length > 350 * 1024)
                {
                    Response.Write("<script>window.alert('图片文件大于300k了')</script>");
                }

                else
                {
                    if (file.FileName == "" || file.ContentLength == 0)
                    {
                        Response.Write("<script>window.alert('请选择文件')</script>");
                    }
                    else
                    {
                        exerDetail tel            = ell[indexp];
                        var        questionQuery3 = from o in pp.context.studAnsw
                                                    where o.did == tel.id && o.lid == tel.lid && o.stid == st.studentid
                                                    select o;
                        if (questionQuery3.Count <studAnsw>() > 0)
                        {
                            studAnsw tst = questionQuery3.First <studAnsw>();
                            if (tst.answ3 != null)
                            {
                                tst.answ3 = byteFile;
                                pp.context.UpdateObject(tst);

                                pp.context.SaveChanges();


                                Response.AddHeader("Refresh", "0");
                            }
                        }
                        else
                        {
                            studAnsw tst = new studAnsw();
                            tst.did   = tel.id;
                            tst.lid   = tel.lid;
                            tst.stid  = st.studentid;
                            tst.answ3 = byteFile;

                            pp.context.AddTostudAnsw(tst);

                            pp.context.SaveChanges();

                            Response.AddHeader("Refresh", "0");
                        }
                    }
                }



                //文件扩展名
                //string strExtent = file.FileName.Substring(file.FileName.LastIndexOf("."));
            }
            catch (Exception ex)
            {
                // Response.Write(@"<script>window.alert('"+ ex .Message+ @"')</script>");
                System.Threading.Thread.Sleep(3000);
                Response.AddHeader("Refresh", "0");
            }


            //   Response.Write(@"<script>window.alert("+rbl+@")</script>");
        }
Ejemplo n.º 10
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                exerDetail ted = tled[e.RowIndex];

                if (ted.typeq == 0)
                {
                    UPmq mq = null;
                    if (mq == null || mq.IsDisposed)
                    {
                        // pp.showupcc  = 0;
                        mq = new UPmq(pp, ted.qid);
                        // mq.MdiParent = this;
                        mq.Show();
                    }
                    else
                    {
                        mq.Activate();
                        mq.WindowState = FormWindowState.Normal;
                    }
                }

                //////////////////////////////////////////

                if (ted.typeq == 1)
                {
                    UPTF mq = null;
                    if (mq == null || mq.IsDisposed)
                    {
                        // pp.showupcc  = 0;
                        mq = new UPTF(pp, ted.qid);
                        // mq.MdiParent = this;
                        mq.Show();
                    }
                    else
                    {
                        mq.Activate();
                        mq.WindowState = FormWindowState.Normal;
                    }
                }
                ///////////////////////////
                if (ted.typeq == 2)
                {
                    UPE mq = null;
                    if (mq == null || mq.IsDisposed)
                    {
                        // pp.showupcc  = 0;
                        mq = new UPE(pp, ted.qid);
                        // mq.MdiParent = this;
                        mq.Show();
                    }
                    else
                    {
                        mq.Activate();
                        mq.WindowState = FormWindowState.Normal;
                    }
                }
                ///////////////////////////////////////////////////

                if (ted.typeq == 3)
                {
                    UPS mq = null;
                    if (mq == null || mq.IsDisposed)
                    {
                        // pp.showupcc  = 0;
                        mq = new UPS(pp, ted.qid);
                        // mq.MdiParent = this;
                        mq.Show();
                    }
                    else
                    {
                        mq.Activate();
                        mq.WindowState = FormWindowState.Normal;
                    }
                }
                ///////////////////////////////////////////////////

                if (ted.typeq == 4)
                {
                    UPA mq = null;
                    if (mq == null || mq.IsDisposed)
                    {
                        // pp.showupcc  = 0;
                        mq = new UPA(pp, ted.qid);
                        // mq.MdiParent = this;
                        mq.Show();
                    }
                    else
                    {
                        mq.Activate();
                        mq.WindowState = FormWindowState.Normal;
                    }
                }
            }//end col
        }