public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { StudentMsg msg = (StudentMsg)value; DateTime t = msg.CreateTime; return("创建时间:" + t.ToHumanDateString() + "," + t.ToShortTimeString()); }
public bool Modify(StudentMsg student) { var query = from q in _DBMySchool.StudentMsg where q.StudentNo == student.StudentNo select q; foreach (var item in query) { item.StudentName = student.StudentName; item.Sex = student.Sex; item.Speciality = student.Speciality; item.Hobby = student.Hobby; item.Department = student.Department; item.Birthday = student.Birthday; } try { _DBMySchool.SubmitChanges(); return(true); } catch (Exception ex) { return(false); } }
public StudentMsg GetStudent() { string sex, birthday, hobby, dept, spec; sex = rbMan.Checked ? "男" : "女"; birthday = dtpBirthday.Value.ToString(); dept = cboDept.SelectedItem.ToString(); if (lbSpec.SelectedIndex == -1) { MessageBox.Show("请选择专业!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(null); } spec = lbSpec.SelectedItem.ToString(); hobby = ""; if (checkBox1.Checked) { hobby += checkBox1.Text; } if (checkBox2.Checked) { hobby += hobby == string.Empty ? checkBox2.Text : "、" + checkBox2.Text; } if (checkBox3.Checked) { hobby += hobby == string.Empty ? checkBox3.Text : "、" + checkBox3.Text; } if (checkBox4.Checked) { hobby += hobby == string.Empty ? checkBox4.Text : "、" + checkBox4.Text; } if (checkBox5.Checked) { hobby += hobby == string.Empty ? checkBox5.Text : "、" + checkBox5.Text; } if (checkBox6.Checked) { hobby += hobby == string.Empty ? checkBox6.Text : "、" + checkBox6.Text; } string info = "您姓名是:" + tbStuName.Text + "\n性别:" + sex + "\n出生年月为:" + birthday + "\n您是" + dept + "系" + spec + "专业的学生" + "\n你的兴趣有:" + hobby; MessageBox.Show(info, "学生信息", MessageBoxButtons.OK, MessageBoxIcon.Information); StudentMsg student = new StudentMsg() { StudentName = tbStuName.Text, Sex = Convert.ToChar(sex), Birthday = dtpBirthday.Value, Department = dept, Speciality = spec, Hobby = hobby }; if (_Student != null) { student.StudentNo = _Student.StudentNo; } return(student); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return("1"); } StudentMsg msg = (StudentMsg)value; return(msg.Rule.JCRule.ExJCRule.ValueMissionMsg(msg)); }
private void btnYes_Click(object sender, EventArgs e) { if (!_ViewModel.Modify(NewStudent = StuInfoControl.GetStudent())) { MessageBox.Show("修改失败!!!"); } else { this.DialogResult = DialogResult.OK; this.Close(); } }
private void btnYes_Click(object sender, EventArgs e) { StudentMsg student = StuInfoControl.GetStudent(); if (student == null) { //MessageBox.Show("添加失败!!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { _ViewModel.AddStudent(student); } }
public bool AddStudentMsg(string Name, string StudentId, string RuleId) { StudentMsg msg = new StudentMsg() { StudentId = Guid.Parse(StudentId), RuleId = new Guid(RuleId) }; lock (DataList.Current[Name].StudentMsgs) { DataList.Current[Name].AddStudentMsg(msg); } ClientList.AddNewMsg(Name, nameof(Data.StudentMsgs)); return(true); }
public void SetStudent(StudentMsg student) { _Student = student; }
public ModifyWindow(StudentMsg student) : this() { StuInfoControl.SetStudent(student); }
public XXT_StudentMsg(StudentMsg StudentMsg) { this.StudentMsg = StudentMsg; }
public void AddStudent(StudentMsg student) { _DBMySchool.StudentMsg.InsertOnSubmit(student); _DBMySchool.SubmitChanges(); }
public static void UserRunJCRule(this JCRule jcrule, StudentMsg msg, string cmd, Action <StudentMsg> action) { }