Ejemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            classinfo clin2;
            StudInfo  stin2 = pp.st;

            if (lclinfo != null && comboBox1.SelectedIndex >= 0)
            {
                clin2 = lclinfo[comboBox1.SelectedIndex];
            }
            else
            {
                MessageBox.Show("请选择班级");
                return;
            }

            shiyan mq = null;

            if (mq == null || mq.IsDisposed)
            {
                mq = new shiyan(pp, clin2, stin2);
                mq.Show();
            }
            else
            {
                mq.Activate();
                mq.WindowState = FormWindowState.Normal;
            }
        }
Ejemplo n.º 2
0
 public shiyan(paramst p, classinfo clin1, StudInfo stin1)
 {
     InitializeComponent();
     pp   = p;
     clin = clin1;
     stin = stin1;
 }
Ejemplo n.º 3
0
        public StudentFullInfoDTO GetStudentFullInfo(int NCode)
        {
            using (DataLayer.ServicesDataContextDataContext ctx = new DataLayer.ServicesDataContextDataContext("Data Source=ugtudb.ugtu.net;Initial Catalog=UGTU;Integrated Security=True"))
            {
                // Выбор студента по коду

                StudInfo s = ctx.StudInfos.SingleOrDefault(x => (x.nCode == NCode));

                // Создание  DTO и заполнение его сведениями о студенте
                return(s != null
                    ? new StudentFullInfoDTO()
                {
                    FirstName = s.Cfirstname,
                    LastName = s.Clastname,
                    Patronymic = s.Cotch,
                    Grade = s.Course,
                    DeanFullName = s.ManagerName,
                    FacName = s.Cname_fac,

                    HomePhone = s.ctelefon,
                    MobilePhone = s.cSotTel,
                    Specialty = s.Cname_spec,
                    TeachBasis = s.CType_kat,
                    TeachForm = s.Cname_form_ed,
                    GroupName = s.Cname_grup,
                    DateOut = s.PrikazOtch
                }
                    : null);
            }
        }
Ejemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Global  gb = new Global();
            paramst p  = gb.pp;

            Session.Add("gb", gb);
            var questionQuery = from o in p.context.StudInfo
                                where (o.studentid == TextBox1.Text) && (o.pd == TextBox2.Text)
                                select o;

            // Response.Write("<script>window.alert('your message')</script>");

            try
            {
                StudInfo st = questionQuery.First <StudInfo>();
                Session.Add("user", st);
                Response.Redirect("TaskList");

                // Response.Write(@"<script>window.alert('ok')</script>");
            }
            catch (Exception e1)
            {
                String stre = e1.Message + "(无此账号或密码错误)";


                Response.Write(@"<script>window.alert('" + stre + @"')</script>");
            }
        }
Ejemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            StudInfo studinfo = db.StudInfos.Find(id);

            db.StudInfos.Remove(studinfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public paramst()
        {
            String WCFIPstr = ConfigurationManager.AppSettings["WCFIP"].ToString();

            context = new db_exerciseEntities(new Uri(WCFIPstr));
            // context = new db_exerciseEntities(svcUri);
            st = new StudInfo();
        }
Ejemplo n.º 7
0
        //
        // GET: /Addmarks/Details/5

        public ActionResult Details(int id = 0)
        {
            StudInfo studinfo = db.StudInfos.Find(id);

            if (studinfo == null)
            {
                return(HttpNotFound());
            }
            return(View(studinfo));
        }
Ejemplo n.º 8
0
 public ActionResult Edit(StudInfo studinfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(studinfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "depname", studinfo.DepartmentId);
     return(View(studinfo));
 }
Ejemplo n.º 9
0
        //
        // GET: /Addmarks/Edit/5

        public ActionResult Edit(int id = 0)
        {
            StudInfo studinfo = db.StudInfos.Find(id);

            if (studinfo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "depname", studinfo.DepartmentId);
            return(View(studinfo));
        }
Ejemplo n.º 10
0
        public ActionResult Create(StudInfo studinfo)
        {
            if (ModelState.IsValid)
            {
                db.StudInfos.Add(studinfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "depname", studinfo.DepartmentId);
            return(View(studinfo));
        }
Ejemplo n.º 11
0
    /// <summary>
    /// 新增学生信息
    /// </summary>
    private void addStudentInfo()
    {
        StudInfo studInfo = new StudInfo();

        studInfo.StudNo   = Request.Form["StudNo"];
        studInfo.StudName = Request.Form["StudName"];
        studInfo.StudSex  = Request.Form["StudSex"];
        studInfo.Email    = Request.Form["Email"];

        Sql.StudInfo.Add(studInfo);
        Sql.SaveChanges();
        ResponseJson(new { code = 0, msg = "" });
    }
Ejemplo n.º 12
0
    /// <summary>
    /// 修改学生信息
    /// </summary>
    private void editStudentInfo()
    {
        string   StudNo   = Request.Form["StudNo"];
        StudInfo studInfo = Sql.StudInfo.Find(StudNo);

        if (studInfo == null)
        {
            ResponseJson(new { code = 1, msg = "学生信息不存在" });
        }

        studInfo.StudName = Request.Form["StudName"];
        studInfo.StudSex  = Request.Form["StudSex"];
        studInfo.Email    = Request.Form["Email"];

        Sql.Entry(studInfo).State = System.Data.Entity.EntityState.Modified;
        Sql.SaveChanges();
        ResponseJson(new { code = 0, msg = "" });
    }
Ejemplo n.º 13
0
        ////////////////////////////////////////

        private List <StudInfo> getstudent(classinfo tcinfo)
        {
            List <StudInfo>      lst2    = new List <StudInfo>();
            List <class_student> temp_cs = getclassstudent(tcinfo);

            foreach (class_student cs in temp_cs)
            {
                StudInfo st = null;
                var      q1 = from o in pp.context.StudInfo
                              where o.studentid == cs.studentid
                              select o;
                if (q1.Count <StudInfo>() > 0)
                {
                    st = q1.First <StudInfo>();
                }

                lst2.Add(st);
            }
            return(lst2);
        }
Ejemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (maskedTextBox1.Text == maskedTextBox2.Text && maskedTextBox2.Text.Length < 9 && maskedTextBox2.Text.Length > 3)
            {
                var questionQuery = from o in pp.context.StudInfo
                                    where o.studentid == pp.st.studentid
                                    select o;


                StudInfo st = questionQuery.First <StudInfo>();
                st.pd = maskedTextBox1.Text;
                pp.context.UpdateObject(st);
                pp.context.SaveChanges();
                MessageBox.Show("密码已修改!");
                this.Close();
            }
            else
            {
                MessageBox.Show("两次的密码输入不一样,密码大于八位或小于四位!");
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            expid = Session["expid"] as String;
            Global gb = Session["gb"] as Global;;;

            vce = Session["vce"] as View_class_exp;
            st  = Session["user"] as StudInfo;
            pp  = gb.pp;
            if (expid != null)
            {
                var questionQuery2 = from o in pp.context.exp_q
                                     where (o.idexp == int.Parse(expid))

                                     select o;

                if (questionQuery2.Count <exp_q>() > 0)
                {
                    qew = questionQuery2.First <exp_q>();
                }
                labcontrol();
            }
        }
Ejemplo n.º 16
0
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            gb          = Session["gb"] as Global;;
            st          = Session["user"] as StudInfo;
            stid        = st.studentid;
            Label1.Text = "欢迎:" + stid;
            pp          = gb.pp;

            lcsl    = getcsl(stid);
            lclinfo = getclassinfo(lcsl);

            /*
             * DropDownList1.DataSource= lclinfo;
             * //DropDownList1.DataSourceID   = "classinfo1";
             * DropDownList1.DataTextField = "classinfo1";
             * DropDownList1.DataBind();
             * if (Session["cindex"]as string  != null) DropDownList1.SelectedIndex =int.Parse( Session["cindex"]as string) ;
             * // DropDownList1.SelectedIndex = 1;
             * GridView1.DataSource = ltemp;
             * GridView1.DataBind();
             */
            //////////////////////////////////////////
        }
Ejemplo n.º 17
0
    //您的上下文已配置为从您的应用程序的配置文件(App.config 或 Web.config)
    //使用“Model”连接字符串。默认情况下,此连接字符串针对您的 LocalDb 实例上的
    //“.Model”数据库。
    //
    //如果您想要针对其他数据库和/或数据库提供程序,请在应用程序配置文件中修改“Model”
    //连接字符串。
    public SqlDbContext()
        : base("name=defaultDb")
    {
        if (UserInfo.Count() <= 0)
        {
            UserInfo.Add(new UserInfo
            {
                UserID = "admin", UserName = "******", Password = "******", role = "管理员"
            });
            SaveChanges();
        }

        if (StudInfo.Count() <= 0)
        {
            StudInfo.Add(new StudInfo
            {
                StudNo   = "00001",
                StudName = "张文华",
                StudSex  = "男",
                Email    = "*****@*****.**"
            });
            SaveChanges();
        }
    }
Ejemplo n.º 18
0
        public StudInfo GetStudInfo(string NBook, string NPass)
        {
            StudInfo res = null;

            using (DataLayer.AbitDataContext ctx = new DataLayer.AbitDataContext(conn))
            {
                try
                {
                    int ncode = (int)ctx.Zaches.Where(p => (p.Nn_zach == NBook)).Select(x => x.Student.nCode).Single();

                    DocInfo pass = GetIDDocumentData(ncode);

                    if (pass.Number == NPass)
                    {
                        res = ctx.Students.Where(p => (p.nCode == ncode)).Select(x => new StudInfo() { ID = (int)x.nCode, FullName = x.Person.Clastname + " " + x.Person.Cfirstname + " " + x.Person.Cotch }).First();
                    }
                }
                catch
                {
                    return res;
                }
                return res;
            }
        }
Ejemplo n.º 19
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Global  gb = Session["gb"] as Global;;
            paramst pp = gb.pp;

            StudInfo st = Session["user"] as StudInfo;


            if (TextBox1.Text == TextBox2.Text && TextBox2.Text != "")
            {
                // var questionQuery1 = from o in pp.context.StudInfo
                //                     where o.studentid == st.studentid
                //                  select o;

                st.pd = TextBox1.Text;
                pp.context.UpdateObject(st);
                pp.context.SaveChanges();
                Response.Write("<script>window.alert('修改成功')</script>");
            }
            else
            {
                Response.Write("<script>window.alert('密码不一致')</script>");
            }
        }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ////
            Global gb = Session["gb"] as Global;;;

            pp          = gb.pp;
            Label1.Text = Session["Lexserise"] as String;
            exeriseid   = Session["Lexserise"] as String;
            st          = Session["user"] as StudInfo;

            var questionQuery1 = from o in pp.context.exerDetail
                                 where o.lid == int.Parse(exeriseid) && o.typeq == 3
                                 orderby o.id
                                 select o;

            ell = questionQuery1.ToList <exerDetail>();

            int numm = 0;
            ///////////////////////////////////////////////////////////
            List <extime> ltemp = Session["ltemp"] as List <extime>;
            DateTime      dtnow = DateTime.Now;
            // DateTime stime = new DateTime();
            // DateTime etime = new DateTime();
            //"{ eid = 3164, ename = 20-21绪论, stime = 2020/10/12 0:00:00, etime = 2020/11/6 0:00:00 }
            bool benable = true;

            foreach (extime o in ltemp)
            {
                int lexid = o.eid;
                if (lexid == int.Parse(exeriseid))
                {
                    DateTime stime = (DateTime)o.stime;
                    DateTime etime = (DateTime)o.etime;
                    if (dtnow < stime || dtnow > etime)
                    {
                        benable = false;
                    }
                }
            }
            // if (!benable) Button1.Enabled = false;
            ////////////////////////////////////

            foreach (exerDetail eld in ell)
            {
                var questionQuery2 = from o in pp.context.SQues
                                     where o.id == eld.qid
                                     select o;
                SQues mcq = questionQuery2.First <SQues>();
                System.IO.MemoryStream mstream = new System.IO.MemoryStream(mcq.question, false);
                StreamReader           rt      = new StreamReader(mstream);
                RtfSource rs    = new RtfSource(rt);
                int       no    = numm + 1;
                var       html2 = Rtf.ToHtml(rs);
                //  viewDiv.InnerHtml  = no+"."+html2;
                HtmlGenericControl Div2 = new HtmlGenericControl();
                Div2.ID = "div" + numm;
                HtmlGenericControl Div3 = new HtmlGenericControl();
                Div3.ID = "div" + (numm + 1000);
                HtmlGenericControl Div4 = new HtmlGenericControl();
                Div4.ID = "pdiv" + numm;
                Button rbl = new Button();
                if (!benable)
                {
                    rbl.Enabled = false;
                }
                rbl.Click          += new System.EventHandler(this.but_Click);
                rbl.CommandArgument = numm.ToString();
                HtmlInputFile fbutton = new HtmlInputFile();
                fbutton.Accept = "image/*";
                fbutton.ID     = numm.ToString();
                lfb.Add(fbutton);
                // CommandArgument = "Descending"
                // OnCommand = "CommandBtn_Click"
                rbl.Text = "上传图片";
                rbl.ID   = "rbl" + numm;
                Image Image1            = new Image();
                HtmlGenericControl Div5 = new HtmlGenericControl();
                Div5.InnerHtml = "</br>" + "</br>";
                if (numm % 2 == 0)
                {
                    Div2.Style.Add("lcs", "OVERFLOW: auto; WIDTH: 400px; HEIGHT: 400px;color:blue;font-size:16px");
                }
                else
                {
                    Div2.Style.Add("lcs", "OVERFLOW: auto; WIDTH: 400px; HEIGHT: 400px;color: balck;font-size:16px");
                }

                ///读取答案
                var questionQuery3 = from o in pp.context.studAnsw
                                     where o.did == eld.id && o.lid == eld.lid && o.stid == st.studentid
                                     select o;
                if (questionQuery3.Count <studAnsw>() > 0)
                {
                    if (questionQuery3.First <studAnsw>().answ3 != null)
                    {
                        // bool ics = (bool)questionQuery3.First<studAnsw>().answ2;


                        //
                        //  Image himg = new Image();
                        // byte[] bytes = questionQuery3.First<studAnsw>().answ3;
                        // Response.BinaryWrite(bytes);
                        //  MemoryStream ms = new MemoryStream(bytes);
                        // himg = Image.FromStream(ms, true);
                        //
                        byte[]       bytes   = questionQuery3.First <studAnsw>().answ3;
                        MemoryStream MStream = new MemoryStream(bytes);
                        string       base64  = Convert.ToBase64String(MStream.ToArray());
                        Image1.ImageUrl   = "data:image/png;base64," + base64;
                        Image1.ImageAlign = ImageAlign.Middle;
                        // Image1.Width = 600;
                        Image1.Width = Unit.Percentage(70);
                        Div4.Controls.Add(Image1);
                    }
                }



                ////

                Div3.Controls.Add(fbutton);
                Div3.Controls.Add(rbl);
                Div2.InnerHtml = "</br>" + no + "." + html2 + "</br>";
                numm           = numm + 1;
                //   rrtf.Add(richTextBox1.Rtf);
                viewDiv.Controls.Add(Div2);

                viewDiv.Controls.Add(Div4);
                viewDiv.Controls.Add(Div5);
                viewDiv.Controls.Add(Div3);
                //查询答案

                /*var q2 = from q in pp.context.studAnsw
                 *       where q.lid == eld.lid && q.stid == pp.st.studentid && q.did == eld.id
                 *       select q;
                 * studAnsw answ1 = null;
                 #00FFFF
                 * if (q2.Count<studAnsw>() > 0) { answ1 = q2.First<studAnsw>(); Lmqansw.Add(answ1); }
                 * ell = questionQuery1.ToList<exerDetail>();
                 */
            }
            ////
        }
Ejemplo n.º 21
0
        private void BtnStudentInfo_Click(object sender, RoutedEventArgs e)
        {
            StudInfo studInfo = new StudInfo();

            studInfo.Show();
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // String str= Request.QueryString["r0"];
            // Label1.Text = str;
            List <String> keystrl = new List <string>();
            //Global gb = new Global();
            Global  gb = Session["gb"] as Global;;
            paramst pp = gb.pp;

            exeriseid = Session["Lexserise"] as String;
            st        = Session["user"] as StudInfo;

            var questionQuery1 = from o in pp.context.exerDetail
                                 where o.lid == int.Parse(exeriseid) && o.typeq == 0
                                 orderby o.id
                                 select o;

            ell = questionQuery1.ToList <exerDetail>();
            for (int i = 0; i < ell.Count(); i++)
            {
                String index = "r" + i;
                String str   = Request.QueryString[index];
                keystrl.Add(str);
            }


            int num = 0;

            foreach (exerDetail eld in ell)
            {
                ///更新答案
                var questionQuery3 = from o in pp.context.studAnsw
                                     where o.did == eld.id && o.lid == eld.lid && o.stid == st.studentid
                                     select o;
                if (questionQuery3.Count <studAnsw>() > 0)
                {
                    // if (questionQuery3.First<studAnsw>().answ1 != null)
                    // {
                    int      cs      = -1;
                    studAnsw stanser = questionQuery3.First <studAnsw>();
                    if (keystrl[num] == "A")
                    {
                        cs = 0;
                    }
                    if (keystrl[num] == "B")
                    {
                        cs = 1;
                    }
                    if (keystrl[num] == "C")
                    {
                        cs = 2;
                    }
                    if (keystrl[num] == "D")
                    {
                        cs = 3;
                    }
                    if (cs != -1)
                    {
                        stanser.answ1 = cs;
                    }
                    pp.context.UpdateObject(stanser);

                    //  }
                }
                else
                {
                    if (keystrl[num] != null)
                    {
                        int cs = -1;
                        if (keystrl[num] == "A")
                        {
                            cs = 0;
                        }
                        if (keystrl[num] == "B")
                        {
                            cs = 1;
                        }
                        if (keystrl[num] == "C")
                        {
                            cs = 2;
                        }
                        if (keystrl[num] == "D")
                        {
                            cs = 3;
                        }
                        studAnsw tst = new studAnsw();
                        if (cs != -1)
                        {
                            tst.answ1 = cs;
                        }
                        tst.did  = eld.id;
                        tst.lid  = eld.lid;
                        tst.stid = st.studentid;
                        pp.context.AddTostudAnsw(tst);
                        pp.context.SaveChanges();
                    }
                }
                num++;
            }//endeach
            pp.context.SaveChanges();
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ////
            Global  gb = Session["gb"] as Global;;
            paramst pp = gb.pp;

            Label1.Text = Session["Lexserise"] as String;
            exeriseid   = Session["Lexserise"] as String;
            st          = Session["user"] as StudInfo;
            ///////////////////////////////////////////////////////////
            List <extime> ltemp = Session["ltemp"] as List <extime>;
            DateTime      dtnow = DateTime.Now;
            // DateTime stime = new DateTime();
            // DateTime etime = new DateTime();
            //"{ eid = 3164, ename = 20-21绪论, stime = 2020/10/12 0:00:00, etime = 2020/11/6 0:00:00 }
            bool benable = true;

            foreach (extime o in ltemp)
            {
                int lexid = o.eid;
                if (lexid == int.Parse(exeriseid))
                {
                    DateTime stime = (DateTime)o.stime;
                    DateTime etime = (DateTime)o.etime;
                    if (dtnow < stime || dtnow > etime)
                    {
                        benable = false;
                    }
                }
            }
            if (!benable)
            {
                Button1.Enabled = false;
            }
            ////////////////////////////////////

            var questionQuery1 = from o in pp.context.exerDetail
                                 where o.lid == int.Parse(exeriseid) && o.typeq == 1
                                 orderby o.id
                                 select o;
            List <exerDetail> ell = questionQuery1.ToList <exerDetail>();


            int numm = 0;

            foreach (exerDetail eld in ell)
            {
                var questionQuery2 = from o in pp.context.TFQues
                                     where o.id == eld.qid
                                     select o;
                TFQues mcq = questionQuery2.First <TFQues>();
                System.IO.MemoryStream mstream = new System.IO.MemoryStream(mcq.question, false);
                StreamReader           rt      = new StreamReader(mstream);
                RtfSource rs    = new RtfSource(rt);
                int       no    = numm + 1;
                var       html2 = Rtf.ToHtml(rs);
                //  viewDiv.InnerHtml  = no+"."+html2;
                HtmlGenericControl Div2 = new HtmlGenericControl();
                Div2.ID = "div" + numm;
                HtmlGenericControl Div3 = new HtmlGenericControl();
                Div3.ID = "div" + (numm + 1000);
                RadioButtonList rbl = new RadioButtonList();
                rbl.ID = "rbl" + numm;
                rbl.Items.Add("True");
                rbl.Items.Add("False");

                lrb.Add(rbl);
                if (numm % 2 == 0)
                {
                    Div2.Style.Add("lcs", "OVERFLOW: auto; WIDTH: 400px; HEIGHT: 400px;color:blue;font-size:16px");
                }
                else
                {
                    Div2.Style.Add("lcs", "OVERFLOW: auto; WIDTH: 400px; HEIGHT: 400px;color: balck;font-size:16px");
                }
                rbl.RepeatDirection = RepeatDirection.Horizontal;
                ///读取答案
                var questionQuery3 = from o in pp.context.studAnsw
                                     where o.did == eld.id && o.lid == eld.lid && o.stid == st.studentid
                                     select o;
                if (questionQuery3.Count <studAnsw>() > 0)
                {
                    if (questionQuery3.First <studAnsw>().answ2 != null)
                    {
                        string cs  = "";
                        bool   ics = (bool)questionQuery3.First <studAnsw>().answ2;
                        if (!ics)
                        {
                            cs = "False";
                        }
                        if (ics)
                        {
                            cs = "True";
                        }
                        rbl.SelectedValue = cs;
                    }
                }



                ////


                Div3.Controls.Add(rbl);
                Div2.InnerHtml = no + "." + html2;
                numm           = numm + 1;
                //   rrtf.Add(richTextBox1.Rtf);
                viewDiv.Controls.Add(Div2);
                viewDiv.Controls.Add(Div3);
                //查询答案

                /*var q2 = from q in pp.context.studAnsw
                 *       where q.lid == eld.lid && q.stid == pp.st.studentid && q.did == eld.id
                 *       select q;
                 * studAnsw answ1 = null;
                 #00FFFF
                 * if (q2.Count<studAnsw>() > 0) { answ1 = q2.First<studAnsw>(); Lmqansw.Add(answ1); }
                 * ell = questionQuery1.ToList<exerDetail>();
                 */
            }
            ////
        }