Exemple #1
0
        public CStuInfoPage()
        {
            InitializeComponent();
            using (SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=ClassSystem;User ID=sa;Password=root"))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "select * from Stu_info";

                    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                    DataSet        dataset = new DataSet();
                    adapter.Fill(dataset);  //把查询结果填充到dataset
                    DataTable         table = dataset.Tables[0];
                    DataRowCollection rows  = table.Rows;
                    List <StuInfo>    t     = new List <StuInfo>();

                    for (int i = 0; i < rows.Count; i++)
                    {
                        DataRow row       = rows[i];
                        string  Sno       = (string)row["Sno"];
                        string  Sname     = (string)row["Sname"];
                        string  Srole     = (string)row["Srole"];
                        string  Ssex      = (string)row["Ssex"];
                        string  Sbirth    = (string)row["Sbirth"];
                        string  Sidentity = (string)row["Sidentity"];
                        string  Scardnum  = (string)row["Scardnum"];
                        string  Smobile   = (string)row["Smobile"];
                        string  Sdorm     = (string)row["Sdorm"];
                        string  Sqq       = (string)row["Sqq"];
                        StuInfo info      = new StuInfo
                        {
                            Sno       = Sno,
                            Sname     = Sname,
                            Srole     = Srole,
                            Ssex      = Ssex,
                            Sbirth    = Sbirth,
                            Sidentity = Sidentity,
                            Scardnum  = Scardnum,
                            Smobile   = Smobile,
                            Sdorm     = Sdorm,
                            Sqq       = Sqq
                        };
                        t.Add(info);
                    }
                    this.datagrid1.ItemsSource = t;
                }
            }
        }
Exemple #2
0
        private void BTN_SI_Search_Click(object sender, RoutedEventArgs e)
        {
            using (SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=ClassSystem;User ID=sa;Password=root"))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.Parameters.Add(new SqlParameter("@S_SI", TB_SI_Sno.Text));
                    cmd.CommandText = "select * from Stu_info where Sno=@S_SI or Sname=@S_SI";

                    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                    DataSet        dataset = new DataSet();
                    adapter.Fill(dataset);  //把查询结果填充到dataset
                    DataTable         table = dataset.Tables[0];
                    DataRowCollection rows  = table.Rows;
                    List <StuInfo>    t     = new List <StuInfo>();

                    for (int i = 0; i < rows.Count; i++)
                    {
                        DataRow row       = rows[i];
                        string  Sno       = (string)row["Sno"];
                        string  Sname     = (string)row["Sname"];
                        string  Srole     = (string)row["Srole"];
                        string  Ssex      = (string)row["Ssex"];
                        string  Sbirth    = (string)row["Sbirth"];
                        string  Sidentity = (string)row["Sidentity"];
                        string  Scardnum  = (string)row["Scardnum"];
                        string  Smobile   = (string)row["Smobile"];
                        string  Sdorm     = (string)row["Sdorm"];
                        string  Sqq       = (string)row["Sqq"];
                        StuInfo info      = new StuInfo
                        {
                            Sno       = Sno,
                            Sname     = Sname,
                            Srole     = Srole,
                            Ssex      = Ssex,
                            Sbirth    = Sbirth,
                            Sidentity = Sidentity,
                            Scardnum  = Scardnum,
                            Smobile   = Smobile,
                            Sdorm     = Sdorm,
                            Sqq       = Sqq
                        };
                        t.Add(info);
                    }
                    this.datagrid1.ItemsSource = t;
                }
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                SqlHelper helper = new SqlHelper();

                StuInfo u = helper.Find <StuInfo>(2);

                var a = helper.Select <StuInfo>(d => d.Id > 0 && d.Id < 3);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.ReadKey();
        }
Exemple #4
0
        //
        // GET: /UserInfo/

        //public ActionResult Index()
        //{
        //    return View();
        //}
        /// <summary>
        /// 展示学生基本信息
        /// </summary>
        /// <returns>学生信息页面视图</returns>
        public ActionResult Student()
        {
            if (Session["UserType"] != null && Session["UserType"].ToString() == "Student")
            {
                StuInfo s1 = new StuInfo();
                if (Session["UserNum"] != null)
                {
                    s1          = StuInfo.GetStuInfo(Session["UserNum"].ToString());
                    ViewBag.Stu = s1;
                    return(View());
                }
                else
                {
                    return(RedirectToAction("../Home/Login"));
                }
            }
            else
            {
                return(RedirectToAction("../Home/Login"));
            }
        }
Exemple #5
0
        /// <summary>
        /// 选课课程信息展示
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowSelectClassInfo()
        {
            if (Session["UserType"] != null && Session["UserType"].ToString() == "Student")
            {
                if (Session["UserNum"] != null)
                {
                    //学生信息展示
                    StuInfo s1 = new StuInfo();
                    s1          = StuInfo.GetStuInfo(Session["UserNum"].ToString());
                    ViewBag.Stu = s1;

                    //①展示选课课程信息
                    List <CourseInfo> list = null;
                    list = CourseInfo.ShowCourseInfo();

                    //②展示学生已经选好的课程信息
                    List <SelectClassInfo> list2 = null;
                    list2 = SelectClassInfo.GetStuSelectClassInfoByStuNum(Session["UserNum"].ToString());
                    if (list != null && list2 != null)
                    {
                        ViewBag.CourseInfo      = list;  //选课课程信息
                        ViewBag.SelectClassInfo = list2; //学生已选课程信息
                        return(View());
                    }
                    else
                    {
                        return(RedirectToAction("../Home/Error404"));
                    }
                }
                else
                {
                    return(RedirectToAction("../Home/Login"));
                }
            }
            else
            {
                return(RedirectToAction("../Home/Login"));
            }
        }
    /// <summary>
    /// 是否Mysql端注册
    /// </summary>
    /// <returns></returns>
    public IEnumerator isMySqlRegister()
    {
        messagePanel.SetActive(true);
        message.text = "正在获取服务器数据······";
        //当网络不可用时
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            //message.text = "网络不可达,请稍后再试。";
            yield return(StartCoroutine(requestFailed()));

            Debug.Log("网络不可用!");
        }
        else
        {
            KeyValue[] kv = new KeyValue[1];
            kv[0] = new KeyValue("uuid", MemberId);
            UnityWebRequest uw = wsb.PostWithParams(servelets.isStudentExists, kv);
            yield return(uw.Send());

            string jsonData = uw.downloadHandler.text;
            if (!uw.isNetworkError)
            {
                Debug.Log(uw.downloadHandler.text);
                ResponseJson rj = new ResponseJson();

                //ResponseJson rj = JsonConvert.DeserializeObject<ResponseJson>(uw.downloadHandler.text);
                //var v = JsonConvert.DeserializeObject<dynamic>(uw.downloadHandler.text);
                try
                {
                    rj = JsonConvert.DeserializeObject <ResponseJson>(uw.downloadHandler.text);
                    //JObject jsonText = JObject.Parse(uw.downloadHandler.text);
                    // get JSON result objects into a list
                    // rj.stateCode = jsonText["stateCode"].Value<string>();
                    // rj.message = jsonText["result"].Value<bool>().ToString();
                    //List<Newtonsoft.Json.Linq.JToken> listJToken = googleSearch["responseData"]["results"].Children().ToList();
                    //Debug.Log(JsonConvert.SerializeObject(rj));
                    Debug.Log(rj.stateCode);
                    Debug.Log(rj.message);
                    Debug.Log(rj.stuInfo);
                    Debug.Log(rj.result);
                    if (rj.stateCode == WebServicesBase.GetEnumDescription(stateCode.access) && (rj.message == "True" || rj.result == "true"))
                    {
                        Debug.Log("用户存在=====");
                        isReg = true;
                        sin   = rj.stuInfo[0];
                        Debug.Log(sin.no);
                        StartCoroutine(getClassInfo());
                    }
                    else if (rj.stateCode == "409")
                    {
                        messagePanel.SetActive(false);

                        Debug.Log("开始注册协程");

                        //schoolListParent.DetachChildren();
                        clearToggle();
                        selectSchoolFlag = true;
                        if (rj.school != null && rj.school.Length != 0)
                        {
                            foreach (schoolInfo tmpInfo in rj.school)
                            {
                                addSchoolListItem(tmpInfo.name, tmpInfo.code);
                            }
                        }
                        else
                        {
                            addSchoolListItem("西安欧亚学院", "OYXY");
                            addSchoolListItem("西安培华学院", "PHXY");
                        }
                        RegisterPanel.SetActive(true);
                        //StartCoroutine(sendRegisterParams());
                    }
                    else
                    {
                        StartCoroutine(requestFailed());
                    }
                }
                catch (Exception e) {
                    Debug.Log(e.Message);
                    Debug.Log(e.StackTrace);
                    StartCoroutine(requestFailed());
                }
            }
            else
            {
                StartCoroutine(requestFailed());
            }
        }
    }
Exemple #7
0
 public ActionResult Edit(StuInfo stuInfo)
 {
     db.Entry(stuInfo).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("WebForm1"));
 }
Exemple #8
0
        //修改用户
        public ActionResult Edit(int id)
        {
            StuInfo stuInfo = db.StuInfo.Find(id);

            return(View(stuInfo));
        }
Exemple #9
0
 public ActionResult Create(StuInfo StuInfo)
 {
     db.StuInfo.Add(StuInfo);
     db.SaveChanges();
     return(RedirectToAction("WebForm1"));
 }
        /// <summary>
        /// 修改按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Alterbutton_Click(object sender, EventArgs e)
        {
            #region 获取索引和选择的学号
            int    select;
            string stuno;
            if (tabControl1.SelectedTab.Name == "StuPertabPage")
            {
                select = 1;
                stuno  = StuPerdataGridView.CurrentRow.Cells[0].Value.ToString();
            }
            else if (tabControl1.SelectedTab.Name == "StuFamtabPage")
            {
                select = 2;
                stuno  = StuFamdataGridView.CurrentRow.Cells[0].Value.ToString();
            }
            else if (tabControl1.SelectedTab.Name == "StuSchtabPage")
            {
                select = 3;
                stuno  = StuSchdataGridView.CurrentRow.Cells[0].Value.ToString();
            }
            else
            {
                select = 0;
                stuno  = StuAlldataGridView.CurrentRow.Cells[0].Value.ToString();
            }
            #endregion

            // 获取要修改的学生信息并组装
            DataTable stuinfodataTable = stuBaseInfoBLL.Find_AllByStuNoNOVague(stuno);
            StuInfo   stuInfo          = new StuInfo
            {
                StuNo        = stuinfodataTable.Rows[0][0].ToString(),
                StuName      = stuinfodataTable.Rows[0][1].ToString(),
                SchoolType   = stuinfodataTable.Rows[0][2].ToString(),
                Grade        = stuinfodataTable.Rows[0][3].ToString(),
                College      = stuinfodataTable.Rows[0][4].ToString(),
                Profession   = stuinfodataTable.Rows[0][5].ToString(),
                Classes      = stuinfodataTable.Rows[0][6].ToString(),
                DorArea      = stuinfodataTable.Rows[0][7].ToString(),
                DorBuilding  = stuinfodataTable.Rows[0][8].ToString(),
                DorNum       = stuinfodataTable.Rows[0][9].ToString(),
                Sex          = stuinfodataTable.Rows[0][10].ToString(),
                Nation       = stuinfodataTable.Rows[0][11].ToString(),
                Birthday     = stuinfodataTable.Rows[0][12].ToString(),
                Symbol       = stuinfodataTable.Rows[0][13].ToString(),
                TelNum       = stuinfodataTable.Rows[0][14].ToString(),
                QQNum        = stuinfodataTable.Rows[0][15].ToString(),
                IDNum        = stuinfodataTable.Rows[0][16].ToString(),
                OriginPro    = stuinfodataTable.Rows[0][17].ToString(),
                OriginCity   = stuinfodataTable.Rows[0][18].ToString(),
                OriginCounty = stuinfodataTable.Rows[0][19].ToString(),
                HighSchool   = stuinfodataTable.Rows[0][20].ToString(),
                FamilyNum    = stuinfodataTable.Rows[0][21].ToString(),
                HomePro      = stuinfodataTable.Rows[0][22].ToString(),
                HomeCity     = stuinfodataTable.Rows[0][23].ToString(),
                HomeCounty   = stuinfodataTable.Rows[0][24].ToString(),
                HomeOther    = stuinfodataTable.Rows[0][25].ToString(),
                FaName       = stuinfodataTable.Rows[0][26].ToString(),
                FaTelNum     = stuinfodataTable.Rows[0][27].ToString(),
                FaIncome     = stuinfodataTable.Rows[0][28].ToString(),
                MaName       = stuinfodataTable.Rows[0][29].ToString(),
                MaTelNum     = stuinfodataTable.Rows[0][30].ToString(),
                MaIncome     = stuinfodataTable.Rows[0][31].ToString(),
                OutSchool    = stuinfodataTable.Rows[0][32].ToString()
            };
            // new Form
            AlterStuInfoForm alterStuInfoForm = new AlterStuInfoForm(leader, stuInfo, select)
            {
                StartPosition = FormStartPosition.CenterScreen
            };
            alterStuInfoForm.Show();
        }