Пример #1
0
        public int InsertStudentMarks(BOStudentMarks plans)
        {
            SqlParameter[] sqlParams = new SqlParameter[9];
            sqlParams[0] = new SqlParameter("@StudentId", plans.StudentId);
            sqlParams[1] = new SqlParameter("@ExamTypeId", plans.ExamTypeId);
            sqlParams[2] = new SqlParameter("@Marks", plans.Subjects);
            sqlParams[3] = new SqlParameter("@RecordId", plans.Id);
            sqlParams[4] = new SqlParameter("@HostCode", plans.HostCode);
            sqlParams[5] = new SqlParameter("@CreatedDate", DateTime.Now);
            sqlParams[6] = new SqlParameter("@ModifiedDate", DateTime.Now);
            sqlParams[7] = new SqlParameter("@CreatedBy", plans.UserId);
            sqlParams[8] = new SqlParameter("@ModifiedBy", plans.UserId);

            return cmnDA.ExecuteNonQuery("pr_StudentMarks_AddOrUpdate", sqlParams);
        }
Пример #2
0
 public int InsertStudentMarks(BOStudentMarks marks)
 {
     DAStudentMarks pDAL = new DAStudentMarks();
     try
     {
         return pDAL.InsertStudentMarks(marks);
     }
     catch
     {
         throw;
     }
     finally
     {
         pDAL = null;
     }
 }
Пример #3
0
        public List<BOStudentMarks> LoadStudentMarks(int userid, string hostCode)
        {
            DAStudentMarks pDAL = new DAStudentMarks();
            try
            {
                var dtMarks = pDAL.LoadStudentMarks(userid, hostCode);
                var marks = new List<BOStudentMarks>();

                BOStudentMarks mark = null;
                foreach (DataRow item in dtMarks.Rows)
                {
                    mark = new BOStudentMarks();

                    int studentId;
                    int.TryParse(item["StudentId"].ToString(), out studentId);
                    mark.StudentId = studentId;

                    int examTypeId;
                    int.TryParse(item["ExamTypeId"].ToString(), out examTypeId);
                    mark.ExamTypeId = examTypeId;

                    int absent;
                    int.TryParse(item["Absent"].ToString(), out absent);
                    mark.Absent = absent;

                    //int subjects;
                    //int.TryParse(item["Subjects"].ToString(), out subjects);
                    //mark.Subjects = subjects;

                    marks.Add(mark);
                }

                return marks;
            }
            catch
            {
                throw;
            }
            finally
            {
                pDAL = null;
            }
        }
Пример #4
0
        protected void btn_Click(object sender, EventArgs e)
        {
            try
            {
                var stdMarks = new BOStudentMarks();

                int termPlanId = 0;
                if (ViewState["planId"] != null)
                    termPlanId = Convert.ToInt16(ViewState["planId"]);

                stdMarks.Id = termPlanId;
                stdMarks.StudentId = Convert.ToInt16(drpRegNo.SelectedValue);
                stdMarks.ExamTypeId = Convert.ToInt16(drpExamType.SelectedValue);
                FillMarks(stdMarks);
                stdMarks.HostCode = "DEMO";
                stdMarks.UserId = 1;
                stdMarks.Status = "A";

                var isInserted = (new BLStudentMarks()).InsertStudentMarks(stdMarks);
                if (isInserted == 1)
                {
                    ResetControls();
                    lblErrorMsg.ForeColor = System.Drawing.Color.Green;
                    lblErrorMsg.Text = "Marks inserted successfully.";
                }
                else
                {
                    lblErrorMsg.ForeColor = System.Drawing.Color.Red;
                    lblErrorMsg.Text = "Process failed. Please try again.";
                }
            }
            catch (Exception ex)
            {
                lblErrorMsg.ForeColor = System.Drawing.Color.Red;
                lblErrorMsg.Text = "Unable to save data.";
            }
        }
Пример #5
0
        private void FillMarks(BOStudentMarks stdMarks)
        {
            var items = lstAbsentSubjects.Items.OfType<ListItem>();
            var subjects = (List<BOCategories>)ViewState["subjects"];

            StringBuilder marks = new StringBuilder();
            var hindiId = subjects.FirstOrDefault(s => s.SubCategoryName.ToUpper() == "HINDI");
            if (hindiId != null)
            {
                marks.Append(hindiId.SubCategoryId.ToString() + "|" +
                    ((txtHindi.Text.Trim().Length > 0) ? txtHindi.Text.Trim() : "-1" + ","));
            }

            var eng = subjects.FirstOrDefault(s => s.SubCategoryName.ToUpper() == "ENGLISH");
            if (eng != null)
            {
                marks.Append(eng.SubCategoryId.ToString() + "|" +
                    ((txtEnglish.Text.Trim().Length > 0) ? txtEnglish.Text.Trim() : "-1" + ","));
            }

            var maths = subjects.FirstOrDefault(s => s.SubCategoryName.ToUpper() == "MATHEMATICS");
            if (maths != null)
            {
                marks.Append(eng.SubCategoryId.ToString() + "|" +
                    ((txtMathematics.Text.Trim().Length > 0) ? txtMathematics.Text.Trim() : "-1" + ","));
            }

            stdMarks.Subjects = marks.ToString().TrimEnd(',');
        }