예제 #1
0
        //加载
        private void AddClass_Load(object sender, EventArgs e)
        {
            //绑定专业下拉框
            DataSet ds_Specialty = new BLL.tbSpecialtyInfo().GetAllList();

            this.cboxSpecialty.DataSource    = ds_Specialty.Tables[0];
            this.cboxSpecialty.DisplayMember = "SpecialtyName";
            this.cboxSpecialty.ValueMember   = "SpecialtyId";

            //加载数据
            if (this.FS == FormStatus.Update)
            {
                Model.tbClassInfo model = new BLL.tbClassInfo().GetModel(this.ClassId);
                if (model != null)
                {
                    this.txtClassId.Text             = model.ClassId.ToString();
                    this.txtClassName.Text           = model.ClassName;
                    this.cboxSpecialty.SelectedValue = model.SpecialtyId.ToString();
                    this.txtClassroomId.Text         = model.classroomId;
                    this.txteductionalSystem.Text    = model.eductionalSystem;
                    this.TimePickerEnterTime.Value   = model.enterTime;
                    this.txtMarks.Text = model.Marks;
                }
                else
                {
                    MessageBox.Show("未找到相关数据,请确认");
                }
            }
        }
예제 #2
0
        private void SpecialtyForm_Load(object sender, EventArgs e)
        {
            DataSet ds = new BLL.tbSpecialtyInfo().GetAllList();

            if (ds != null && ds.Tables.Count > 0)
            {
                this.myDataGridView1.DataSource = ds.Tables[0];
            }
        }
예제 #3
0
        private void CourseInfoForm_Load(object sender, EventArgs e)
        {
            //绑定下拉框
            DataSet ds_Specialty = new BLL.tbSpecialtyInfo().GetAllList();
            DataRow dr           = ds_Specialty.Tables[0].NewRow();

            dr["SpecialtyId"]   = 0;
            dr["SpecialtyName"] = "--请选择--";
            ds_Specialty.Tables[0].Rows.InsertAt(dr, 0);
            this.cboxSpecialtyId.DataSource    = ds_Specialty.Tables[0];
            this.cboxSpecialtyId.DisplayMember = "SpecialtyName";
            this.cboxSpecialtyId.ValueMember   = "SpecialtyId";
            DataSet ds = new BLL.tbCourseInfo().GetListByCourseInfoView("");

            this.myDataGridView1.DataSource = ds.Tables[0];
        }
예제 #4
0
 //加载
 private void AddSpecialtyForm_Load(object sender, EventArgs e)
 {
     if (Fs == FormStatus.Update)
     {
         Model.tbSpecialtyInfo model = new BLL.tbSpecialtyInfo().GetModel(SpecialtyId);
         if (model != null)
         {
             this.txtSpecialtyId.Text          = model.SpecialtyId.ToString();
             this.txtSpecialtyName.Text        = model.SpecialtyName;
             this.txtSpecialtyDescription.Text = model.SpecialtyDescription;
         }
         else
         {
             MessageBox.Show("查不当前数据,请确定或重试");
             this.Close();
         }
     }
 }
예제 #5
0
        //保存
        private void btnOK_Click(object sender, EventArgs e)
        {
            Model.tbSpecialtyInfo model = new Model.tbSpecialtyInfo();
            model.SpecialtyName        = this.txtSpecialtyName.Text.Trim();
            model.SpecialtyDescription = this.txtSpecialtyDescription.Text.Trim();
            bool flag = false;

            try
            {
                if (Fs == FormStatus.Add)
                {
                    int id = new BLL.tbSpecialtyInfo().Add(model);
                    this.txtSpecialtyId.Text = id.ToString();
                    flag = true;
                }
                else if (Fs == FormStatus.Update)
                {
                    model.SpecialtyId = int.Parse(this.txtSpecialtyId.Text.Trim());
                    flag = new BLL.tbSpecialtyInfo().Update(model);
                }
                if (flag)
                {
                    MessageBox.Show("保存成功");
                    //如果保存成功,将当前窗体的状态改为修改状态
                    this.Fs = FormStatus.Update;
                }
                else
                {
                    MessageBox.Show("保存失败");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #6
0
        //查询
        private void btnQuery_Click(object sender, EventArgs e)
        {
            DataSet ds = new BLL.tbSpecialtyInfo().GetList(" SpecialtyName like '%" + this.txtSpecialty.Text.Trim() + "%' ");

            this.myDataGridView1.DataSource = ds.Tables[0];
        }