public static StudentInfo getStudentByID(int id) { SqlConnection con = ConnectionHelper.GetConnection(); string sp = "USP_GetStudent_ByID"; SqlCommand cmd = new SqlCommand(sp, con); cmd.Parameters.Add(new SqlParameter("@ID", id)); cmd.CommandType = CommandType.StoredProcedure; try { SqlDataReader _Reader = cmd.ExecuteReader(); _Reader.Read(); StudentInfo _student = new StudentInfo(); _student.StudentID = int.Parse(_Reader["StudentID"].ToString()); _student.FirstName = _Reader["@Firstname"].ToString(); _student.LastName = _Reader["@Lastname"].ToString(); _student.FacultyID = int.Parse(_Reader["@@FacultyID"].ToString()); _student.LocalAddress = _Reader["@Address"].ToString(); _student.CollegeRoll = int.Parse(_Reader["@@CollegeRoll"].ToString()); _student.AccountStatus =Convert.ToBoolean(_Reader["@status"]); _student.BatchID = int.Parse(_Reader["@BatchID"].ToString()); _student.Email = _Reader["@Email"].ToString(); return _student; } catch (Exception ex) { throw ex; } }
public static void EditStudent(StudentInfo _students) { SqlConnection con = ConnectionHelper.GetConnection(); string sp = "USP_Update_Student"; SqlCommand cmd = new SqlCommand(sp, con); cmd.Parameters.Add(new SqlParameter("@studentID", _students.StudentID)); cmd.Parameters.Add(new SqlParameter("@Firstname", _students.FirstName)); cmd.Parameters.Add(new SqlParameter("@Lastname", _students.LastName)); cmd.Parameters.Add(new SqlParameter("@FacultyID", _students.FacultyID)); cmd.Parameters.Add(new SqlParameter("@CollegeRoll", _students.CollegeRoll)); cmd.Parameters.Add(new SqlParameter("@Address",_students.LocalAddress)); cmd.Parameters.Add(new SqlParameter("@ContactNo", _students.ContactNo)); cmd.Parameters.Add(new SqlParameter("@Email", _students.Email)); cmd.Parameters.Add(new SqlParameter("@BatchID", _students.BatchID)); cmd.Parameters.Add(new SqlParameter("@status", _students.AccountStatus)); cmd.CommandType = CommandType.StoredProcedure; try { cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } }
public StudentInfo SelectStudent() { using(var client = new StudentsManagerClient()) { this.currentStudent = client.GetStudent(this.Id); return currentStudent; } }
protected void btConfirm_Click(object sender, EventArgs e) { Admin admin = new Admin(); Search thisSearch = new Search(); StudentInfo thisStudent = new StudentInfo(); // 从界面读取学生信息 thisStudent.StrStudentNO = tbxStuNO.Text;// 读取学号 thisStudent.StrStudentName = tbxStuName.Text;// 姓名 thisStudent.StrIdentityId = tbxIdentityNO.Text;// 身份证号 MD5CryptoServiceProvider HashMD5 = new MD5CryptoServiceProvider();// 设置初始密码 thisStudent.StrPassword = ASCIIEncoding.ASCII.GetString(HashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes("888888"))); string stuNO=this.tbxStuNO.Text;// 获取学号 if (Convert.ToInt32(this.DropDownList1.SelectedValue) == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('请选择班级!')</script>"); return; } ////else if (thisStudent.StrIdentityId == thisSearch.GetStudentByUsername(stuNO).StrIdentityId) // 武剑洁修改,2009-9-11 else if (thisSearch.GetStudentIdByUsername(tbxStuNO.Text) > 0) {// 用户名重复,则禁止添加新用户 Response.Write("<script>alert('用户名重复,该同学已存在!')</script>"); tbxStuNO.Text = "";// 清空输入 return; } else if (thisSearch.GetStudentIdByIdentityID(tbxIdentityNO.Text) > 0) {// 身份证号重复,则禁止添加新用户 Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert","<script>alert('身份证号重复,该同学已经存在!')</script>"); tbxIdentityNO.Text = "";// 清空输入 return; } thisStudent.StrStudentNO=this.tbxStuNO.Text; thisStudent.StrStudentName=this.tbxStuName.Text; thisStudent.StrIdentityId=this.tbxIdentityNO.Text; thisStudent.ClassName = this.DropDownList1.SelectedItem.Text; HashMD5 = new MD5CryptoServiceProvider(); thisStudent.StrPassword = ASCIIEncoding.ASCII.GetString(HashMD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes("888888"))); if (admin.AddStudent(thisStudent)) { //Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", // "<script>alert('添加成功!')</script>"); // 武剑洁修改,添加页面跳转,2009-9-10 Response.Write("<script>alert('添加成功!');window.location='./Student_Manage.aspx'</script>"); } else { //Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", // "<script>alert('添加失败!')</script>"); // 武剑洁修改,添加页面跳转,2009-9-10 Response.Write("<script>alert('添加成功!');window.location='./Student_Manage.aspx'</script>"); } }
static void Main(string[] args) { //Input Console.WriteLine("Enter number of students: "); int n = int.Parse(Console.ReadLine()); StudentInfo[] listOfStudents = new StudentInfo[n]; for (int i = 0; i < n; i++) { StudentInfo oneStudent = new StudentInfo(); Console.Write("First name: "); oneStudent.firstName = Console.ReadLine(); Console.Write("Second name: "); oneStudent.secondName = Console.ReadLine(); Console.WriteLine("Enter age: "); oneStudent.age = byte.Parse(Console.ReadLine()); listOfStudents[i]=oneStudent; } //Query 1 - First name before Last var sortedList = from student in listOfStudents where student.firstName.CompareTo(student.secondName) == -1 select student; Console.WriteLine("These students have such names"); foreach (var student in sortedList) { Console.WriteLine("{0} {1}",student.firstName,student.secondName); } //Query 2 - Of age 18-24 var youngStudents = from student in listOfStudents where student.age >= 18 && student.age <= 24 select student; foreach (var student in youngStudents) { Console.WriteLine("{0} {1} is between 18 and 24 years old",student.firstName,student.secondName); } //Sort with lambda var lamdaSorted = listOfStudents.OrderBy(firstName => firstName.firstName).ThenBy(firstName => firstName.secondName); foreach (var stud in lamdaSorted) { Console.WriteLine("{0} {1} is sorted by first and last name with Lambda exp ",stud.firstName,stud.secondName); } //Sort with linq var linqSorted = from student in listOfStudents orderby student.firstName orderby student.secondName select student; foreach (var stud in lamdaSorted) { Console.WriteLine("{0} {1} is sorted by first and last name with LINQ ", stud.firstName, stud.secondName); } }
public void show_student(StudentInfo si) { lb_mssv.Text = si.Id; lb_ht.Text = si.Name; lb_dc.Text = si.Address; lb_dt.Text = si.Phone; lb_em.Text = si.Email; lb_gt.Text = si.Sex; lb_k.Text = si.Faculty; lb_kh.Text = si.Course; lb_lo.Text = si._Class; lb_ng.Text = si.Major; lb_ns.Text = si.Birthday; }
private void btn_svwshttp_Click(object sender, EventArgs e) { EndpointAddress address = new EndpointAddress("http://localhost:8000/ServiceStudentInfo1"); WSHttpBinding binding = new WSHttpBinding(); IServiceStudentInfo proxy = ChannelFactory<IServiceStudentInfo>.CreateChannel(binding, address); StudentInfo si = new StudentInfo(); si = proxy.GetStudent_info(tb_mssv.Text); if (si != null) show_student(si); }
public void Show_student(StudentInfo si) { Form2 frm = new Form2(); frm.lb_mssv.Text = si.Id; frm.lb_ht.Text = si.Name; frm.lb_dc.Text = si.Address; frm.lb_dt.Text = si.Phone; frm.lb_em.Text = si.Email; frm.lb_gt.Text = si.Sex; frm.lb_k.Text = si.Faculty; frm.lb_kh.Text = si.Course; frm.lb_lo.Text = si._Class; frm.lb_ng.Text = si.Major; frm.lb_ns.Text = si.Birthday; frm.ShowDialog(); }
/// <summary> /// ����Ա���ѧ���û� /// </summary> /// <param name="mStudent">����ӵ�ѧ������</param> /// <returns>����Ƿ�ɹ����ɹ���true,ʧ����false</returns> public bool AddStudent(StudentInfo mStudent) { SqlParameter[] parms = { new SqlParameter("@stuNO",mStudent.StrStudentNO), new SqlParameter("@pwd",mStudent.StrPassword), new SqlParameter("@name",mStudent.StrStudentName), new SqlParameter("@identityID",mStudent.StrIdentityId), new SqlParameter("@className",mStudent.ClassName) }; bool isSuccess = false; int affectedRows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringSTEduSys, CommandType.StoredProcedure, "SP_AddStudent", parms); if (affectedRows > 0) { isSuccess = true; } return isSuccess; }
public void MyCode() { // The FIRST line of code should be BELOW this line StudentInfo sInfo = new StudentInfo(); Student anna = new Student(12, "Anna"); Student betty = new Student(338, "Betty"); Student carl = new Student(92, "Carl"); anna.AddTestResult("English", 85); anna.AddTestResult("Math", 70); anna.AddTestResult("Biology", 90); anna.AddTestResult("French", 52); betty.AddTestResult("English", 77); betty.AddTestResult("Math", 82); betty.AddTestResult("Chemistry", 65); betty.AddTestResult("French", 41); carl.AddTestResult("English", 55); carl.AddTestResult("Math", 48); carl.AddTestResult("Biology", 70); carl.AddTestResult("French", 38); sInfo.AddStudent(anna.GetID(), anna); sInfo.AddStudent(betty.GetID(), betty); sInfo.AddStudent(carl.GetID(), carl); // Does the output match what you expect...? Console.WriteLine(sInfo.GetStudentCount()); Console.WriteLine(sInfo.GetStudent(12).GetName()); Console.WriteLine(sInfo.GetStudent(338).GetName()); Console.WriteLine(sInfo.GetStudent(92).GetName()); Console.WriteLine(sInfo.GetAverageForStudent(12)); Console.WriteLine(sInfo.GetAverageForStudent(338)); Console.WriteLine(sInfo.GetAverageForStudent(92)); Console.WriteLine(sInfo.GetTotalAverage()); // The LAST line of code should be ABOVE this line }
public static void CreateStudent(StudentInfo _Student) { SqlConnection Con = ConnectionHelper.GetConnection(); string Sp = "USP_Create_Student"; SqlCommand cmd = new SqlCommand(Sp, Con); cmd.Parameters.Add(new SqlParameter("@BatchID", _Student.BatchID)); cmd.Parameters.Add(new SqlParameter("@FirstName", _Student.FirstName)); cmd.Parameters.Add(new SqlParameter("@LastName", _Student.LastName)); cmd.Parameters.Add(new SqlParameter("@Address",_Student.LocalAddress)); cmd.Parameters.Add(new SqlParameter("@CollegeRoll", _Student.CollegeRoll)); cmd.Parameters.Add(new SqlParameter("@ContactNo", _Student.ContactNo)); cmd.Parameters.Add(new SqlParameter("@Email", _Student.Email)); cmd.Parameters.Add(new SqlParameter("@status", _Student.AccountStatus)); cmd.CommandType = CommandType.StoredProcedure; try { cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } }
public void GetStudent_info(string id) { try { StudentInfo si = new StudentInfo(); Label[] lb = new Label[11]; if (id == "080889") { si.Id = "080889"; si.Name = "Tấn"; si.Sex = "Nam"; si.Faculty = "KHCN"; si.Major = "CNTT"; si.Training_system = "Cử nhân"; si.Birthday = "14/11/1990"; si._Class = "QL081"; si.Course = "2008"; si.Email = "*****@*****.**"; si.Address = "abc"; si.Phone = "0000"; Callback.Show_student(si); } else { si = null; MessageBox.Show("Không có sinh viên này"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void btConfirm_Click(object sender, EventArgs e) { Admin admin = new Admin(); Search thisSearch = new Search(); StudentInfo thisStudent = new StudentInfo(); string userName =HiddenField1.Value; thisStudent.StrStudentNO = userName; thisStudent.ClassId = Int32.Parse(DropDownList1.SelectedValue); if (admin.EditStudent(thisStudent)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改成功!')</script>"); //程军添加,修改页面跳转,2010-01-07 string ID= this.DropDownList1.Text; Response.Redirect("./Class_View.aspx?ID="+ID); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script>alert('修改失败!')</script>"); } }
protected void Button1_Click(object sender, EventArgs e)//交作业 { //保存答案 int zuoyeid = int.Parse(Request.QueryString["zuoyeid"]); string stuusername = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; DataTable timutable = StudentInfo.GetStuZuoyeTimu(zuoyeid, stuusername); string daan = ""; SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); conn.Open(); SqlTransaction st = conn.BeginTransaction(); comm.Transaction = st; try { foreach (DataRow timurow in timutable.Rows) { switch (timurow[2].ToString().Trim()) { case "单项选择题": daan = ((RadioButtonList)(PlaceHolder1.FindControl("timu" + timurow[0].ToString().Trim()))).SelectedValue; if (daan != "") { comm.CommandText = "update [tb_stuzuoyetimu] set answer='" + daan + "' where [stuzuoyetimuid]=" + (int)(timurow[0]); comm.ExecuteNonQuery(); } break; case "判断题": daan = ((RadioButtonList)(PlaceHolder1.FindControl("timu" + timurow[0].ToString().Trim()))).SelectedValue; if (daan != "") { comm.CommandText = "update [tb_stuzuoyetimu] set answer='" + daan + "' where [stuzuoyetimuid]=" + (int)(timurow[0]); comm.ExecuteNonQuery(); } break; case "多项选择题": daan = ""; CheckBoxList duoxuancbl = (CheckBoxList)(PlaceHolder1.FindControl("timu" + timurow[0].ToString().Trim())); for (int i = 0; i < 5; i++) { if (duoxuancbl.Items[i].Selected) { daan += duoxuancbl.Items[i].Value.Trim(); } } if (daan != "") { comm.CommandText = "update [tb_stuzuoyetimu] set answer='" + daan + "' where [stuzuoyetimuid]=" + (int)(timurow[0]); comm.ExecuteNonQuery(); } break; case "操作题": break; case "填空题": daan = ((TextBox)(PlaceHolder1.FindControl("timu" + timurow[0].ToString().Trim()))).Text.Trim(); if (daan != "") { comm.CommandText = "update [tb_stuzuoyetimu] set answer='" + daan + "' where [stuzuoyetimuid]=" + (int)(timurow[0]); comm.ExecuteNonQuery(); } break; default: daan = ((TextBox)(PlaceHolder1.FindControl("timu" + timurow[0].ToString().Trim()))).Text.Trim(); if (daan != "") { comm.CommandText = "update [tb_stuzuoyetimu] set answer='" + daan + "' where [stuzuoyetimuid]=" + (int)(timurow[0]); comm.ExecuteNonQuery(); } break; } } comm.CommandText = "update [tb_stuzuoyetimu] set defen=fenzhi where studentusername='******' and zuoyeid=" + zuoyeid + " and (answer is not null and answer<>'') and answer=(select answer from tb_tiku where questionid=tb_stuzuoyetimu.questionid)"; comm.ExecuteNonQuery(); comm.CommandText = "update [tb_stuzuoyetimu] set defen=0 where studentusername='******' and zuoyeid=" + zuoyeid + " and (answer is null or answer='' or answer<>(select answer from tb_tiku where questionid=tb_stuzuoyetimu.questionid))"; comm.ExecuteNonQuery(); comm.CommandText = "update [tb_studentzuoye] set shangjiaoriqi='" + DateTime.Now.ToString() + "',zongfen=(select sum(defen) from tb_stuzuoyetimu where zuoyeid=" + zuoyeid + " and studentusername='******') where zuoyeid=" + zuoyeid + " and studentusername='******'"; comm.ExecuteNonQuery(); st.Commit(); FormView1.DataBind(); ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "<script language='javascript'>alert('作业上交成功!');</script>", false); } catch (Exception ex) { st.Rollback(); Label2.Text = ex.Message; ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "<script language='javascript'>alert('作业上交失败!');</script>", false); } finally { conn.Close(); } }
/// <summary> /// 新增Student1筆資料 /// </summary> /// <param name="Student"> /// Student的新資料 /// </param> /// <returns>Boolean</returns> public static bool AddNew(StudentInfo Student) { return(myDB.AddNew(Student)); }
private void ok_simpleButton_Click(object sender, EventArgs e) { if (no_checkEdit.Checked && yes_checkEdit.Checked) { XtraMessageBox.Show("请选择缴费状态", "消息"); no_checkEdit.Checked = true; return; } if (string.IsNullOrEmpty(last_dateEdit.Text.Trim())) { last_dateEdit.DateTime = DateTime.Today; last_dateEdit.Focus(); XtraMessageBox.Show("请选择正确的追缴日期", "消息"); return; } if (XtraMessageBox.Show("确认更改以上信息吗?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } Public.VerificationForm form = new Public.VerificationForm(); form.ShowDialog(); if (!form.Result) { return; } DialogResult = DialogResult.No; _studentInfo = GetWindowsText(_studentInfo); if (StudentInfo.Updata(_studentInfo) <= 0) { XtraMessageBox.Show("修改失败!"); return; } PayRecordInfo pr = new PayRecordInfo() { StudentID = _studentInfo.ID, StudentName = _studentInfo.Name, Tuition = _studentInfo.Tuition, ClassHours = _studentInfo.ClassHours, Remaining = _studentInfo.Remaining, Pay = _studentInfo.Pay, NotPay = _studentInfo.NotPay, Remark = remark_memoEdit.Text, LastDateTime = last_dateEdit.DateTime, OperationID = AccountInfo.AccountSession.ID, OperationPerson = AccountInfo.AccountSession.Person, }; int result = PayRecordInfo.CreateRecord(pr); if (result <= 0) { XtraMessageBox.Show("添加历史修改记录失败", "消息"); return; } XtraMessageBox.Show("更新成功"); Close(); return; }
public static string pointInfo() { int code = 1; string message = "打印成功"; StudentsUser user = HttpContext.Current.Session["user_"] as StudentsUser; List <Nation> listNation = new List <Nation>(); List <ZZMM> listZZMM = new List <ZZMM>(); List <AreaCode_> shiAreaCode = new List <AreaCode_>(); List <KSLB> listKslb = new List <KSLB>(); List <BYLB> listBylb = new List <BYLB>(); List <ZY> listZy = new List <ZY>(); StudentInfo stuInfo = new StudentInfo(); Wish wish = new Wish(); Nation nation_ = new Nation(); AreaCode_ areaCode, areaShiCode = new AreaCode_(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AfficheBLL bll = new AfficheBLL()) { shiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { stuInfo = bll.getEntity(user.Sfzh); //if (stuInfo.PicPath.Trim().Length != null) //{ // HttpContext.Current.Session["PicPath_"] =stuInfo.PicPath; //} } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } Document doc = new Document(System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "//templet.doc"); foreach (Bookmark item in doc.Range.Bookmarks) { if (item != null) { switch (item.Name) { case "SignUpNum": item.Text = user.SignUpNum; break; case "Sfzh_1": case "Sfzh_2": case "Sfzh_3": case "Sfzh_4": case "Sfzh_5": case "Sfzh_6": case "Sfzh_7": case "Sfzh_8": case "Sfzh_9": case "Sfzh_10": case "Sfzh_11": case "Sfzh_12": case "Sfzh_13": case "Sfzh_14": case "Sfzh_15": case "Sfzh_16": case "Sfzh_17": case "Sfzh_18": item.Text = user.Sfzh.Substring(int.Parse(item.Name.Substring(5)) - 1, 1); break; case "Zkzh_1": case "Zkzh_2": case "Zkzh_3": case "Zkzh_4": case "Zkzh_5": case "Zkzh_6": case "Zkzh_7": case "Zkzh_8": case "Zkzh_9": case "Zkzh_10": case "Zkzh_11": case "Zkzh_12": case "Zkzh_13": case "Zkzh_14": item.Text = user.Zkzh.Substring(int.Parse(item.Name.Substring(5)) - 1, 1); break; case "PicPath": DocumentBuilder builder = new DocumentBuilder(doc); string imgPath = System.Web.HttpContext.Current.Server.MapPath("~/uploads") + "\\" + user.Sfzh + ".jpg"; if (File.Exists(imgPath)) { builder.MoveToBookmark("PicPath"); builder.InsertImage(imgPath, RelativeHorizontalPosition.Margin, 1, RelativeVerticalPosition.Margin, 1, 80, 100, WrapType.Square); } break; case "StuName": item.Text = user.StuName; break; ///Tel case "Tel": item.Text = stuInfo.Tel; break; ///Txdz case "Txdz": item.Text = stuInfo.Txdz; break; ///Xb case "Xb": item.Text = (stuInfo.Xb == 0 ? "女" : "男"); break; ///Yzbm case "Yzbm": item.Text = stuInfo.Yzbm; break; ///AcceptPeople case "AcceptPeople": item.Text = stuInfo.AcceptPeople; break; ///Byyx case "Byyx": item.Text = stuInfo.Byyx; break; ///Csrq case "Csrq": item.Text = stuInfo.Csrq.ToString("yyyy-MM-dd"); break; ///Health case "Health": if (stuInfo.Health == 0) { item.Text = "好"; } else if (stuInfo.Health == 1) { item.Text = "一般"; } else if (stuInfo.Health == 2) { item.Text = "比较好"; } else if (stuInfo.Health == 3) { item.Text = "差"; } break; ///IsAdjust case "IsAdjust": item.Text = (wish.IsAdjust == 0 ? "否" : "是"); break; ///LikeSpecial case "LikeSpecial": item.Text = stuInfo.LikeSpecial; break; ///Mobile case "Mobile": item.Text = stuInfo.Mobile; break; ///Nation case "Nation": using (NationBLL bll = new NationBLL()) { nation_ = bll.getNationName(stuInfo.Nation); } item.Text = nation_.NationName.ToString(); break; ///AreaCode case "AreaCode": using (AreaCodeBLL bll = new AreaCodeBLL()) { areaCode = bll.getAreaName(stuInfo.AreaCode.Substring(0, 4)); areaShiCode = bll.getAreaName(stuInfo.AreaCode); } item.Text = areaCode.AreaName.ToString() + areaShiCode.AreaName.ToString(); break; ///ZZMM case "ZZMM": //var answerZzmm = (from p in listZZMM // where p.ZzmmDm == stuInfo.ZZMM // select p).Single(); using (ZZMMBLL bll = new ZZMMBLL()) { item.Text = bll.getZZMMByZzmmDm(stuInfo.ZZMM).ZzmmMc; } break; ///BYLB case "BYLB": var answerBylb = (from p in listBylb where p.BylbDm == stuInfo.BYLB select p).Single(); item.Text = answerBylb.BylbMc.ToString(); break; ///KSLB case "KSLB": var answerKslb = (from p in listKslb where p.KslbDm == stuInfo.KSLB select p).Single(); item.Text = answerKslb.KslbMc.ToString(); break; case "FrsZY": var answerFrszy = (from p in listZy where p.ZYDM == wish.FrsZY.Trim() select p); string stringFrsZY = string.Empty; foreach (var item1 in answerFrszy) { stringFrsZY = item1.ZYMC; } item.Text = stringFrsZY.ToString(); break; ///SecZY case "SecZY": var answerSeczy = (from pp in listZy where pp.ZYDM == wish.SecZY.Trim() select pp); string stringSecZY = string.Empty; foreach (var item2 in answerSeczy) { stringSecZY = item2.ZYMC; } item.Text = stringSecZY.ToString(); break; } } } doc.Save("d:\\abc.pdf", SaveFormat.Pdf); } return(JsonConvert.SerializeObject(new { code = code, message = message })); }
/// <summary> /// �״�-ȫ��6��(F1) /// �״�-��������ʻ��ѵ��¼*3(F2)(���) /// �״�-��������ʻ����������֤��(F3)(���������) /// �״�-��������ʻԱ��ѵѧԱ�ǼDZ�(F4)(���) /// �״�-������ѧϰ��ʻԱ�ǼDZ�(F5) /// �״�-��Ŀ�����Գɼ���(F6)(���) /// �״�-��������ʻ�˵���(F7)(����A4,������) /// </summary> /// <param name="student"></param> public BaseStudentPrinter(StudentInfo student) { this.student = student; }
private Student MapStudentInfoToStudent(StudentInfo studentInfo) { return(Mapper.Map <StudentInfo, Student>(studentInfo)); }
public void LoadLayout(LayoutProperties prop, StudentInfo student, List <string> disciplineLabels, bool isSkipEmplyLines = false, bool isAssessmentsOnLastLine = false) { using (new WaitCursor()) { if (prop != null) { var mediaOffset = prop.OffsetInPixel; ClearLayout(); ImageBackground.Stretch = Stretch.Fill; ImageBackground.Source = LayoutFileReader.ByteToImageSource(prop.BackgroundImage); Canvas.SetLeft(ImageBackground, mediaOffset.X); Canvas.SetTop(ImageBackground, mediaOffset.Y); // Add labels without data binding. foreach (var ci in prop.m_CaptionInfo.Where(t => Helper.IsNoneBinding(t.XlsColumn)).AsParallel()) { AddSpanElement(ci.CaptionText, ci, mediaOffset); } // Add labels with data binding. foreach (var column in XLSColumnBinding.GetXLSColums(prop.LayoutType).AsParallel()) { if (Helper.IsNoneBinding(column)) { continue; } foreach (var caption in prop.m_CaptionInfo.Where(t => t.XlsColumn == column)) { AddSpanElement(student.GetValue(column), caption, mediaOffset); } } // Add tables. var m_TableDataSet = new TableDataSet(disciplineLabels, student.Assessments, isSkipEmplyLines, isAssessmentsOnLastLine); var seek = 0; foreach (var tbl in prop.m_Table.OrderBy(t => t.Left + t.Top).AsParallel()) { AddTableElement(tbl, m_TableDataSet.Range(seek, tbl.RowCount), mediaOffset); seek += tbl.RowCount; } //foreach (var tbl in prop.m_Table.Where(t => t.XlsColumn == "Оценки слева").OrderBy(t => t.Top).AsParallel()) // seek = AddTableElement(tbl, m_TableDataSet, seek, mediaOffset); //foreach (var tbl in prop.m_Table.Where(t => t.XlsColumn == "Оценки справа").OrderBy(t => t.Top).AsParallel()) // seek = AddTableElement(tbl, m_TableDataSet, seek, mediaOffset); // Add guide lines. foreach (var ci in prop.m_GuideLineInfo) { AddGuigeLine(ci, mediaOffset); } // Add sumbols. foreach (var ci in prop.m_ZSumbolInfo) { AddZSumbolElement(ci, mediaOffset); } } } }
// private int mouseClickRow = -1; /// <summary> /// ���ô�ӡ״̬ /// </summary> /// <param name="student"></param> private void SetPrinted(StudentInfo student) { student.PrintedState = "�Ѵ�ӡ"; FT.DAL.Orm.SimpleOrmOperator.Update(student); }
public async System.Threading.Tasks.Task UpdateAsync(StudentInfo student, string Id) { await _student.ReplaceOneAsync(x => x.Id == Id, student); }
private void frmStudent_Registration_Load(object sender, EventArgs e) { studMgmnt = new StudentManagementSystem.Business.StudentManagement(); studInfo = new StudentInfo(); }
public StudentInfo Insert(StudentInfo student) { _student.InsertOne(student); return(student); }
public void Remove(StudentInfo studentInfo) { forumUOW.StudentRepositary.Delete( MapStudentInfoToStudent(studentInfo)); forumUOW.Save(); }
public void Add(StudentInfo studentInfo) { forumUOW.StudentRepositary.Add( MapStudentInfoToStudent(studentInfo)); forumUOW.Save(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); stuNews1 = StudentInfoManager.Getstudentnews(stuId); StudentInfoManager.Showstudentnews1(stuNews1, lblstuName, lblstyle, imgphoto); if (lblstyle.Text == "活跃型+视觉型") { lbldata.Text = "视频"; } else if (lblstyle.Text == "活跃型+言语型") { lbldata.Text = "视频"; } else if (lblstyle.Text == "沉思型+视觉型") { lbldata.Text = "图片"; } else if (lblstyle.Text == "沉思型+言语型") { lbldata.Text = "文字"; } else { Response.Redirect("../LearningStyleText.aspx"); } rbl1.SelectedValue = "2"; //再读一遍XML string Num = ""; //C#读取XML文件 http://www.cnblogs.com/xiaoxiangfeizi/archive/2011/08/07/2120807.html XmlDocument doc = new XmlDocument(); //使用的时候,首先声明一个XmlDocument对象,然后调用Load方法,从指定的路径加载XML文件 doc.Load(Server.MapPath("../XML/" + Session["stuId"].ToString() + ".xml")); //然后可以通过调用SelectSingleNode得到指定的结点,通过GetAttribute得到具体的属性值.参看下面的代码 // 得到根节点"学习建议" XmlNode xn = doc.SelectSingleNode("学习建议"); // 得到根节点的所有子节点 XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xn1 in xnl) { // 将节点转换为元素,便于得到节点的属性值 XmlElement xe = (XmlElement)xn1; // 得到Type和ISBN两个属性的属性值 Num = Num + xe.GetAttribute("类型").ToString() + ","; } if (Num == "") { lblsug.Text = lblstuName.Text + "同学,欢迎进入学习资料素材库!"; } else { lblsug.Text = lblstuName.Text + "同学,在上次测试中你需要复习知识点有:" + Num; } } else { Response.Redirect("../Login.aspx"); } } }
public bool Create(StudentInfo student) { _context.StudentInfos.Add(student); _context.SaveChanges(); return(true); }
public ApplyPrinter(StudentInfo student) : base(student) { }
private void updateButton_Click(object sender, EventArgs e) { if (Id == "") { MessageBox.Show("Please Search code first!"); return; } if (Id != codeTextBox.Text) { MessageBox.Show("Sorry, you can't update Id!"); return; } try { StudentInfo userupdate = new StudentInfo(); userupdate.Id = codeTextBox.Text; userupdate.Name = textBox1.Text; userupdate.Contact = textBox2.Text; userupdate.Email = textBox3.Text; if (maleRadioButton.Checked == true) { userupdate.Gender = "Male"; } else if (femaleRadioButton.Checked == true) { userupdate.Gender = "Female"; } else if (othersRadioButton.Checked == true) { userupdate.Gender = "Others"; } else { genderLabel.Text = "*Please Select Gender First!"; } //select recedient if (recidentCheckBox.Checked == true) { userupdate.Resident = "Yes"; } else { userupdate.Resident = "No"; } bool isStudentupdate = userupdate.Update(userupdate); if (isStudentupdate) { MessageBox.Show("Done!"); return; } else { MessageBox.Show("Failed"); } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
// �佣����ӣ�2009-9-11 /// <summary> /// ����ѧ�����֤�ŵõ�ѧ�� /// </summary> /// <param name="strIdentityID"></param> /// <returns>ѧ��</returns> public StudentInfo GetStudentByIdentityID(string strIdentityID) { SqlParameter param = new SqlParameter("@identityNO", strIdentityID); StudentInfo stu = new StudentInfo(); SqlDataReader reader = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringSTEduSys, CommandType.StoredProcedure, "[SP_GetStudentByIdentityID]", param); if (reader.Read()) { stu.DtEndDate = Convert.ToDateTime(reader["endDate"]); stu.DtStartDate = Convert.ToDateTime(reader["startDate"]); stu.IGroupId = Convert.ToInt32(reader["groupID"]); stu.IStudentId = Convert.ToInt32(reader["ID"]); stu.StrIdentityId = strIdentityID; stu.StrPassword = Convert.ToString(reader["pwd"]); stu.StrStudentName = Convert.ToString(reader["name"]); stu.StrStudentNO = Convert.ToString(reader["stuNO"]); stu.ClassName = Convert.ToString(reader["className"]); stu.GroupNO = Convert.ToInt32(reader["groupNO"]); stu.ClassId = Convert.ToInt32(reader["classId"]); } return stu; }
private void SaveButton_Click(object sender, EventArgs e) { int flag = 1; //validation string email = textBox3.Text; if (textBox1.Text.Length < 3) { errorProvider1.SetError(textBox1, "Please enter a valid Name"); flag = 0; } else { errorProvider1.Clear(); } if (textBox2.Text.Length < 11 || textBox2.Text.Length > 11) { errorProvider1.SetError(textBox2, "Please Enter a Valid Phone Number"); flag = 0; } else { errorProvider1.Clear(); } if (!IsValidEmail(email)) { errorProvider1.SetError(textBox3, "Email No must have @ and it`s must be Valid"); flag = 0; } else { errorProvider1.Clear(); } if (flag == 0) { return; } //************** try { StudentInfo student = new StudentInfo(); DateTime date = DateTime.Now; DateTime idate = Convert.ToDateTime(date); int datey = Convert.ToInt32(idate.Year) / 1000; int datem = Convert.ToInt32(idate.Month); //student.Id = datev.ToString()+"-000-"+"7"+student.Code; student.Name = textBox1.Text; student.Contact = textBox2.Text; student.Email = textBox3.Text; student.Code = Convert.ToInt32(codeTextBox.Text); student.Id = datey.ToString() + "-" + student.Code + "-" + datem; if (maleRadioButton.Checked == true) { student.Gender = "Male"; } else if (femaleRadioButton.Checked == true) { student.Gender = "Female"; } else if (othersRadioButton.Checked == true) { student.Gender = "Others"; } else { genderLabel.Text = "*Please Select Gender First!"; } //select recedient if (recidentCheckBox.Checked == true) { student.Resident = "Yes"; } else { student.Resident = "No"; } bool isStudentAdded = student.Add(student); if (isStudentAdded) { MessageBox.Show("Done!"); //return; } else { MessageBox.Show("Failed"); } string connectionstring = "server=DWIP\\SQLEXPRESS; database=Entry;integrated security=true"; SqlConnection con = new SqlConnection(connectionstring); string query = @"SELECT StudentId,Name,Contact,Email,Gender,Recident FROM Students"; SqlCommand command = new SqlCommand(query, con); con.Open(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(command); da.Fill(dt); studentsDataGridView.DataSource = dt; con.Close(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
/// <summary> /// ����Ա��ѧ���û�����Ϣ /// </summary> /// <param name="mStudent">ѧ���Ķ�������Ӧ�������ĵ�ѧ����Id��ѧ��������ֹ���ڣ�ѧ���������</param> /// <returns>���Ƿ�ɹ����ɹ���true,ʧ����false</returns> public bool EditStudent(StudentInfo mStudent) { SqlParameter[] parms = { new SqlParameter("@stuNO",mStudent.StrStudentNO), new SqlParameter("@classID",mStudent.ClassId) }; bool isSuccess = false; int affectedRows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringSTEduSys, CommandType.StoredProcedure, "SP_EditStuInfoByID", parms); if (affectedRows > 0) { isSuccess = true; } return isSuccess; }
//点击提交按钮事件 protected void btnSubmit_Click(object sender, EventArgs e) { int na = 0; int nb = 0; int nc = 0; int nd = 0; if (rdolistS1.SelectedValue == "A") { na = na + 1; } else if (rdolistS1.SelectedValue == "B") { nb = nb + 1; } if (rdolistS2.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS2.SelectedValue == "B") { nd = nd + 1; } if (rdolistS3.SelectedValue == "A") { na = na + 1; } else if (rdolistS3.SelectedValue == "B") { nb = nb + 1; } if (rdolistS4.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS4.SelectedValue == "B") { nd = nd + 1; } if (rdolistS5.SelectedValue == "A") { na = na + 1; } else if (rdolistS5.SelectedValue == "B") { nb = nb + 1; } if (rdolistS6.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS6.SelectedValue == "B") { nd = nd + 1; } if (rdolistS7.SelectedValue == "A") { na = na + 1; } else if (rdolistS7.SelectedValue == "B") { nb = nb + 1; } if (rdolistS8.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS8.SelectedValue == "B") { nd = nd + 1; } if (rdolistS9.SelectedValue == "A") { na = na + 1; } else if (rdolistS9.SelectedValue == "B") { nb = nb + 1; } if (rdolistS10.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS10.SelectedValue == "B") { nd = nd + 1; } if (rdolistS11.SelectedValue == "A") { na = na + 1; } else if (rdolistS11.SelectedValue == "B") { nb = nb + 1; } if (rdolistS12.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS12.SelectedValue == "B") { nd = nd + 1; } if (rdolistS13.SelectedValue == "A") { na = na + 1; } else if (rdolistS13.SelectedValue == "B") { nb = nb + 1; } if (rdolistS14.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS14.SelectedValue == "B") { nd = nd + 1; } if (rdolistS15.SelectedValue == "A") { na = na + 1; } else if (rdolistS15.SelectedValue == "B") { nb = nb + 1; } if (rdolistS16.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS16.SelectedValue == "B") { nd = nd + 1; } if (rdolistS17.SelectedValue == "A") { na = na + 1; } else if (rdolistS17.SelectedValue == "B") { nb = nb + 1; } if (rdolistS18.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS18.SelectedValue == "B") { nd = nd + 1; } if (rdolistS19.SelectedValue == "A") { na = na + 1; } else if (rdolistS19.SelectedValue == "B") { nb = nb + 1; } if (rdolistS20.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS20.SelectedValue == "B") { nd = nd + 1; } if (rdolistS21.SelectedValue == "A") { na = na + 1; } else if (rdolistS21.SelectedValue == "B") { nb = nb + 1; } if (rdolistS22.SelectedValue == "A") { nc = nc + 1; } else if (rdolistS22.SelectedValue == "B") { nd = nd + 1; } string learningstyle; string stuId = Session["stuId"].ToString(); string password = Session["password"].ToString(); Session["na"] = na; Session["nb"] = nb; Session["nc"] = nc; Session["nd"] = nd; if (na > nb && nc > nd) { learningstyle = "活跃型+视觉型"; Session["result"] = "您的学习风格为活跃型+视觉型,适合视频型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为活跃型+视觉型!'); </script>"); } else if (na > nb && nc < nd) { learningstyle = "活跃型+言语型"; Session["result"] = "您的学习风格为活跃型+言语型!,适合视频型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为活跃型+言语型!'); </script>"); } else if (na < nb && nc > nd) { learningstyle = "沉思型+视觉型"; Session["result"] = "您的学习风格为沉思型+视觉型,适合图片型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为沉思型+视觉型!'); </script>"); } else { learningstyle = "沉思型+言语型"; Session["result"] = "您的学习风格为沉思型+言语型,适合文字型学习方式!"; //Response.Write("<script type = 'text/javascript'> alert('您的学习风格为沉思型+言语型!'); </script>"); } RegisterClientScriptBlock("", "<script type = 'text/javascript'> alert('测试结束,请点击页面下方的按钮查看学习风格测试结果!'); </script>"); StudentInfo studentInfo = new StudentInfo(stuId, learningstyle, password); StudentInfoManager.UpdateStudent2(studentInfo); //记录用户学习风格类型 btnSubmit.Visible = false; Panel1.Visible = true; }
private void StuInfoInPut_Click(object sender, EventArgs e) { StudentInfo objStudentInfo = new StudentInfo(); objStudentInfo.MdiParent = this; objStudentInfo.Show(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["stuId"] != null) { string stuId = Session["stuId"].ToString(); string learningstyle = ""; stuNews1 = StudentInfoManager.Getstudentnews(stuId); learningstyle = stuNews1.learningStyle; //判断是否进行过学习风格测试 if (learningstyle == "") { r1 = LearningStyleManager.GetRadio(1); //获取学习风格测试题 LearningStyleManager.ShowQuestionRadio(r1, rdolistS1, lblS1); //显示题目 r2 = LearningStyleManager.GetRadio(2); LearningStyleManager.ShowQuestionRadio(r2, rdolistS2, lblS2); r3 = LearningStyleManager.GetRadio(3); LearningStyleManager.ShowQuestionRadio(r3, rdolistS3, lblS3); r4 = LearningStyleManager.GetRadio(4); LearningStyleManager.ShowQuestionRadio(r4, rdolistS4, lblS4); r5 = LearningStyleManager.GetRadio(5); LearningStyleManager.ShowQuestionRadio(r5, rdolistS5, lblS5); r6 = LearningStyleManager.GetRadio(6); LearningStyleManager.ShowQuestionRadio(r6, rdolistS6, lblS6); r7 = LearningStyleManager.GetRadio(7); LearningStyleManager.ShowQuestionRadio(r7, rdolistS7, lblS7); r8 = LearningStyleManager.GetRadio(8); LearningStyleManager.ShowQuestionRadio(r8, rdolistS8, lblS8); r9 = LearningStyleManager.GetRadio(9); LearningStyleManager.ShowQuestionRadio(r9, rdolistS9, lblS9); r10 = LearningStyleManager.GetRadio(10); LearningStyleManager.ShowQuestionRadio(r10, rdolistS10, lblS10); r11 = LearningStyleManager.GetRadio(11); LearningStyleManager.ShowQuestionRadio(r11, rdolistS11, lblS11); r12 = LearningStyleManager.GetRadio(12); LearningStyleManager.ShowQuestionRadio(r12, rdolistS12, lblS12); r13 = LearningStyleManager.GetRadio(13); LearningStyleManager.ShowQuestionRadio(r13, rdolistS13, lblS13); r14 = LearningStyleManager.GetRadio(14); LearningStyleManager.ShowQuestionRadio(r14, rdolistS14, lblS14); r15 = LearningStyleManager.GetRadio(15); LearningStyleManager.ShowQuestionRadio(r15, rdolistS15, lblS15); r16 = LearningStyleManager.GetRadio(16); LearningStyleManager.ShowQuestionRadio(r16, rdolistS16, lblS16); r17 = LearningStyleManager.GetRadio(17); LearningStyleManager.ShowQuestionRadio(r17, rdolistS17, lblS17); r18 = LearningStyleManager.GetRadio(18); LearningStyleManager.ShowQuestionRadio(r18, rdolistS18, lblS18); r19 = LearningStyleManager.GetRadio(19); LearningStyleManager.ShowQuestionRadio(r19, rdolistS19, lblS19); r20 = LearningStyleManager.GetRadio(20); LearningStyleManager.ShowQuestionRadio(r20, rdolistS20, lblS20); r21 = LearningStyleManager.GetRadio(21); LearningStyleManager.ShowQuestionRadio(r21, rdolistS21, lblS21); r22 = LearningStyleManager.GetRadio(22); LearningStyleManager.ShowQuestionRadio(r22, rdolistS22, lblS22); } else { lblTitle.Visible = false; PanelAll.Visible = false; btnSubmit.Visible = false; //Response.Write(string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", "您的学习风格为" + learningstyle + "!")); RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('{0}'); </script>", "您的学习风格为" + learningstyle + "!")); } } else { Response.Redirect("Login.aspx"); } }
public static string saveInfo(string SignUpNum, string Zkzh, string Sfzh, string StuName, string Csrq, string Xb, string Mobile, string Nation, string ZZMM, int Health, string KSLB, string AreaCode_Shi, string AreaCode, string Byxx, string BYLB, string LikeSpecial, string Tel, string Yzbm, string Txdz, string FrsZY, string SecZy, int IsAdjust, string AcceptPeople) { String strCsrq = Sfzh.Substring(6, 4) + "-" + Sfzh.Substring(10, 2) + "-" + Sfzh.Substring(12, 2); int _XB = 0; if (int.Parse(Sfzh.Substring(14, 3)) % 2 != 0) { _XB = 1; } int code = 1; string message = "保存成功"; try { StudentInfo _setInfo = new StudentInfo(); _setInfo.AcceptPeople = AcceptPeople; _setInfo.AreaCode = AreaCode; _setInfo.BYLB = BYLB; _setInfo.Byyx = Byxx; _setInfo.Csrq = DateTime.Parse(strCsrq); _setInfo.Health = Health; _setInfo.KSLB = KSLB; _setInfo.LikeSpecial = LikeSpecial; _setInfo.Mobile = Mobile; _setInfo.Nation = Nation; //_setInfo.PicPath _setInfo.Sfzh = Sfzh; _setInfo.Tel = Tel; _setInfo.Txdz = Txdz; _setInfo.Xb = _XB; _setInfo.Yzbm = Yzbm; _setInfo.ZZMM = ZZMM; using (StudentInfoBLL bll = new StudentInfoBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_setInfo); } else { bll.Update(_setInfo); } } Wish _wish = new Wish(); _wish.Sfzh = Sfzh; _wish.IsAdjust = IsAdjust; _wish.FrsZY = FrsZY; _wish.SecZY = SecZy; using (WishBLL bll = new WishBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_wish); } else { bll.Update(_wish); } } } catch (Exception) { code = 0; message = "数据合法性错误"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }
public void Update(string studentId, StudentInfo info) { var student = this.studentInfos .All() .Where(s => s.StudentId == studentId) .FirstOrDefault(); if (student != null) { student.MajorId = info.MajorId; student.UniversityId = info.UniversityId; this.studentInfos.Save(); } }
public static string getSelectInfo(string id) { int code = 1; string message = "返回数据成功"; StudentsUser user = new StudentsUser(); if (HttpContext.Current.Session["user_"] == null && id != "0") { using (StudentsUserBLL bll = new StudentsUserBLL()) { user = bll.GetEntity(int.Parse(id)); } } else if (HttpContext.Current.Session["user_"] != null) { user = HttpContext.Current.Session["user_"] as StudentsUser; } List <Nation> listNation = new List <Nation>(); List <ZZMM> listZZMM = new List <ZZMM>(); List <AreaCode_> shiAreaCode = new List <AreaCode_>(); List <KSLB> listKslb = new List <KSLB>(); List <BYLB> listBylb = new List <BYLB>(); List <ZY> listZy = new List <ZY>(); StudentInfo info = new StudentInfo(); Wish wish = new Wish(); if (user != null) { using (NationBLL bll = new NationBLL()) { listNation = bll.getListNation(); } using (ZZMMBLL bll = new ZZMMBLL()) { listZZMM = bll.getZZMMList(); } using (AfficheBLL bll = new AfficheBLL()) { shiAreaCode = bll.getShiAreaCode(); } using (KSLBBLL bll = new KSLBBLL()) { listKslb = bll.getListKslb(); } using (BYLBBLL bll = new BYLBBLL()) { listBylb = bll.getListBylb(); } using (ZYBLL bll = new ZYBLL()) { listZy = bll.getListZy(); } using (StudentInfoBLL bll = new StudentInfoBLL()) { info = bll.getEntity(user.Sfzh); } using (WishBLL bll = new WishBLL()) { wish = bll.getEntity(user.Sfzh); } } else { code = 0; message = "请登录后在操作"; } string str3 = JsonConvert.SerializeObject(new { code = code, message = message, listNation = listNation, listZZMM = listZZMM, shiAreaCode = shiAreaCode, listBylb = listBylb, listKslb = listKslb, listZy = listZy, user = user, info = info, wish = wish }); return(str3); }
public ApplicationEligibility IsEligibleToApply(StudentInfo student, University university) { var eligibilityResult = new ApplicationEligibility(); if (student.Scores == null) { eligibilityResult.Message = "You must fill in your scores."; return eligibilityResult; } if (student.Essay == null) { eligibilityResult.Message = "You must write your essay."; return eligibilityResult; } var totalSat = student.Scores.SatCRResult + student.Scores.SatMathResult + student.Scores.SatWritingResult; if (totalSat < university.RequiredSAT) { eligibilityResult.Message = "You don't meet the SAT score requirement."; return eligibilityResult; } if (student.Scores.CambridgeLevel < university.RequiredCambridgeLevel) { eligibilityResult.Message = "You don't have the necessary Cambridge Certificate level."; return eligibilityResult; } else if (student.Scores.CambridgeLevel == university.RequiredCambridgeLevel) { if (student.Scores.CambridgeResult < university.RequiredCambridgeScore) { eligibilityResult.Message = "You don't have the necessary Cambridge Certificate result."; return eligibilityResult; } } if (student.Scores.ToeflType == Interapp.Common.Enums.ToeflType.IBT) { if (student.Scores.ToeflResult < university.RequiredIBTToefl) { eligibilityResult.Message = "You don't meet the TOEFL IBT score requirement."; return eligibilityResult; } } else { if (student.Scores.ToeflResult < university.RequiredPBTToefl) { eligibilityResult.Message = "You don't meet the TOEFL PBT score requirement."; return eligibilityResult; } } foreach (var document in university.DocumentRequirements) { if (!student.Documents.Any(d => d.Name == document.Name)) { eligibilityResult.Message = "You don't have all the necessary documents."; return eligibilityResult; } } eligibilityResult.Message = "You are eligible to apply for the university."; eligibilityResult.IsEligible = true; return eligibilityResult; }
protected void xianshiTimu()//在PlaceHolder1中显示题目 { int zuoyeid = int.Parse(Request.QueryString["zuoyeid"]); string stuusername = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name; DataTable timutable = StudentInfo.GetStuZuoyeTimu(zuoyeid, stuusername); Literal tihaoliteral; //显示题号 Literal templiteral; RadioButtonList danxuanrbl; //显示单项选择 RadioButtonList panduanrbl; //判断 CheckBoxList duoxuancbl; //多选 TextBox tikongtbx; //填空 FileUpload caozuofuld; //文件上传 Button btn_uploadfile; //上传文件按钮 RequiredFieldValidator filevalidator; if (timutable.Rows.Count > 0) { int tihao = 1; #region 显示题目 foreach (DataRow timurow in timutable.Rows) { tihaoliteral = new Literal(); tihaoliteral.Text = tihao.ToString() + "(" + timurow[2].ToString() + "," + timurow[7].ToString() + "分)、" + timurow[3].ToString() + "<br/>"; PlaceHolder1.Controls.Add(tihaoliteral); switch (timurow[2].ToString().Trim()) { case "单项选择题": danxuanrbl = new RadioButtonList(); danxuanrbl.ID = "timu" + timurow[0].ToString().Trim(); danxuanrbl.Items.Add("A"); danxuanrbl.Items.Add("B"); danxuanrbl.Items.Add("C"); danxuanrbl.Items.Add("D"); if (timurow[5].ToString().Trim() != "") //设置单选题答案 { danxuanrbl.SelectedValue = timurow[5].ToString().Trim(); } danxuanrbl.RepeatDirection = RepeatDirection.Horizontal; danxuanrbl.Width = Unit.Pixel(240); templiteral = new Literal(); templiteral.Text = "<table><tr><td> 请选择(四选一):</td><td>"; PlaceHolder1.Controls.Add(templiteral); PlaceHolder1.Controls.Add(danxuanrbl); templiteral = new Literal(); templiteral.Text = "</td></tr></table>"; PlaceHolder1.Controls.Add(templiteral); break; case "判断题": panduanrbl = new RadioButtonList(); panduanrbl.ID = "timu" + timurow[0].ToString().Trim(); panduanrbl.Items.Add(new ListItem("正确", "T")); panduanrbl.Items.Add(new ListItem("错误", "F")); if (timurow[5].ToString().Trim() != "") { panduanrbl.SelectedValue = timurow[5].ToString().Trim().ToUpper(); } panduanrbl.RepeatDirection = RepeatDirection.Horizontal; panduanrbl.Width = Unit.Pixel(150); templiteral = new Literal(); templiteral.Text = "<table><tr><td> 请选择(二选一):</td><td>"; PlaceHolder1.Controls.Add(templiteral); PlaceHolder1.Controls.Add(panduanrbl); templiteral = new Literal(); templiteral.Text = "</td></tr></table>"; PlaceHolder1.Controls.Add(templiteral); break; case "多项选择题": duoxuancbl = new CheckBoxList(); duoxuancbl.ID = "timu" + timurow[0].ToString().Trim(); duoxuancbl.Items.Add("A"); duoxuancbl.Items.Add("B"); duoxuancbl.Items.Add("C"); duoxuancbl.Items.Add("D"); duoxuancbl.Items.Add("E"); if (timurow[5].ToString().Trim() != "") //设置多选题答案 { if (timurow[5].ToString().IndexOf('A') >= 0) { duoxuancbl.Items[0].Selected = true; } if (timurow[5].ToString().IndexOf('B') >= 0) { duoxuancbl.Items[1].Selected = true; } if (timurow[5].ToString().IndexOf('C') >= 0) { duoxuancbl.Items[2].Selected = true; } if (timurow[5].ToString().IndexOf('D') >= 0) { duoxuancbl.Items[3].Selected = true; } if (timurow[5].ToString().IndexOf('E') >= 0) { duoxuancbl.Items[4].Selected = true; } } templiteral = new Literal(); templiteral.Text = "<table><tr><td> 请选择(可多选):</td><td>"; PlaceHolder1.Controls.Add(templiteral); duoxuancbl.Width = Unit.Pixel(300); duoxuancbl.RepeatDirection = RepeatDirection.Horizontal; PlaceHolder1.Controls.Add(duoxuancbl); templiteral = new Literal(); templiteral.Text = "</td></tr></table>"; PlaceHolder1.Controls.Add(templiteral); break; case "操作题": templiteral = new Literal(); templiteral.Text = "<font color='red'><b>注意:作业文件要用'提交作业文件'按钮进行提交,各题分别提交,用'提交作业'按钮不能提交作业文件!</b></font><br/>"; PlaceHolder1.Controls.Add(templiteral); if (timurow[9].ToString().Length > 0) { HyperLink ziyuanfile = new HyperLink(); ziyuanfile.ID = "ziyuanfile" + timurow[0].ToString().Trim(); ziyuanfile.Text = "下载本题资源文件"; ziyuanfile.NavigateUrl = timurow[10].ToString().Trim(); PlaceHolder1.Controls.Add(ziyuanfile); } //显示文件上传控件 caozuofuld = new FileUpload(); caozuofuld.ID = "timu" + timurow[0].ToString().Trim(); caozuofuld.ToolTip = "不要上传程序文件,文件大小不要超过2MB,最好压缩后上传。"; templiteral = new Literal(); templiteral.Text = " 请选择要上传的作业文件:"; PlaceHolder1.Controls.Add(templiteral); PlaceHolder1.Controls.Add(caozuofuld); //添加文件验证 filevalidator = new RequiredFieldValidator(); filevalidator.Text = "请选择作业文件!"; filevalidator.ControlToValidate = "timu" + timurow[0].ToString().Trim(); filevalidator.ID = "fv" + timurow[0].ToString().Trim(); filevalidator.EnableClientScript = true; filevalidator.Display = ValidatorDisplay.Dynamic; filevalidator.ValidationGroup = "g" + timurow[0].ToString().Trim(); PlaceHolder1.Controls.Add(filevalidator); //显示上传文件按钮 btn_uploadfile = new Button(); btn_uploadfile.Text = "提交作业文件"; btn_uploadfile.ID = "timu" + timurow[0].ToString().Trim() + "upload"; btn_uploadfile.CommandArgument = timurow[0].ToString(); //btn_uploadfile.CommandName = "UploadZuoyeFile"; btn_uploadfile.Command += new CommandEventHandler(UploadZuoyeFile); btn_uploadfile.CausesValidation = true; btn_uploadfile.ValidationGroup = "g" + timurow[0].ToString().Trim(); PlaceHolder1.Controls.Add(btn_uploadfile); templiteral = new Literal(); templiteral.Text = "<br/>"; PlaceHolder1.Controls.Add(templiteral); //if (timurow[7].ToString().Length > 0) //{ HyperLink benrenzuoyefile = new HyperLink(); benrenzuoyefile.ID = "zuoyefile" + timurow[0].ToString().Trim(); benrenzuoyefile.Text = "下载我的作业文件"; benrenzuoyefile.NavigateUrl = timurow[6].ToString().Trim(); benrenzuoyefile.Target = "_blank"; PlaceHolder1.Controls.Add(benrenzuoyefile); //} templiteral = new Literal(); templiteral.Text = "<br/>"; PlaceHolder1.Controls.Add(templiteral); break; case "填空题": tikongtbx = new TextBox(); tikongtbx.ID = "timu" + timurow[0].ToString().Trim(); tikongtbx.TextMode = TextBoxMode.SingleLine; tikongtbx.MaxLength = 100; if (timurow[5].ToString().Trim() != "") //设置单选题答案 { tikongtbx.Text = timurow[5].ToString().Trim(); } templiteral = new Literal(); templiteral.Text = " 请在此框中填写答案:"; PlaceHolder1.Controls.Add(templiteral); PlaceHolder1.Controls.Add(tikongtbx); templiteral = new Literal(); templiteral.Text = "<br/>"; PlaceHolder1.Controls.Add(templiteral); break; default: tikongtbx = new TextBox(); tikongtbx.ID = "timu" + timurow[0].ToString().Trim(); tikongtbx.TextMode = TextBoxMode.MultiLine; tikongtbx.Rows = 5; tikongtbx.Columns = 80; tikongtbx.MaxLength = 500; if (timurow[5].ToString().Trim() != "") //设置简答题答案 { tikongtbx.Text = timurow[5].ToString().Trim(); } templiteral = new Literal(); templiteral.Text = " 请在此框中填写答案:<br/>"; PlaceHolder1.Controls.Add(templiteral); PlaceHolder1.Controls.Add(tikongtbx); templiteral = new Literal(); templiteral.Text = "<br/>"; PlaceHolder1.Controls.Add(templiteral); break; } tihao++; } #endregion } else { Button1.Enabled = false; } }
public F7Printer(StudentInfo student) : base(student) { }
/// <summary> /// 更新Student某筆資料 /// </summary> /// <param name="Student"> /// Student的某筆資料 /// </param> /// <returns>Boolean</returns> public static bool Update(StudentInfo Student) { return(myDB.Update(Student)); }
public string Reg(string input) { Student student = new Student(); student = JsonConvert.DeserializeObject<Student>(input); ProjectDBEntities PDb = new ProjectDBEntities(); int count = PDb.StudentInfo.Where(s => s.SID == student.ID).Count(); if (count == 0) { StudentInfo st = new StudentInfo { SID = student.ID, S_NAME = student.Name, S_GENDER = student.Gender, S_BIRTHDAY = student.Birthday, S_SCHOOL = student.School, S_GRADE = student.Grade }; PDb.StudentInfo.Add(st); PDb.SaveChanges(); return "True"; } else return "False"; }
public ActionResult CheckUser(string username, string sex, string phone, string idcard, string email, string address, string school, string passid, string password) { var newuser = new StudentInfo(); var check = data.Students.ToList(); string result = "success"; newuser.StuName = username; newuser.StuSex = sex; newuser.StuPhone = phone; newuser.StuIdCard = idcard; newuser.StuEmail = email; newuser.StuAddress = address; newuser.StuSchool = school; newuser.StuPassID = passid; newuser.StuPassword = password; for (int i = 0; i < check.Count; i++) { if (username == check[i].StuName) { result = "falsename"; return(Content(result)); } } for (int i = 0; i < check.Count; i++) { if (passid == check[i].StuPassID) { result = "falsepassid"; return(Content(result)); } } for (int i = 0; i < check.Count; i++) { if (phone == check[i].StuPhone) { result = "falsephone"; return(Content(result)); } } for (int i = 0; i < check.Count; i++) { if (idcard == check[i].StuIdCard) { result = "falseidcard"; return(Content(result));; } } for (int i = 0; i < check.Count; i++) { if (email == check[i].StuEmail) { result = "falseemail"; return(Content(result)); } } data.Students.Add(newuser); data.SaveChanges(); return(Content(result)); }
public ActionResult Edit(StudentInfoViewModel model, HttpPostedFileBase PostedLogo) { if (ModelState.IsValid) { StudentInfo entity = db.StudentInfo.Find(model.Id); if (PostedLogo != null) { byte[] imgBinaryData = new byte[PostedLogo.ContentLength]; int readresult = PostedLogo.InputStream.Read(imgBinaryData, 0, PostedLogo.ContentLength); entity.StudentPhoto = imgBinaryData; } entity.StudentNameBangla = model.StudentNameBangla; entity.StudentNameEnglish = model.StudentNameEnglish; entity.StudentNameArabic = model.StudentNameArabic; entity.StudentDateOfBirth = model.StudentDateOfBirth; entity.GenderId = model.GenderId; entity.Nationality = model.Nationality; entity.FatherNameBangla = model.FatherNameBangla; entity.FatherNameEnglish = model.FatherNameEnglish; entity.FatherMobile = model.FatherMobile; entity.FatherIsAlive = model.FatherIsAlive; entity.FatherOccupation = model.FatherOccupation; entity.MotherNameBangla = model.MotherNameBangla; entity.MotherNameEnglish = model.MotherNameEnglish; entity.MotherIsAlive = model.MotherIsAlive; entity.MotherMobile = model.MotherMobile; entity.GuardianName = model.GuardianName; entity.GuardianOccupation = model.GuardianOccupation; entity.GuardianHouseNo = model.GuardianHouseNo; entity.GuardianVillage = model.GuardianVillage; entity.GuardianPostOffice = model.GuardianPostOffice; entity.GuardianThana = model.GuardianThana; entity.GuardianDistrict = model.GuardianDistrict; entity.RelationWithGuardian = model.RelationWithGuardian; entity.YearlyIncomeGuardian = model.YearlyIncomeGuardian; entity.PermanentAddressHouse = model.PermanentAddressHouse; entity.PermanentAddressVillage = model.PermanentAddressVillage; entity.PermanentAddressPostOffice = model.PermanentAddressPostOffice; entity.PermanentAddressThana = model.PermanentAddressThana; entity.PermanentAddressDistrict = model.PermanentAddressDistrict; entity.HonarablePersonNameInArea = model.HonarablePersonNameInArea; entity.PreviousInstitutionName = model.PreviousInstitutionName; entity.PreviousInstitutionAddress = model.PreviousInstitutionAddress; entity.PreviousInstitutionClass = model.PreviousInstitutionClass; entity.PreviousInstitutionClearanceNo = model.PreviousInstitutionClearanceNo; entity.PreviousInstitutionClearanceDate = model.PreviousInstitutionClearanceDate; entity.AdmittedDepartmentId = model.AdmittedDepartmentId; db.SaveChanges(); return(RedirectToAction("Edit", new { id = model.Id })); } ViewBag.GenderId = new SelectList(db.Gender.OrderBy(m => m.GenderName), "Id", "GenderName"); ViewBag.AdmittedDepartmentId = new SelectList(db.Department.OrderBy(m => m.Name), "Id", "Name"); ViewBag.BranchId = new SelectList(db.Company.OrderBy(m => m.CompanyName), "CompanyKey", "CompanyName"); return(View(model)); }
public List <StudentInfo> selectAllStudentInfo() { List <StudentInfo> listStudenti = new List <StudentInfo>(); StudentInfo tmpstudent = new StudentInfo(); StudentInfo student = new StudentInfo(); //Spajanje na bazu SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=dev1.mev.hr;" + "Initial Catalog=piis2018_e5_podaci1;" + "User id=piis2018_e5_user;" + "Password=uLPeq3Y9H5BV;"; string allStudents = "SELECT id,naziv,ects,teprosjek,godina FROM tStudenti order by teprosjek desc;"; int count = 0; try { SqlCommand sqlcommand = new SqlCommand(allStudents, con); log.LogWarning("sql: " + allStudents); con.Open(); // otvaranja konekcije SqlDataReader reader = sqlcommand.ExecuteReader(); log.LogWarning("reader: " + reader.FieldCount); while (reader.Read()) { student = new StudentInfo(); student.id = reader.GetInt32(0); student.Naziv = reader.GetString(1); student.ECTSOsvojenoB = reader.GetInt64(2); student.TePrB = reader.GetString(3); student.godina = reader.GetInt32(4); tmpstudent.SviStudenti.Insert(count, student); count++; } foreach (var StudentInfo in tmpstudent.SviStudenti) { log.LogWarning("inmethod: " + StudentInfo.Naziv); } /* * foreach (var StudentiInfo in listStudenti) * { * * log.LogWarning("readersve: " + StudentiInfo.Naziv); * * } */ } catch (SqlException sexp) { ViewBag.Error = sexp.Message; allStudents = null; } finally { con.Close(); } return(tmpstudent.SviStudenti); }
public ActionResult <StudentInfo> Create(StudentInfo student) { _student.Insert(student); return(RedirectToAction("Index")); }
/// <summary> /// ����ѧ���û����õ�ѧ�� /// </summary> /// <param name="strUsername"></param> /// <returns></returns> public StudentInfo GetStudentByUsername(string strUsername) { //�˴�'@stuNo'��������������ģ�2012/7/21 //SqlParameter param = new SqlParameter("@stuNO", strUsername); SqlParameter param = new SqlParameter("@username", strUsername); StudentInfo stu = new StudentInfo(); SqlDataReader reader = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringSTEduSys, CommandType.StoredProcedure, "[SP_GetStudentByUserName]", param); if (reader.Read()) { stu.IStudentId = Convert.ToInt32(reader["ID"]); stu.StrIdentityId = Convert.ToString(reader["identityNO"]); stu.StrPassword = Convert.ToString(reader["pwd"]); stu.StrStudentName = Convert.ToString(reader["name"]); stu.StrStudentNO = Convert.ToString(reader["stuNO"]); stu.ClassId = Convert.ToInt32(reader["classID"]); } return stu; }
public void AddStudent(StudentInfo student) { PrivateClassesDBContext.StudentInfoes.Add(student); }
public AllPrinter(StudentInfo student) : base(student) { }
public AccountInfo GetAccountByStudent(StudentInfo student) { //TODO: validate single return(PrivateClassesDBContext.AccountInfoes.FirstOrDefault(a => a.Id == student.AccountInfoId)); }
public static StudentInfo CheckAndGet(StudentInfo student) { DateTime birthday = DateTime.Now; student.id = Guid.NewGuid().ToString(); if (string.IsNullOrEmpty(student.gradename)) return student; if (string.IsNullOrEmpty(student.className)) return student; if (string.IsNullOrEmpty(student.name)) return student; if (student.gradeid < 1 || student.gradeid >= 9) return student; if (student.classid < 1 || student.classid > 9) return student; int number = 0; if (!int.TryParse(student.studentNum, out number)) return student; if (number < 1101 || number > 8999) return student; student.ValidStudentNumber = number; if (string.IsNullOrEmpty(student.gradetype)) return student; if (!student.gradetype.Equals("小班") && !student.gradetype.Equals("中班") && !student.gradetype.Equals("大班") && !student.gradetype.Equals("特色班") && !student.gradetype.Equals("托班")) return student; if (DateTime.TryParse(student.brithday, out birthday)) { student.ValidBirthday = birthday; } student.ValidGender = student.gender == 0 ? "女" : "男"; if (!student.classtype.Equals("全托") && !student.classtype.Equals("日托")) student.ValidEnterType = "日托"; else student.ValidEnterType = student.classtype; DateTime enterDate = DateTime.Now; if (DateTime.TryParse(student.joinTime, out enterDate)) { student.ValidEnterDate = enterDate; } student.HasLeftSchool = student.delflg == 0 ? (byte)0 : (byte)1; student.IsValid = true; return student; }
public List <ParentInfo> GetParentsByStudent(StudentInfo student) { return(PrivateClassesDBContext.ParentInfoes.Where(p => p.AccountInfoId == student.AccountInfoId).ToList()); }
public void Update(StudentInfo studentInfo) { var student = this.studentInfos.GetById(studentInfo.StudentId); if (student != null) { student.UniversityId = studentInfo.UniversityId; student.MajorId = studentInfo.MajorId; this.studentInfos.Save(); } }
public static int UpdateStudentInfo(StudentInfo theStudent) { return(StudentDataAccess.GetInstance.UpdateStudentInfo(theStudent)); }
public List<StudentInfo> GetStudents(String ClassID) { List<StudentInfo> Students = new List<StudentInfo>(); SqlConnection con = new SqlConnection( WebConfigurationManager.ConnectionStrings["iLearnConnectionString"].ConnectionString); String sql = "EXEC [dbo].[GetStudents] "; sql += "@ClassID = {0} "; sql = String.Format(sql, ClassID); SqlCommand cmd = new SqlCommand(sql, con); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { StudentInfo StInfo = new StudentInfo(reader["userID"].ToString(), reader["firstName"].ToString(), reader["lastName"].ToString(), reader["FullName"].ToString(), reader["password"].ToString(), reader["ClassID"].ToString(), reader["Title"].ToString()); Students.Add(StInfo); } } catch (SqlException err) { } finally { con.Close(); } return Students; }
public ActionResult Create(StudentInfoViewModel model, HttpPostedFileBase PostedLogo) { if (ModelState.IsValid) { StudentInfo entity = new StudentInfo(); if (PostedLogo != null) { byte[] imgBinaryData = new byte[PostedLogo.ContentLength]; int readresult = PostedLogo.InputStream.Read(imgBinaryData, 0, PostedLogo.ContentLength); entity.StudentPhoto = imgBinaryData; } entity.StudentNameBangla = model.StudentNameBangla; entity.StudentNameEnglish = model.StudentNameEnglish; entity.StudentNameArabic = model.StudentNameArabic; entity.StudentDateOfBirth = model.StudentDateOfBirth; entity.GenderId = model.GenderId; entity.Nationality = model.Nationality; entity.FatherNameBangla = model.FatherNameBangla; entity.FatherNameEnglish = model.FatherNameEnglish; entity.FatherIsAlive = model.FatherIsAlive; entity.FatherOccupation = model.FatherOccupation; entity.MotherNameBangla = model.MotherNameBangla; entity.MotherNameEnglish = model.MotherNameEnglish; entity.MotherIsAlive = model.MotherIsAlive; entity.MotherMobile = model.MotherMobile; entity.GuardianName = model.GuardianName; entity.GuardianOccupation = model.GuardianOccupation; entity.GuardianHouseNo = model.GuardianHouseNo; entity.GuardianVillage = model.GuardianVillage; entity.GuardianPostOffice = model.GuardianPostOffice; entity.GuardianThana = model.GuardianThana; entity.GuardianDistrict = model.GuardianDistrict; entity.RelationWithGuardian = model.RelationWithGuardian; entity.YearlyIncomeGuardian = model.YearlyIncomeGuardian; entity.PermanentAddressHouse = model.PermanentAddressHouse; entity.PermanentAddressVillage = model.PermanentAddressVillage; entity.PermanentAddressPostOffice = model.PermanentAddressPostOffice; entity.PermanentAddressThana = model.PermanentAddressThana; entity.PermanentAddressDistrict = model.PermanentAddressDistrict; entity.HonarablePersonNameInArea = model.HonarablePersonNameInArea; entity.PreviousInstitutionName = model.PreviousInstitutionName; entity.PreviousInstitutionAddress = model.PreviousInstitutionAddress; entity.PreviousInstitutionClass = model.PreviousInstitutionClass; entity.PreviousInstitutionClearanceNo = model.PreviousInstitutionClearanceNo; entity.PreviousInstitutionClearanceDate = model.PreviousInstitutionClearanceDate; entity.AdmittedDepartmentId = model.AdmittedDepartmentId; entity.Brach = model.AdmittedBranchId; entity.IsAssign = false; db.StudentInfo.Add(entity); db.SaveChanges(); model.Id = entity.Id; // var entity = db.BoardExamination.All(); var p = db.StudentInfoPreviousInstitution.Any(m => m.StudentInfo_FK == model.Id); if (p == false) { using (var _sdb = new JamiyahDBEntities()) { foreach (var item in _sdb.BoardExamination) { StudentInfoPreviousInstitutionViewModel _institutionObj = new StudentInfoPreviousInstitutionViewModel(); _institutionObj.ExamName = item.ExminationName; StudentInfoPreviousInstitution _studentInfoPreviousInstitutionEntity = new StudentInfoPreviousInstitution(); _studentInfoPreviousInstitutionEntity.ExamName = _institutionObj.ExamName; _studentInfoPreviousInstitutionEntity.StudentInfo_FK = model.Id; _sdb.StudentInfoPreviousInstitution.Add(_studentInfoPreviousInstitutionEntity); // db.SaveChanges(); } //save at the end _sdb.SaveChanges(); } } return(RedirectToAction("Edit", new { id = model.Id })); } ViewBag.GenderId = new SelectList(db.Gender.OrderBy(m => m.GenderName), "Id", "GenderName"); ViewBag.AdmittedDepartmentId = new SelectList(db.Department.OrderBy(m => m.Name), "Id", "Name"); ViewBag.BranchId = new SelectList(db.Company.OrderBy(m => m.CompanyName), "CompanyKey", "CompanyName"); return(View(model)); }