Ejemplo n.º 1
0
 private void btnAppend_Click(object sender, EventArgs e)
 {
     if (btnAppend.Text == "添加记录")
     {
         if (txtStudentName.Text.Trim() == "" || txtStudentNumber.Text.Trim() == "")
         {
             lbl.Text = "请完整信息的填写";
         }
         else
         {
             bllStudentInfo.InsertStudentInfo(text());
             dgvQuery.DataSource   = bllStudentInfo.GetAllStudentInfo(null, null);
             txtStudentName.Text   = string.Empty;
             txtStudentNumber.Text = string.Empty;
             txtStudentMarket.Text = string.Empty;
             rbtnMan.Checked       = true;
             lbl.Text = "";
         }
     }
     else
     {
         // MessageBox.Show(text().StudentInfoID.ToString());
         bllStudentInfo.UpdateStudentInfo(text());
         dgvQuery.DataSource = bllStudentInfo.GetAllStudentInfo(null, null);
         btnAppend.Text      = "添加记录";
         CmbData();
         cmbGrade.Text         = "——请选择年级——";
         cmbStudentClass.Text  = "——请选择班级——";
         cmbMajor.Text         = "——请选择专业——";
         cmbCollege.Text       = "——请选择学院——";
         txtStudentName.Text   = string.Empty;
         txtStudentNumber.Text = string.Empty;
         txtStudentMarket.Text = string.Empty;
         rbtnMan.Checked       = true;
         lbl.Text                = "";
         cmbGrade.Enabled        = false;
         cmbMajor.Enabled        = false;
         cmbStudentClass.Enabled = false;
         btnAppend.Enabled       = false;
     }
 }
    public void InsertStudentinfo()
    {
        BLLStudentInfo objbll = new BLLStudentInfo();

        objbll.Rollno      = txtrollno.Text;;
        objbll.Program_id  = cmdprogram.SelectedItem.Value.ToString();
        objbll.Session_id  = cmdsession.SelectedItem.Value.ToString();
        objbll.Reg_date    = Convert.ToDateTime(dtreg_date.Value);
        objbll.Name        = txtname.Text;
        objbll.Father_name = txtfname.Text;
        objbll.Gender      = cbgender.SelectedItem.ToString();
        objbll.Dob         = Convert.ToDateTime(dtdob.Value);
        objbll.Nic         = txtcnic.Text;
        objbll.Nationality = txtnationality.Text;
        objbll.Mobile      = txtmobileno.Text;
        objbll.Phone       = txtphoneno.Text;
        objbll.C_address   = txtcaddress.Text;
        objbll.P_address   = txtpaddress.Text;
        objbll.Email       = txtemail.Text;

        objbll.Username = txtrollno.Text;
        objbll.Password = Encrypt("usa".Trim());

        objbll.Pic_name = ("~/Student_Images/" + ThumbnailFileName.ToString());
        objbll.Pic_path = "d";

        objbll.Createdby  = user;
        objbll.Modifiedby = user;

        int a = objbll.InsertStudentInfo(objbll);

        if (a == 3)
        {
            lblresult.Text  = "Student Information Save Successfully....";
            BtnSave.Enabled = false;
            BtnNew.Enabled  = true;
        }
    }