public void UpdateStudent(BCStudent student)
 {
     using (var dbContext = new AttendanceSystemDB(_connectionString))
     {
         dbContext.Entry <BCStudent>(student).State = EntityState.Modified;
         dbContext.SaveChanges();
     }
 }
        public int AddStudent(BCStudent student)
        {
            using (var dbContext = new AttendanceSystemDB(_connectionString))
            {
                dbContext.BCStudents.Add(student);
                dbContext.SaveChanges();

                return(student.BCStudentId);
            }
        }
        public void EditStudent(BCStudent student, List <BCStudentClass> classId)
        {
            classId = classId.Where(c => c.BCClassId != 0).ToList();
            _adminRepo.UpdateStudent(student);

            _adminRepo.MarkStudentClassesInactive(student.BCStudentId);

            foreach (var c in classId)
            {
                _adminRepo.UpdateStudentClass(student.BCStudentId, c);
            }
        }
        public void AddStudent(BCStudent student, List <BCStudentClass> classIds)
        {
            classIds = classIds.Where(c => c.BCClassId != 0).ToList();

            var studentId = _adminRepo.AddStudent(student);

            foreach (var c in classIds)
            {
                c.BCStudentId = studentId;
                c.IsActive    = true;
                _adminRepo.AddStudentClass(c);
            }
        }
Exemple #5
0
    public void GetData(int classId, string Action, Int32 userId, Int32 userRoleId)
    {
        DataTable dt      = new DataTable();
        BCStudent student = new BCStudent();

        dt = student.GetScoreBoard(classId, Action, userId, userRoleId);
        if (dt.Rows.Count > 0)
        {
            dlScoreBoard.DataSource = dt;
            dlScoreBoard.DataBind();
        }
        else
        {
            dlScoreBoard.DataSource = null;
            dlScoreBoard.DataBind();
        }
    }
Exemple #6
0
 public virtual BCStudent GetAssociatedStudent()
 {
     BCStudent result = new BCStudent();
     result.Id = IdStudent;
     result.loadData();
     return result;
 }
Exemple #7
0
        public virtual void ComputeDynamicFields(PaymentAdvice parent)
        {
            ApasConfigurationManager cfg = new ApasConfigurationManager();

            decimal deviationTotal = 0;

            PayableFee=Amount;

            foreach (FeeDeviationPayableFee objFD in FeeDeviations.Values)
            {
                //objFD returns exact amount. round it before adding to total
                deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(0));//dummy zero, type is "fixed"
            }

            PayableFee += deviationTotal;

            BCStudent student = new BCStudent();
            student.Id = parent.IdStudent ;
            student.loadData();

            PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateOFee");

            //get Config paymentadvice Text template and fill PaymentAdviceText
            PaymentAdviceText =
                PaymentAdviceText
                    .Replace("[Name]", student.FullName)
                    .Replace("[Amount]", String.Format("{0:C}", Amount))
                    .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee))
                    .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal))
                    .Replace("[Private Remarks]", PrivateRemark)
                    .Replace("[Public Remarks]", PublicRemark)
                    .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM"))
                    .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy"))
                    .Replace("[Type]", OtherFeeType.Name);
        }
Exemple #8
0
        public ActionResult UpdateStudent(BCStudent student, List <BCStudentClass> classId)
        {
            _adminService.EditStudent(student, classId);

            return(Redirect("/admin/students"));
        }
Exemple #9
0
        static void Main(string[] args)
        {
            try
            {
                // variable declaration
                BCStudent objStudent    = new BCStudent();
                int       studentId     = 0;
                int       UserRoleId    = 5;
                int       stagePlanId   = 0;
                double    stageDistance = 0;
                double    distCovered   = 0;
                Int32     UserId        = 0;
                DataTable studInfo      = null;

                string UserName = string.Empty;
                Int32  schoolId = 0;
                Int32  classId  = 0;
                Int32  cityId   = 0;
                // end variable declaration



                // Get student info
                StringBuilder sqlString = new StringBuilder();

                sqlString.Append("select * from LoginDtls where LoginName='");
                sqlString.Append(args[0]);
                sqlString.Append("' and cast(Password as varbinary(20))=cast('");
                sqlString.Append(args[1]);
                sqlString.Append("' as varbinary(50)) and IsActive=1");

                var login = DataAccessLayer.ReturnDataTable(sqlString.ToString());

                if (login != null)
                {
                    UserRoleId = Convert.ToInt32(login.Rows[0]["RoleId"]);
                    UserId     = Convert.ToInt32(login.Rows[0]["LoginId"]);
                    UserName   = Convert.ToString(login.Rows[0]["LoginName"]);

                    if (UserRoleId == 5)
                    {
                        sqlString = new StringBuilder();
                        sqlString.Append("Select * FROM StudentMaster Where LoginId = ");
                        sqlString.Append(UserId);

                        var student = DataAccessLayer.ReturnDataTable(sqlString.ToString());
                        if (student != null && student.Rows.Count > 0)
                        {
                            schoolId  = Convert.ToInt32(student.Rows[0]["SchoolId"]);
                            classId   = Convert.ToInt32(student.Rows[0]["ClassId"]);
                            cityId    = Convert.ToInt32(student.Rows[0]["CityId"]);
                            studentId = Convert.ToInt32(student.Rows[0]["StudentId"]);
                        }
                    }

                    studInfo = objStudent.GetMyProfileInfo(studentId);
                    schoolId = Convert.ToInt32(studInfo.Rows[0]["SchoolId"]);
                    classId  = Convert.ToInt32(studInfo.Rows[0]["ClassId"]);



                    DataSet _dtStage = objStudent.GetCurrentStageInfo((studentId > 0 ? studentId : UserId),
                                                                      UserRoleId, classId);
                    if (_dtStage.Tables[0].Rows.Count > 0)
                    {
                        stagePlanId   = Convert.ToInt32(_dtStage.Tables[0].Rows[0]["StagePlanId"]);
                        stageDistance = Convert.ToDouble(_dtStage.Tables[0].Rows[0]["Distance"]);
                        distCovered   = double.Parse(_dtStage.Tables[0].Rows[0]["Distance_Covered"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                        //Convert.ToDouble(_dtStage.Tables[0].Rows[0]["Distance_Covered"]);
                    }

                    int res = objStudent.StudentsDeleteLastUpload(
                        UserRoleId, UserId,
                        0, studentId,
                        stagePlanId, stageDistance, distCovered, classId, 1);
                }
                else
                {
                    Console.WriteLine("Incorrect Username or Password");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("No last file found or internal server error occured, following are details : \n\n" + ex.Message);
            }
        }
Exemple #10
0
        public virtual void ComputeDynamicFields(PaymentAdvice parent)
        {
            ApasConfigurationManager cfg=new ApasConfigurationManager();

            decimal deviationTotal=0;

            PayableCredit=NextMonthCredit -Credit +CreditAdjustment;

            PayableFee=PerLessonFee*PayableCredit;

            foreach(FeeDeviationPayableFee objFD in FeeDeviations.Values)
            {
                //objFD returns exact amount. round it before adding to total
                deviationTotal += MyUtils.FormatCurrencyWithRounding(objFD.ComputeNetDeviation(PayableFee));
            }

            PayableFee += deviationTotal;

            PayableFee = MyUtils.FormatCurrencyWithRounding(PayableFee);

            //get Config paymentadvice Text template and fill PaymentAdviceText
            PaymentAdviceText = cfg.getConfigValue("PaymentAdviceTemplateCFee");

            BCStudent student = new BCStudent();
            student.Id = parent.IdStudent;
            student.loadData();

            ApasRegular regClass = GetAssociatedClass();

            PaymentAdviceText =
                PaymentAdviceText
                .Replace("[Name]", student.FullName)
                .Replace("[Subject]", regClass.GetSubject().name)
                .Replace("[Level]", regClass.getLevel().Name)
                .Replace("[Time Start]", regClass.TimeStart.ToString("hh:mm tt"))
                .Replace("[Time End]", regClass.TimeEnd.ToString("hh:mm tt"))
                .Replace("[Day]", regClass.Day)
                .Replace("[Absence]", Convert.ToString(Absence))
                .Replace("[Prorate]", Convert.ToString(Prorate))
                .Replace("[Makeup]", Convert.ToString(Makeup))
                .Replace("[Forfeit]", Convert.ToString(Forfeit))
                .Replace("[Credit]", Convert.ToString(Credit))
                .Replace("[Payable Credit]", Convert.ToString(PayableCredit))
                .Replace("[Next Mth Lessons]", Convert.ToString(NextMonthCredit))
                .Replace("[Credit Adjustment]", Convert.ToString(CreditAdjustment))
                .Replace("[Per Lesson Fee]", String.Format("{0:C}", PerLessonFee))
                .Replace("[Fee Deviation Total]", String.Format("{0:C}", deviationTotal))
                .Replace("[Payable Fee]", String.Format("{0:C}", PayableFee))
                .Replace("[Private Remarks]", PrivateRemark)
                .Replace("[Public Remarks]", PublicRemark)
                .Replace("[Month]", parent.GetParentPAList().Month.ToString("MMMM"))
                .Replace("[Year]", parent.GetParentPAList().Month.ToString("yyyy"));
        }
    protected void rptBreakdown_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        int clsId = ((BCClassSchedule)(e.Item.DataItem)).Id;
        string temp;

        BCRegular objRegular = new BCRegular();
        objRegular.Id = clsId;
        try
        {
            objRegular.LoadData();
        }
        catch (WebServiceException ex)
        {
            bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
            if (rethrow) throw;
            return;
        }

        //class description label
        //S4 P Chem Sun 1300 - 1430 (sample)
        Label lblClassDescription = (Label)(e.Item.FindControl("lblClassDescription"));
        temp = "{0} {1} {2} {3} - {4}";
        lblClassDescription.Text =
            String.Format(temp, objRegular.GetSubject().name, objRegular.getLevel().Name,
            objRegular.Day, objRegular.TimeStart.ToString("hh:mm tt"), objRegular.TimeEnd.ToString("hh:mm tt")
            );

        GridView grdPaymentHistory = (GridView)(e.Item.FindControl("grdPaymentHistory"));
        grdPaymentHistory.RowDataBound +=
          new GridViewRowEventHandler(grdPaymentHistory_RowDataBound);
        grdPaymentHistory.RowCreated +=
            new GridViewRowEventHandler(grdPaymentHistory_RowCreated);
        BCPayment[] aryBCPayment = BCPayment.getPaymentByStudentClass(
            Convert.ToInt32(hdnStudentId.Value),
            clsId);
        grdPaymentHistory.DataSource = aryBCPayment;
        grdPaymentHistory.DataBind();
        Label lblEmptyPH = (Label)(e.Item.FindControl("lblEmptyPaymentHistory"));
        lblEmptyPH.Visible = (aryBCPayment == null || aryBCPayment.Length == 0);

        GridView grdAttendanceHistory = (GridView)(e.Item.FindControl("grdAttendanceHistory"));
        grdAttendanceHistory.RowDataBound +=
            new GridViewRowEventHandler(grdAttendanceHistory_RowDataBound);
        grdAttendanceHistory.RowCreated +=
            new GridViewRowEventHandler(grdAttendanceHistory_RowCreated);
        wsvAttendanceLn.AttendanceLn dbAttln =
            new wsvAttendanceLn.AttendanceLn();
        wsvAttendanceLn.CAttendanceLn[] aryAttln =
            dbAttln.GetAttendanceByStudentClass(
            Convert.ToInt32(hdnStudentId.Value),
            clsId);
        grdAttendanceHistory.DataSource = aryAttln;
        grdAttendanceHistory.DataBind();
        Label lblEmptyAH = (Label)(e.Item.FindControl("lblEmptyAttendanceHistory"));
        lblEmptyAH.Visible = (aryAttln == null || aryAttln.Length == 0);

        GridView grdAbsenceSummary = (GridView)(e.Item.FindControl("grdAbsenceSummary"));
        grdAbsenceSummary.RowDataBound +=
            new GridViewRowEventHandler(grdAbsenceSummary_RowDataBound);
        grdAbsenceSummary.RowCreated +=
            new GridViewRowEventHandler(grdAbsenceSummary_RowCreated);
        BCStudent objStud = new BCStudent();
        objStud.Id = Convert.ToInt32(hdnStudentId.Value);
        DataSet dsReport = objStud.GenerateAttendanceSummaryReport(clsId, 2);
        grdAbsenceSummary.DataSource = dsReport;
        grdAbsenceSummary.DataBind();
        Label lblEmptyAS = (Label)(e.Item.FindControl("lblEmptyAbsenceSummary"));
        lblEmptyAS.Visible =
            (dsReport == null ||
            dsReport.Tables.Count == 0 ||
            dsReport.Tables[0].Rows.Count == 0);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /**
         * Access Control code
         * */

        //first time loading only
        if (Page.IsPostBack)
        {
            return;
        }

        //Mandatory query string
        if (String.IsNullOrEmpty(Request.QueryString["StudentID"]))
        {
            return;
        }

        //load student data
        hdnStudentId.Value = Request.QueryString["StudentID"];
        BCStudent objStudent = new BCStudent();
        try
        {
            objStudent.Id = Convert.ToInt32(hdnStudentId.Value);
            objStudent.loadData();
        }
        catch (WebServiceException ex)
        {
            /* error logging here */
            Response.Redirect("ManageStudentSearch.aspx");
            bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
            if (rethrow) throw;
            return;
        }

        //populate headers
        lblNRIC.Text = objStudent.NRIC;
        lblStudentName.Text = objStudent.FullName;
        lblDateofReport.Text = DateTime.Today.ToString("dd MMMM yyyy");

        //populate Summary gridview: grdSummary
        int[] clsIDs = retrieveClassIDsFromQueryString();
        List<BCClassSchedule> aryCls = new List<BCClassSchedule>();

        if (clsIDs != null)
        {
            foreach (int clsID in clsIDs)
            {
                BCClassSchedule objCls = new BCClassSchedule();
                objCls.Id = clsID;
                if (objStudent.hasThisClassSchedule(objCls,true))
                {
                    objCls.LoadData();
                    aryCls.Add(objCls);
                }
            }

        }

        grdSummary.DataSource = aryCls; //bind grdSummary
        grdSummary.DataBind();

        rptBreakdown.DataSource = aryCls; //bind detail breakdown
        rptBreakdown.DataBind();

        //populate DepositFee gridview
        wsvDepositFee.DepositFee dbDF = new wsvDepositFee.DepositFee();
        wsvDepositFee.CDepositFee[] aryDF =
            dbDF.GetDepositFeeByStudent(Convert.ToInt32(hdnStudentId.Value), wsvDepositFeePart.DFOption.OnlyUnDeleted);

        grdDesposits.DataSource = aryDF;
        grdDesposits.DataBind();
    }
Exemple #13
0
        public ApasStudentView ConvertStudent(BCStudent input)
        {
            ApasStudentView output = new ApasStudentView();

            output.BirthDate = input.BirthDate;
            output.ContactHome = input.ContactHome;
            output.ContactMobile = input.ContactMobile;
            try
            {
                output.Country = input.GetCountry().Name;
            }
            catch (WebServiceException ex)
            {
                output.Country = "";
                bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
                if (rethrow) throw;
            }

            output.DateTerminated = input.DateTerminated;
            output.Email = input.Email;
            output.EnrolmentDate = input.EnrolmentDate;
            output.Friendster = input.Friendster;
            output.FullName = input.FullName;
            output.Gender = input.Gender;
            output.Guardian =
                ConvertGuardian(input.GetGuardian());
            output.Id = input.Id;
            output.IsActive = input.IsActive;
            output.MailingAddress = input.MailingAddress;
            output.NRIC = input.MailingAddress;
            output.PersonalURL = input.PersonalURL;
            output.PostalCode = input.PostalCode;
            output.Remark = input.Remark;
            try
            {
                output.School = input.GetSchool().Name;

            }
            catch (WebServiceException ex)
            {
                output.School = "";
                bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
                if (rethrow) throw;
            }

            return output;
        }