コード例 #1
0
        public void UserReg()
        {
            user.user_Name = "Rama".Trim();
            user.password  = Encrypt("ram12");
            db.User.Add(user);
            int result   = db.SaveChanges();
            int expected = 1;

            Assert.AreEqual(expected, result);
        }
コード例 #2
0
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     sm.Subject1  = db.Subject.Find(Convert.ToInt32(cmb_Subject.SelectedValue));
     sm.fullmarks = txt_Fullmarks.Text.Trim();
     sm.passmarks = txt_Passmarks.Text.Trim();
     sm.subject   = cmb_Subject.Text;
     db.SubjectMarks.Add(sm);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #3
0
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     if (txt_Section.Text == "")
     {
         MessageBox.Show("Please enter Section");
         txt_Section.Focus();
         return;
     }
     sc.section1 = txt_Section.Text.Trim();
     //SQL Execution
     db.Section.Add(sc);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #4
0
ファイル: Exam.cs プロジェクト: BsalHada/MarksheetGenerator
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     if (txt_Exam.Text == "")
     {
         MessageBox.Show("Please enter Examination Title");
         txt_Exam.Focus();
         return;
     }
     exams.examination_Type = txt_Exam.Text.Trim();
     //SQL Execution
     db.Examination.Add(exams);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #5
0
        private void DataGridTotal()
        {
            int     sum = 0; int sum_fmarks = 0;
            int     sumpass = 0;
            decimal per     = 0;

            for (int i = 0; i < dgv_MO.Rows.Count; ++i)
            {
                sum        += Convert.ToInt32(dgv_MO.Rows[i].Cells[10].Value);
                sum_fmarks += Convert.ToInt32(dgv_MO.Rows[i].Cells[8].Value);
                sumpass    += Convert.ToInt32(dgv_MO.Rows[i].Cells[9].Value);
            }
            //per = 100 / sum_fmarks;
            // MessageBox.Show(per.ToString());
            this.lbl_Total.Text  = sum.ToString();
            rst.student_Name     = cmb_Stdname.Text.Trim();
            rst.grade            = cmb_Grade.Text.Trim();
            rst.section          = cmb_Section.Text.Trim();
            rst.roll_No          = cmb_Roll.Text.Trim();
            rst.examination_Type = cmb_Exam.Text.Trim();
            rst.full_Total       = sum_fmarks;
            rst.pass_Total       = sumpass;
            rst.obtained_Total   = sum;
            db.ResultTotal.Add(rst);
            db.SaveChanges();
            // this.lbl_Percentage.Text = per.ToString();
            if (sum <= sumpass)
            {
                this.lbl_status.Text = "Failed!!";
            }
            else
            {
                this.lbl_status.Text = "Passed!";
            }
        }
コード例 #6
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            if (txt_Username.Text == "")
            {
                MessageBox.Show("Please enter USERNAME");
                txt_Username.Focus();
                return;
            }
            if (txt_Password.Text == "")
            {
                MessageBox.Show("Please enter PASSWORD");
                txt_Password.Focus();
                return;
            }
            Dbmodel.user_Name = txt_Username.Text.Trim();
            Dbmodel.password  = Encrypt(txt_Password.Text.Trim());
            db.User.Add(Dbmodel);
            db.SaveChanges();
            clear();
            MessageBox.Show("Registered Sucessfully");
            this.Hide();
            Login form = new Login();

            form.ShowDialog();
            this.Close();
        }
コード例 #7
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (txt_Remark.Text == "")
     {
         MessageBox.Show("Please enter Remark");
         txt_Remark.Focus();
         return;
     }
     rm.remark1 = txt_Remark.Text.Trim();
     //SQL Execution
     db.Remark.Add(rm);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #8
0
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     if (txt_Grade.Text == "")
     {
         MessageBox.Show("Please enter Grade");
         txt_Grade.Focus();
         return;
     }
     gd.grade1 = txt_Grade.Text.Trim();
     //SQL Execution
     db.Grade.Add(gd);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #9
0
 private void Btn_Add_Click(object sender, EventArgs e)
 {
     rslt.marks_Obtained   = txt_OM.Text.Trim();
     rslt.remark           = cmb_Remark.Text;
     rslt.grade            = cmb_Grade.Text;
     rslt.section          = cmb_Section.Text;
     rslt.student_Name     = cmb_Stdname.Text;
     rslt.examination_Type = cmb_Exam.Text;
     rslt.subject          = cmb_Subject.Text;
     rslt.examination_Id   = cmb_Exam.SelectedValue.ToString();
     //rslt.student_Id =(int)cmb_Stdname.SelectedValue;
     rslt.roll_No    = cmb_Roll.SelectedValue.ToString();
     rslt.full_Marks = db.SubjectMarks.Where(s => s.subject.Equals(cmb_Subject.Text)).Single().fullmarks;
     rslt.pass_Marks = db.SubjectMarks.Where(s => s.subject.Equals(cmb_Subject.Text)).Single().passmarks;
     db.Result.Add(rslt);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #10
0
        private void btn_Imp_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "Excel Files|*.xls;.xlsx;*.xlsm";
            if (open.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            FileStream       stream = new FileStream(open.FileName, FileMode.Open);
            IExcelDataReader reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            DataSet          result = reader.AsDataSet();
            MSGCPAEntities1  db     = new MSGCPAEntities1();

            foreach (DataTable table in result.Tables)
            {
                foreach (DataRow dr in table.Rows)
                {
                    Student std = new Student()
                    {
                        //    student_Id=Convert.ToInt32(dr[0]),
                        //    full_Name=Convert.ToString(dr[1]),
                        //    grade=Convert.ToString(dr[9]),
                        //    section=Convert.ToString(dr[10]),
                        //    roll_No=Convert.ToInt32(dr[11]),
                        //    address=Convert.ToString(dr[2]),
                        //   // DOB=Convert.ToString(dr[6]),
                        //   parents_Name=Convert.ToString(dr[6]),
                        //   parent_Phone=Convert.ToString(dr[8])

                        student_Id = Convert.ToInt32(dr[0]),
                        full_Name  = Convert.ToString(dr[1]),
                        grade      = Convert.ToString(dr[2]),
                        section    = Convert.ToString(dr[3]),
                        //roll_No = Convert.ToInt32(dr[4]),
                        address = Convert.ToString(dr[5]),
                        // DOB=Convert.ToString(dr[6]),
                        parents_Name = Convert.ToString(dr[7]),
                        parent_Phone = Convert.ToString(dr[8])
                    };
                    db.Student.Add(std);
                }
            }
            db.SaveChanges();
            reader.Close();
            stream.Close();
            MessageBox.Show("Saved Successfully");
        }
コード例 #11
0
 private void Btn_Save_Click(object sender, EventArgs e)
 {
     atd.student_Name = cmb_Stdname.Text.ToString();
     atd.subject_Name = cmb_Subject.Text.ToString();
     atd.section      = cmb_Section.Text.ToString();
     atd.student_Name = cmb_Stdname.Text.ToString();
     atd.grade        = cmb_Grade.Text.ToString();
     //atd.student_Id = (int)cmb_Stdname.SelectedValue;
     atd.subject_Id = (int)cmb_Subject.SelectedValue;
     atd.status     = cmb_Attendance.Text.ToString();
     db.Attendance.Add(atd);
     db.SaveChanges();
     clear();
     MessageBox.Show("Saved Sucessfully");
     PopulateDataGridView();
 }
コード例 #12
0
 private void Btn_Save_Click(object sender, EventArgs e)
 {
     if (txt_Schoolname.Text == "")
     {
         MessageBox.Show("Please enter School Name");
         txt_Schoolname.Focus();
         return;
     }
     if (txt_Address.Text == "")
     {
         MessageBox.Show("Please enter School Address");
         txt_Address.Focus();
         return;
     }
     if (txt_Principalname.Text == "")
     {
         MessageBox.Show("Please enter Principal Name");
         txt_Principalname.Focus();
         return;
     }
     if (txt_Estd.Text == "")
     {
         MessageBox.Show("Please enter Date of Establishment.");
         txt_Estd.Focus();
         return;
     }
     sdb.school_Name      = txt_Schoolname.Text.Trim();
     sdb.address          = txt_Address.Text.Trim();
     sdb.phone            = txt_Contact.Text.Trim();
     sdb.email            = txt_Email.Text.Trim();
     sdb.established_Date = txt_Estd.Text.Trim();
     sdb.website          = txt_Website.Text.Trim();
     sdb.principal_Name   = txt_Principalname.Text.Trim();
     //SQL Execution
     db.School.Add(sdb);
     db.SaveChanges();
     MessageBox.Show("Saved Sucessfully");
 }
コード例 #13
0
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            if (txt_StudentName.Text == "")
            {
                MessageBox.Show("Please enter Student Name");
                txt_StudentName.Focus();
                return;
            }
            if (txt_Address.Text == "")
            {
                MessageBox.Show("Please enter School Address");
                txt_Address.Focus();
                return;
            }
            if (cmb_Gender.Text == "")
            {
                MessageBox.Show("Please enter Select Gender");
                cmb_Gender.Focus();
                return;
            }
            if (txt_Contact.Text == "")
            {
                MessageBox.Show("Please enter Date of Establishment.");
                txt_Contact.Focus();
                return;
            }
            if (txt_Parentsname.Text == "")
            {
                MessageBox.Show("Please enter Parents Name.");
                txt_Parentsname.Focus();
                return;
            }
            if (txt_phone.Text == "")
            {
                MessageBox.Show("Please enter Parents Contact.");
                txt_phone.Focus();
                return;
            }
            if (cmb_Grade.Text == "")
            {
                MessageBox.Show("Please Select Class.");
                cmb_Grade.Focus();
                return;
            }
            if (cmb_Section.Text == "")
            {
                MessageBox.Show("Please choose Section.");
                cmb_Section.Focus();
                return;
            }

            std.full_Name    = txt_StudentName.Text.Trim();
            std.address      = txt_Address.Text.Trim();
            std.gender       = cmb_Gender.Text.Trim();
            std.phone        = txt_Contact.Text.Trim();
            std.DOB          = dateTimePicker1.Value.Date;
            std.gender       = cmb_Gender.Text.Trim();
            std.parents_Name = txt_Parentsname.Text.Trim();
            std.parent_Phone = txt_phone.Text.Trim();
            std.email        = txt_Email.Text.Trim();
            std.grade        = cmb_Grade.Text.Trim();
            std.section      = cmb_Section.Text.Trim();
            std.roll_No      = txt_Rollno.Text.Trim();
            db.Student.Add(std);
            db.SaveChanges();
            MessageBox.Show("Saved Sucessfully");
        }