Beispiel #1
0
        public void NotConvertBO_WithNull()
        {
            StudentBO nullBO = null;
            var       entity = _converter.Convert(nullBO);

            Assert.Null(entity);
        }
Beispiel #2
0
        public static void LoadData()
        {
            if (TypeDAL.getList().Count == 0)
            {
                TypeDAL.LoadData();
            }

            //string fileName = @"input.csv";
            string fileName = AppDomain.CurrentDomain.BaseDirectory + @"..\DAL\source\input.csv";

            //string fileName = "c:/Users/brayan-pc/documents/visual studio 2017/Projects/Students/DAL/source/input.csv";

            try
            {
                int contador = 0;
                foreach (var line in File.ReadLines(fileName).Skip(1))
                {
                    contador++;
                    var       data        = line.Split(';');
                    TypeBO    type        = TypeDAL.findByName(data[0]);
                    StudentBO student_new = new StudentBO();
                    student_new.Type   = type;
                    student_new.Id     = contador;
                    student_new.Name   = data[1];
                    student_new.Gender = char.Parse(data[2]);
                    student_new.SetTime(data[3]);
                    StudentDAL.students.Add(student_new);
                }
            }
            catch (Exception)
            {
                throw;
            }
            //return myList;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string value = Request.QueryString["id"];
            int    id    = int.Parse(value);

            entity = studentBLL.findById(id);
        }
Beispiel #4
0
        public static bool Create(int typeId, string name, char gender)
        {
            bool result = false;

            try
            {
                TypeBO    type        = TypeDAL.findById(typeId);
                StudentBO student_new = new StudentBO();
                student_new.Type   = type;
                student_new.Id     = StudentDAL.getList().OrderByDescending(o => o.Id).First().Id + 1;
                student_new.Name   = name;
                student_new.Gender = gender;
                student_new.SetTime();

                StudentDAL.students.Add(student_new);
                result = true;
            }
            catch (Exception)
            {
                result = false;
                throw;
            }

            return(result);
        }
Beispiel #5
0
        public static int AddNewStudentDetails(StudentBO objStudentBO)
        {
            try
            {
                string sRollno = objStudentBO.RollNumber;
                string sFName  = objStudentBO.FirstName;
                string sLName  = objStudentBO.LastName;
                string sGender = objStudentBO.Gender;
                string sStream = objStudentBO.Stream;

                conn.Open();

                SqlCommand cmd = new SqlCommand("INSERT INTO Student_Table(RollNumber, FirstName, LastName, Gender,  Stream)"
                                                + "VALUES (@RollNo, @FName, @LName, @Gender, @Stream)", conn);

                cmd.Parameters.Add(new SqlParameter("@RollNo", sRollno));
                cmd.Parameters.Add(new SqlParameter("@FName", sFName));
                cmd.Parameters.Add(new SqlParameter("@LName", sLName));
                cmd.Parameters.Add(new SqlParameter("@Gender", sGender));
                cmd.Parameters.Add(new SqlParameter("@Stream", sStream));

                int result = cmd.ExecuteNonQuery();

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
        protected void btnGo_Click(object sender, EventArgs e)
        {
            gvPastFees.Visible = false;
            try
            {
                StudentBL objStudentBL = new StudentBL();
                StudentBO objStudentBO = new StudentBO();

                ApplicationResult objResultProgram = new ApplicationResult();
                objResultProgram = objStudentBL.Student_Search_StudentName(txtSearchName.Text, Convert.ToInt32(ddlSearchBy.SelectedValue), Convert.ToInt32(Session[ApplicationSession.ROLEID].ToString()), Convert.ToInt32(Session[ApplicationSession.SCHOOLID].ToString()));
                if (objResultProgram != null)
                {
                    if (objResultProgram.resultDT.Rows.Count > 0)
                    {
                        gvStudent.Visible    = true;
                        gvStudent.DataSource = objResultProgram.resultDT;
                        gvStudent.DataBind();
                        divFeePanel.Visible = false;
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('No Record Found.');</script>");
                        gvStudent.Visible   = false;
                        divFeePanel.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Beispiel #7
0
    protected void txtCustomStudentId_TextChanged(object sender, EventArgs e)
    {
        StudentBO      studentBO      = new StudentBO();
        StudentMajorBO studentmajorBO = new StudentMajorBO();
        int            studentId      = 0;

        if (txtCustomStudentId.Text.Trim() != "")
        {
            try
            {
                studentId = int.Parse(txtCustomStudentId.Text.Trim());
                string studentName = studentBO.GetStudentNameForId(studentId);
                if (studentName != "")
                {
                    List <StudentMajorVO> stmajorList = studentmajorBO.GetStudentMajorList(studentId);
                    string major = "";
                    foreach (StudentMajorVO studentMajorVO in stmajorList)
                    {
                        major += "&" + studentMajorVO.MajorID;
                    }
                    if (major.StartsWith("&"))
                    {
                        major = major.Substring(1);
                    }
                    txtStudentMajor.Text = major;
                    ddMajor.Enabled      = false;
                    txtStudentId.Text    = studentId.ToString();
                }
                txtName.Text = studentName;
                if (studentName == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id');", true);
                    // Response.Write("<script>alert(' Please enter a valid student id ');</script>");
                    return;
                }
                else
                {
                    FillTemplateNameDropDown();
                }
            }
            catch (ParseException)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id ');", true);
                //Response.Write("<script>alert(' Please enter a valid student id ');</script>");
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert(' Error in getting student details ');</script>");
                ExceptionUtility.LogException(ex, "Error Page");
            }
        }
        else
        {
            txtStudentId.Text = "";
            txtName.Text      = "";
        }
    }
Beispiel #8
0
 public StudentBO Create(StudentBO bo)
 {
     using (var unitOfWork = _uow)
     {
         var convertedEntity = _converter.Convert(bo);
         var createdEntity   = unitOfWork.StudentRepository.Create(convertedEntity);
         unitOfWork.Complete();
         return(_converter.Convert(createdEntity));
     }
 }
Beispiel #9
0
 public IActionResult Post([FromBody] StudentBO value)
 {
     if (value == null)
     {
         return(BadRequest(ErrorMessages.InvalidEntityString));
     }
     if (!ModelState.IsValid)
     {
         return(new BadRequestObjectResult(ModelState));
     }
     return(new OkObjectResult(_service.Create(value)));
 }
Beispiel #10
0
        public void UpdateByExistingId()
        {
            _repo.Setup(r => r.Get(It.IsAny <int>())).Returns(new Student());
            var studentToUpdate = new StudentBO
            {
                FirstName = "Test",
                LastName  = "Test",
                GroupId   = 1
            };
            var result = _service.Update(studentToUpdate);

            Assert.NotNull(result);
            Assert.True(result.IsInGroup);
        }
Beispiel #11
0
 public StudentBO Update(StudentBO bo)
 {
     using (var unitOfWork = _uow)
     {
         var convertedStudent = _converter.Convert(bo);
         var studentFromDB    = _uow.StudentRepository.Get(convertedStudent.Id);
         if (studentFromDB == null)
         {
             return(null);
         }
         studentFromDB.IsInGroup = convertedStudent.GroupId != null;
         studentFromDB.GroupId   = convertedStudent.GroupId;
         unitOfWork.Complete();
         return(_converter.Convert(studentFromDB));
     }
 }
Beispiel #12
0
        //Updating a Record here
        private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
        {
            string studentId = dataGridView1.CurrentRow.Cells["StudentId"].Value.ToString();

            if (!studentId.Equals(string.Empty))
            {
                StudentBO objStudentBO = new StudentBO();

                objStudentBO.StudentId  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["StudentId"].Value);
                objStudentBO.RollNumber = dataGridView1.CurrentRow.Cells["RollNumber"].Value.ToString();
                objStudentBO.FirstName  = dataGridView1.CurrentRow.Cells["FirstName"].Value.ToString();
                objStudentBO.LastName   = dataGridView1.CurrentRow.Cells["LastName"].Value.ToString();
                objStudentBO.Gender     = dataGridView1.CurrentRow.Cells["Gender"].Value.ToString();
                objStudentBO.Stream     = dataGridView1.CurrentRow.Cells["Stream"].Value.ToString();

                StudentBL.UpdateStudentDetails(objStudentBO);
            }
        }
        public List <StudentBO> GetStudents()
        {
            List <Student>   list   = studentsEntities.Students.ToList <Student>();
            List <StudentBO> BOList = new List <StudentBO>();

            foreach (Student st in list)
            {
                StudentBO sb = new StudentBO()
                {
                    StudentID   = st.StudentID,
                    StudentName = st.StudentName,
                    EmailID     = st.EmailID,
                    Marks       = (int)st.Marks
                };
                BOList.Add(sb);
            }
            return(BOList);
        }
Beispiel #14
0
        public Form2()
        {
            InitializeComponent();

            StudentBO ss = new StudentBO();

            Student[] st = new Student[60];
            st = ss.getStudentinfo();

            for (int i = 0; ; i++)
            {
                if (st[i] == null)
                {
                    break;
                }

                dataGridView1.Rows.Add(st[i].roll, st[i].name, st[i].batch, st[i].year, st[i].term, st[i].adress, st[i].contact);
            }
        }
Beispiel #15
0
        public static void LoadData2()
        {
            TypeBO type = new TypeBO();

            if (TypeDAL.getList().Count == 0)
            {
                TypeDAL.LoadData();
            }

            type = TypeDAL.findById(2);

            StudentBO student = new StudentBO();

            student.Id     = 1;
            student.Name   = "Jose";
            student.Gender = 'M';
            student.Type   = type;
            student.Time   = DateTime.Now.ToString();

            StudentDAL.students.Add(student);

            StudentBO student_2 = new StudentBO();

            student_2.Id     = 2;
            student_2.Name   = "Maria";
            student_2.Gender = 'F';
            student_2.Type   = type;
            student_2.Time   = DateTime.Now.ToString();

            StudentDAL.students.Add(student_2);

            StudentBO student_3 = new StudentBO();

            student_3.Id     = 3;
            student_3.Name   = "Jorge";
            student_3.Gender = 'M';
            student_3.Type   = type;
            student_3.Time   = DateTime.Now.ToString();

            StudentDAL.students.Add(student_3);
            //return myList;
        }
Beispiel #16
0
    public void Main()
    {
        StudentBO studentBusinessObject = new StudentBO();

        //输出所有的学生
        for (int i = 0; i < studentBusinessObject.GetAllStudent().Count; i++)
        {
            Console.WriteLine("Name:" + studentBusinessObject.GetAllStudent()[i].GetName()
                              + "RollNo:" + studentBusinessObject.GetAllStudent()[i].GetRollNo());
        }
        //更新学生
        StudentVO student = studentBusinessObject.GetAllStudent()[0];

        student.SetName("Michael");
        studentBusinessObject.UpdateStudent(student);

        //获取学生
        student = studentBusinessObject.GetStudent(0);
        Console.WriteLine("Name:" + student.GetName()
                          + "RollNo:" + student.GetRollNo());
    }
Beispiel #17
0
        public IActionResult Put(int id, [FromBody] StudentBO value)
        {
            if (value == null)
            {
                return(new BadRequestObjectResult(ErrorMessages.InvalidEntityString));
            }
            if (id != value.Id)
            {
                return(new BadRequestObjectResult(ErrorMessages.MismatchingIdString));
            }
            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }
            var result = _service.Update(value);

            if (result == null)
            {
                return(new NotFoundObjectResult(ErrorMessages.NotFoundString));
            }
            return(new OkObjectResult(result));
        }
Beispiel #18
0
        public static int UpdateStudentDetails(StudentBO objStudentBO)
        {
            try
            {
                Int32  iStudentId = objStudentBO.StudentId;
                string sRollno    = objStudentBO.RollNumber;
                string sFName     = objStudentBO.FirstName;
                string sLName     = objStudentBO.LastName;
                string sGender    = objStudentBO.Gender;
                string sStream    = objStudentBO.Stream;

                conn.Open();

                SqlCommand cmd = new SqlCommand("UPDATE Student_Table SET RollNumber = @RollNo, FirstName = @FName, LastName = @LName," +
                                                "Gender = @Gender, Stream = @Stream WHERE StudentId = @Id", conn);

                cmd.Parameters.Add(new SqlParameter("@Id", iStudentId));
                cmd.Parameters.Add(new SqlParameter("@RollNo", sRollno));
                cmd.Parameters.Add(new SqlParameter("@FName", sFName));
                cmd.Parameters.Add(new SqlParameter("@LName", sLName));
                cmd.Parameters.Add(new SqlParameter("@Gender", sGender));
                cmd.Parameters.Add(new SqlParameter("@Stream", sStream));

                int result = cmd.ExecuteNonQuery();

                conn.Close();

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                conn.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                entities = new List <TypeBO>();
                entities = typeBLL.getList();

                typeDropDownList.DataSource     = entities;
                typeDropDownList.DataTextField  = "Name";
                typeDropDownList.DataValueField = "Id";
                typeDropDownList.DataBind();

                string value = Request.QueryString["id"];
                int    id    = int.Parse(value);

                entity = studentBLL.findById(id);

                typeDropDownList.SelectedValue = entity.Type.Id.ToString();
                this.name.Text       = entity.Name;
                this.id.Value        = entity.Id.ToString();
                gender.SelectedValue = entity.Gender.ToString();
            }
        }
Beispiel #20
0
    protected void txtStudentId_TextChanged(object sender, EventArgs e)
    {
        StudentBO studentBO = new StudentBO();
        int       studentId = 0;

        if (txtStudentId.Text.Trim() != "")
        {
            try
            {
                studentId = int.Parse(txtStudentId.Text.Trim());
                string studentName = studentBO.GetStudentNameForId(studentId);
                txtName.Text = studentName;
                if (studentName == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id ');", true);
                    // Response.Write("<script>alert(' Please enter a valid student id ');</script>");
                }
            }
            catch (ParseException)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id ');", true);
                //Response.Write("<script>alert(' Please enter a valid student id ');</script>");
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' Error in getting student details ');", true);
                //Response.Write("<script>alert(' Error in getting student details ');</script>");
                ExceptionUtility.LogException(ex, "Error Page");
            }
        }
        else
        {
            txtStudentId.Text = "";
            txtName.Text      = "";
        }
    }
Beispiel #21
0
        public static void Main(string[] args)
        {
            StudentBO studentBusinessObject = new StudentBO();

            // Print all students
            foreach (StudentVO stud in studentBusinessObject.GetAllStudents())
            {
                Console.WriteLine("Student [No : {0}, Name : {1}]", stud.RollNo, stud.Name);
            }

            Console.WriteLine("\n");

            // Update students
            StudentVO student = studentBusinessObject.GetAllStudents()[0];

            student.Name = "Claire";
            studentBusinessObject.UpdateStudent(student);

            // Get the student
            student = studentBusinessObject.GetStudentByNo(student.RollNo);
            Console.WriteLine("Student [No : {0}, Name : {1}]", student.RollNo, student.Name);

            Console.ReadLine();
        }
Beispiel #22
0
        //Adding a New Record here
        private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
        {
            string studentId = dataGridView1.CurrentRow.Cells["StudentId"].Value.ToString();

            if (studentId.Equals(string.Empty))
            {
                StudentBO objStudentBO = new StudentBO();

                try
                {
                    objStudentBO.RollNumber = dataGridView1.CurrentRow.Cells["RollNumber"].Value.ToString();
                    objStudentBO.FirstName  = dataGridView1.CurrentRow.Cells["FirstName"].Value.ToString();
                    objStudentBO.LastName   = dataGridView1.CurrentRow.Cells["LastName"].Value.ToString();
                    objStudentBO.Gender     = dataGridView1.CurrentRow.Cells["Gender"].Value.ToString();
                    objStudentBO.Stream     = dataGridView1.CurrentRow.Cells["Stream"].Value.ToString();

                    StudentBL.AddNewStudentDetails(objStudentBO);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
 public StudentsController()
 {
     StudentBO = new StudentBO();
 }
Beispiel #24
0
        public static int UpdateStudentDetails(StudentBO objStudentBO)
        {
            int result = StudentDL.UpdateStudentDetails(objStudentBO);

            return(result);
        }
Beispiel #25
0
        public static int AddNewStudentDetails(StudentBO objStudentBO)
        {
            int result = StudentDL.AddNewStudentDetails(objStudentBO);

            return(result);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                StudentBO         objStudentBO  = new StudentBO();
                ApplicationResult objResults    = new ApplicationResult();
                StudentBL         objStudentBL  = new StudentBL();
                StudentTBO        objStudentTBO = new StudentTBO();
                //if ((ddlSchoolName.SelectedItem.Text == "" || ddlSchoolName.SelectedItem.Text == "--Select--")
                //    || (ddlSection.SelectedItem.Text == "" || ddlSection.SelectedItem.Text == "--Select--")
                //    || (ddlClassName.SelectedItem.Text == "" || ddlClassName.SelectedItem.Text == "--Select--")
                //    || (ddlDivisionName.SelectedItem.Text == "" || ddlDivisionName.SelectedItem.Text == "--Select--")
                //    || (ddlYear.SelectedItem.Text == "" || ddlYear.SelectedItem.Text == "--Select--")
                //    || (ddlStatus.SelectedItem.Text == "" || ddlStatus.SelectedItem.Text == "--Select--"))
                //{
                DatabaseTransaction.OpenConnectionTransation();
                for (int i = 0; i < gvExcelFile.Rows.Count; i++)
                {
                    objStudentBO.SchoolMID            = Convert.ToInt32(ddlSchoolName.SelectedValue);
                    objStudentBO.StudentFirstNameEng  = gvExcelFile.Rows[i].Cells[0].Text.Replace("&nbsp;", "");
                    objStudentBO.StudentFirstNameGuj  = gvExcelFile.Rows[i].Cells[3].Text.Replace("&nbsp;", "");
                    objStudentBO.StudentMiddleNameEng = gvExcelFile.Rows[i].Cells[1].Text.Replace("&nbsp;", "");
                    objStudentBO.StudentMiddleNameGuj = gvExcelFile.Rows[i].Cells[4].Text.Replace("&nbsp;", "");
                    objStudentBO.StudentLastNameEng   = gvExcelFile.Rows[i].Cells[2].Text.Replace("&nbsp;", "");
                    objStudentBO.StudentLastNameGuj   = gvExcelFile.Rows[i].Cells[5].Text.Replace("&nbsp;", "");

                    objStudentBO.FatherFirstNameEng  = gvExcelFile.Rows[i].Cells[6].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherFirstNameGuj  = gvExcelFile.Rows[i].Cells[9].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherMiddleNameEng = gvExcelFile.Rows[i].Cells[7].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherMiddleNameGuj = gvExcelFile.Rows[i].Cells[10].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherLastNameEng   = gvExcelFile.Rows[i].Cells[8].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherLastNameGuj   = gvExcelFile.Rows[i].Cells[11].Text.Replace("&nbsp;", "");

                    objStudentBO.MotherFirstNameEng  = gvExcelFile.Rows[i].Cells[12].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherFirstNameGuj  = gvExcelFile.Rows[i].Cells[15].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherMiddleNameEng = gvExcelFile.Rows[i].Cells[13].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherMiddleNameGuj = gvExcelFile.Rows[i].Cells[16].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherLastNameEng   = gvExcelFile.Rows[i].Cells[14].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherLastNameGuj   = gvExcelFile.Rows[i].Cells[17].Text.Replace("&nbsp;", "");

                    objStudentBO.AdmissionNo      = gvExcelFile.Rows[i].Cells[18].Text.Replace("&nbsp;", "");
                    objStudentBO.CurrentDate      = gvExcelFile.Rows[i].Cells[19].Text.Replace("&nbsp;", "");
                    objStudentBO.CurrentYear      = ddlYear.SelectedItem.ToString();
                    objStudentBO.CurrentSectionID = Convert.ToInt32(ddlSection.SelectedValue);

                    objStudentBO.CurrentClassID = Convert.ToInt32(ddlClassName.SelectedValue);
                    // objStudentBO.CurrentClassID = Convert.ToInt32(ddlClass.SelectedValue);
                    objStudentBO.CurrentDivisionTID = Convert.ToInt32(ddlDivisionName.SelectedValue);

                    objStudentBO.CurrentGrNo = gvExcelFile.Rows[i].Cells[20].Text.Replace("&nbsp;", "");

                    objStudentBO.AdmittedClassID = -1;

                    objStudentBO.AdmittedDivisionTID = -1;

                    objStudentBO.AdmittedYear = "-1";

                    objStudentBO.StudentPhoto = ImageToByteArrayFromFilePath("../Images/NoImage-big.jpg");


                    objStudentBO.GenderEng = gvExcelFile.Rows[i].Cells[22].Text;
                    objStudentBO.GenderGuj = gvExcelFile.Rows[i].Cells[21].Text;
                    //txtDateOfBirth.ReadOnly = false;
                    objStudentBO.DateOfBirth = gvExcelFile.Rows[i].Cells[23].Text.Replace("&nbsp;", "");
                    //txtDateOfBirth.ReadOnly = true;
                    objStudentBO.BirthDistrictEng     = gvExcelFile.Rows[i].Cells[24].Text.Replace("&nbsp;", "");
                    objStudentBO.BirthDistrictGuj     = gvExcelFile.Rows[i].Cells[25].Text.Replace("&nbsp;", "");
                    objStudentBO.NationalityEng       = gvExcelFile.Rows[i].Cells[26].Text.Replace("&nbsp;", "");
                    objStudentBO.NationalityGuj       = gvExcelFile.Rows[i].Cells[27].Text.Replace("&nbsp;", "");
                    objStudentBO.ReligionEng          = gvExcelFile.Rows[i].Cells[28].Text.Replace("&nbsp;", "");
                    objStudentBO.CasteEng             = gvExcelFile.Rows[i].Cells[29].Text.Replace("&nbsp;", "");
                    objStudentBO.CasteGuj             = gvExcelFile.Rows[i].Cells[30].Text.Replace("&nbsp;", "");
                    objStudentBO.SubCasteEng          = gvExcelFile.Rows[i].Cells[31].Text.Replace("&nbsp;", "");
                    objStudentBO.SubCasteGuj          = gvExcelFile.Rows[i].Cells[32].Text.Replace("&nbsp;", "");
                    objStudentBO.CategoryEng          = gvExcelFile.Rows[i].Cells[33].Text.Replace("&nbsp;", "");
                    objStudentBO.CategoryGuj          = gvExcelFile.Rows[i].Cells[34].Text.Replace("&nbsp;", "");
                    objStudentBO.SubCategory          = "";
                    objStudentBO.HandicapPrecent      = gvExcelFile.Rows[i].Cells[35].Text.Replace("&nbsp;", "");
                    objStudentBO.OtherDefect          = gvExcelFile.Rows[i].Cells[36].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentAddressEng    = gvExcelFile.Rows[i].Cells[37].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentAddressGuj    = gvExcelFile.Rows[i].Cells[38].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentCityEng       = gvExcelFile.Rows[i].Cells[39].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentCityGuj       = gvExcelFile.Rows[i].Cells[40].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentStateEng      = gvExcelFile.Rows[i].Cells[41].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentStateGuj      = gvExcelFile.Rows[i].Cells[42].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentPinCode       = gvExcelFile.Rows[i].Cells[43].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentContactNo     = gvExcelFile.Rows[i].Cells[44].Text.Replace("&nbsp;", "");
                    objStudentBO.PresentEmailId       = "";
                    objStudentBO.PermanentAddressEng  = gvExcelFile.Rows[i].Cells[45].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentAddressGuj  = gvExcelFile.Rows[i].Cells[46].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentCityEng     = gvExcelFile.Rows[i].Cells[47].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentCityGuj     = gvExcelFile.Rows[i].Cells[48].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentStateEng    = gvExcelFile.Rows[i].Cells[49].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentStateGuj    = gvExcelFile.Rows[i].Cells[50].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentPinCode     = gvExcelFile.Rows[i].Cells[51].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentContactNo   = gvExcelFile.Rows[i].Cells[52].Text.Replace("&nbsp;", "");
                    objStudentBO.PermanentEmailId     = "";
                    objStudentBO.FatherOccupation     = gvExcelFile.Rows[i].Cells[53].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherOccupation     = gvExcelFile.Rows[i].Cells[54].Text.Replace("&nbsp;", "");
                    objStudentBO.GardianOccupation    = gvExcelFile.Rows[i].Cells[55].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherQualification  = gvExcelFile.Rows[i].Cells[56].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherQualification  = gvExcelFile.Rows[i].Cells[57].Text.Replace("&nbsp;", "");
                    objStudentBO.GardianQualification = gvExcelFile.Rows[i].Cells[58].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherMobileNo       = gvExcelFile.Rows[i].Cells[59].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherMobileNo       = gvExcelFile.Rows[i].Cells[60].Text.Replace("&nbsp;", "");
                    objStudentBO.GardianMobileNo      = gvExcelFile.Rows[i].Cells[61].Text.Replace("&nbsp;", "");
                    objStudentBO.FatherEmailID        = gvExcelFile.Rows[i].Cells[62].Text.Replace("&nbsp;", "");
                    objStudentBO.MotherEmailID        = gvExcelFile.Rows[i].Cells[63].Text.Replace("&nbsp;", "");
                    objStudentBO.GardianEmailID       = gvExcelFile.Rows[i].Cells[64].Text.Replace("&nbsp;", "");
                    objStudentBO.Height             = "";
                    objStudentBO.Wight              = "";
                    objStudentBO.Hobbies            = "";
                    objStudentBO.StatusMasterID     = Convert.ToInt32(ddlStatus.SelectedValue);
                    objStudentBO.LeftDate           = "";
                    objStudentBO.LeftReason         = "";
                    objStudentBO.LeftYear           = "-Select-";
                    objStudentBO.LeftStd            = "";
                    objStudentBO.LcNo               = "";
                    objStudentBO.LcDate             = "";
                    objStudentBO.LcRemarks          = "";
                    objStudentBO.LcCopy             = "";
                    objStudentBO.RegisteredYear     = "-Select-";
                    objStudentBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                    objStudentBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                    objStudentBO.AdmissionDate      = "";

                    #region RollBack Transaction Starts


                    if (ViewState["Mode"].ToString() == "Save")
                    {
                        objResults = objStudentBL.Student_Insert(objStudentBO);
                        if (objResults != null)
                        {
                            if (objResults.resultDT.Rows.Count > 0)
                            {
                                ViewState["StudentMID"] = Convert.ToInt32(objResults.resultDT.Rows[0][0].ToString());
                            }
                            objStudentTBO.StudentMID         = Convert.ToInt32(ViewState["StudentMID"].ToString());
                            objStudentTBO.ClassMID           = Convert.ToInt32(ddlClassName.SelectedValue);
                            objStudentTBO.Year               = ddlYear.SelectedItem.ToString();
                            objStudentTBO.DivisionTID        = Convert.ToInt32(ddlDivisionName.SelectedValue);
                            objStudentTBO.StatusMasterID     = Convert.ToInt32(ddlStatus.SelectedValue);
                            objStudentTBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                            objStudentTBO.StatusName         = ddlStatus.SelectedItem.ToString();
                            objStudentTBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                            objStudentTBO.GrNo               = objStudentBO.CurrentGrNo;

                            objResults = objStudentBL.StudentT_Insert(objStudentTBO);
                            if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                // Response.Redirect("StudentDataImport.aspx");
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Student GRNo Already Exist.');", true);
                                ClearAll();
                            }
                        }
                    }
                }
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Record Saved Successfully.');", true);
                string Extension = string.Empty;
                Extension = Path.GetExtension(FileUpload1.FileName);
                System.IO.File.Delete(Server.MapPath("../_ImportData/" + ddlSchoolName.SelectedItem.Text.Replace(" ", "").ToString() + Extension));
                #endregion
                ClearAll();
                DatabaseTransaction.CommitTransation();



                //}
                //else
                //{
                //    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Select Every Dropdown.');", true);
                //}
            }
            catch (Exception ex)
            {
                DatabaseTransaction.RollbackTransation();
                string Extension = string.Empty;
                Extension = Path.GetExtension(FileUpload1.FileName);
                System.IO.File.Delete(Server.MapPath("../_ImportData/" + ddlSchoolName.SelectedItem.Text.Replace(" ", "").ToString() + Extension));
                ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Oops!Contact to your Administrator.');", true);
            }
        }
Beispiel #27
0
        public static StudentBO findById(int id)
        {
            StudentBO student = StudentDAL.students.FirstOrDefault(o => o.Id == id);

            return(student);
        }