Beispiel #1
0
    protected HomestayStudentBasic StudentRequest(int HomestayStudentId)
    {
        var cHomestayStudentBasic    = new CHomestayStudentRequest();
        HomestayStudentBasic Student = cHomestayStudentBasic.GetHomestayStudentRequest(HomestayStudentId);

        return(Student);
    }
Beispiel #2
0
    protected void UpdateToolBar_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
    {
        if (HomestayStudentId > 0)
        {
            if (UpdateToolBar.TabIndex == 0)
            {
                HomestayStudentBasic Request = StudentRequest(HomestayStudentId);
                int StudentId = Convert.ToInt32(Request.StudentId);
                if (Grid_HostList.SelectedValue != null)
                {
                    int HostId = Convert.ToInt32(Grid_HostList.SelectedValue);

                    if (Grid_HostRoom.SelectedValue != null)
                    {
                        int RoomId = Convert.ToInt32(Grid_HostRoom.SelectedValue);
                        if (Grid_HostBed.SelectedValue != null)
                        {
                            int BedId = Convert.ToInt32(Grid_HostBed.SelectedValue);
                            //Homestay Placement

                            int AddResult               = 0;
                            var cHomestayPlacement      = new CHomestayPlacement();
                            HomestayPlacement Placement = new HomestayPlacement();
                            Placement.StudentBasicId   = HomestayStudentId;
                            Placement.StudentId        = StudentId;
                            Placement.HostId           = HostId;
                            Placement.RoomId           = RoomId;
                            Placement.BedId            = BedId;
                            Placement.HomestayAgencyId = 0;
                            Placement.StartDate        = Request.StartDate;
                            Placement.EndDate          = Request.EndDate;
                            Placement.PlacementStatus  = 1; //  Placed=1, Canceled =0, Schedule Change=2
                            Placement.PlacementType    = 1; // Placed by School=1, Place by Agency =2
                            Placement.CreatedDate      = DateTime.Now;
                            Placement.CreatedId        = CurrentUserId;
                            Placement.UpdatedDate      = DateTime.Now;
                            Placement.UpdatedId        = CurrentUserId;
                            AddResult = cHomestayPlacement.Add(Placement);

                            if (AddResult > 0)
                            {
                                var cRequest = new CHomestayStudentRequest();

                                UpdateHomestayStudentStatus(HomestayStudentId, 2); //Placed By School
                                RunClientScript("Close();");
                                ShowMessage("Homestay Placement Request has been placed successfully.");
                            }
                            else //Failed
                            {
                                ShowMessage("Failed to add Homestay Placement Request, Please try it again.");
                            }
                        }
                    }
                }
            }
        }
    }
Beispiel #3
0
    protected HomestayStudentBasic GetFormData(HomestayStudentBasic Student)
    {
        //Airpot Information
        Student.PickUp            = Convert.ToInt32(ddl_pickup.SelectedValue.ToString());
        Student.ArrivalDate       = DatePickArrivalDate.SelectedDate;
        Student.ArriveTime        = TimePickerArrivalTime.SelectedTime;
        Student.ArrivalAirLine    = txtArrivalAirLine.Text.ToString().Trim();
        Student.ArrivalFlightNo   = txtArrivalFlilghtNo.Text.ToString().Trim();
        Student.DepartingFrom     = txtDepartingFrom.Text.ToString().Trim();
        Student.DropOff           = Convert.ToInt32(ddlDropoff.SelectedValue.ToString());
        Student.DepartureDate     = DatePicker_DepartureDate.SelectedDate;
        Student.DepartureTime     = TimePickerDepartureTime.SelectedTime;
        Student.DepartureAirLine  = txtDepartureAirline.Text.ToString().Trim();
        Student.DepartureFlightNo = txtDepartureFlightNo.Text.ToString().Trim();
        Student.LeavingFrom       = txtLeavingFrom.Text.ToString().Trim();

        //Preference
        Student.Smoking          = Convert.ToInt32(ddlSmoking.SelectedValue.ToString());
        Student.Internet         = Convert.ToInt32(ddlInternet.SelectedValue.ToString());
        Student.RoomType         = Convert.ToInt32(ddlRoomType.SelectedValue.ToString());
        Student.MealType         = Convert.ToInt32(ddlMealType.SelectedValue.ToString());
        Student.GuardianRequired = Convert.ToInt32(ddlGuardian.SelectedValue.ToString());
        Student.Pet        = Convert.ToInt32(ddlPet.SelectedValue.ToString());
        Student.Children   = Convert.ToInt32(ddlChildren.SelectedValue.ToString());
        Student.Medication = txtMedication.Text.ToString().Trim();
        Student.Diet       = txtDiet.Text.ToString().Trim();

        //General Information
        Student.StartDate     = DatePickerStartDate.SelectedDate;
        Student.EndDate       = DatePickerEndDate.SelectedDate;
        Student.ExtensionFlag = Convert.ToInt32(ddlExtention.SelectedValue.ToString());
        int Weeks    = 0;
        int ExtraDay = 0;

        if (TxtHomestayWeeks.Text.ToString().Trim().Length > 0)
        {
            Weeks = Convert.ToInt32(TxtHomestayWeeks.Text.ToString());
        }
        if (TxtExtraDays.Text.ToString().Length > 0)
        {
            ExtraDay = Convert.ToInt32(TxtExtraDays.Text.ToString());
        }
        Student.HomestayWeeks = Weeks;
        Student.ExtraDays     = ExtraDay;


        Student.UrgentRequest = Convert.ToInt32(ddlUrgent.SelectedValue.ToString());
        Student.AllergyType   = Convert.ToInt32(ddlAllergy.SelectedValue.ToString());
        Student.AllergyNote   = txtAllergyType.Text.ToString();
        Student.Comments      = txtComments.Text;
        Student.PlacedUserId  = 0;
        Student.StudentId     = Convert.ToInt32(ddlStudent.SelectedValue);


        return(Student);
    }
Beispiel #4
0
 protected void Grid_HostList_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     if (HomestayStudentId > 0)
     {
         HomestayStudentBasic Student   = StudentRequest(HomestayStudentId);
         DateTime             StartDate = Convert.ToDateTime(Student.StartDate);
         DateTime             EndDate   = Convert.ToDateTime(Student.EndDate);
         var cHomestayBasic             = new CHomestayHostBasic();
         Grid_HostList.DataSource = cHomestayBasic.HomestayHostListWithVacantBed(CurrentSiteLocationId, StartDate, EndDate);
         //cHomestayBasic.GetHomestayHostActiveList(CurrentSiteLocationId, StartDate,EndDate);
     }
 }
Beispiel #5
0
    protected int GetStudentId(int HomestayStudentId)
    {
        int StudentId = 0;

        if (HomestayStudentId > 0)
        {
            var cHomestayStudent = new CHomestayStudentRequest();
            HomestayStudentBasic StudentBasic = cHomestayStudent.GetHomestayStudentRequest(HomestayStudentId);
            StudentId = Convert.ToInt32(StudentBasic.StudentId);
        }
        return(StudentId);
    }
Beispiel #6
0
    protected void Grid_HostBed_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        if (Grid_HostList.SelectedValue != null && Grid_HostRoom.SelectedValue != null)
        {
            var cHomestayHosBed          = new CHomestayHostBasic();
            int hostid                   = Convert.ToInt32(Grid_HostList.SelectedValue.ToString());
            int roomid                   = Convert.ToInt32(Grid_HostRoom.SelectedValue.ToString());
            HomestayStudentBasic Student = StudentRequest(HomestayStudentId);
            Grid_HostBed.DataSource = cHomestayHosBed.HomestayBedListWithVacantBed(hostid, roomid, Convert.ToDateTime(Student.StartDate), Convert.ToDateTime(Student.EndDate));

            // cHomestayHostBed.HomestayHostBedByRoom(hostid, roomid);
            Grid_HostBed.Visible = true;
        }
    }
Beispiel #7
0
 protected void Grid_HostRoom_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
 {
     if (Grid_HostList.SelectedValue != null)
     {
         int hostId = 0;
         hostId = Convert.ToInt32(Grid_HostList.SelectedValue.ToString());
         List <HomestayHostRoom> HostRoom = new List <HomestayHostRoom>();
         var cHomestayHostRoom            = new CHomestayHostBasic();
         HomestayStudentBasic Student     = StudentRequest(HomestayStudentId);
         HostRoom = cHomestayHostRoom.HomestayRoomListWithVacantBed(hostId, Convert.ToDateTime(Student.StartDate), Convert.ToDateTime(Student.EndDate));
         //cHomestayHostRoom.GetHostRoomList(hostId);
         Grid_HostRoom.DataSource = HostRoom;
     }
 }
Beispiel #8
0
    protected void GridHistory_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        if (Grid_StudentList.SelectedValue != null)
        {
            int userid            = CurrentUserId;
            int StudentId         = 0;
            int HomestayStudentId = Convert.ToInt32(Grid_StudentList.SelectedValue);

            var cHomestayStudent         = new CHomestayStudentRequest();
            HomestayStudentBasic Student = cHomestayStudent.GetHomestayStudentRequest(HomestayStudentId);
            StudentId = Convert.ToInt32(Student.StudentId);
            if (StudentId > 0)
            {
                GridHistory.DataSource = cHomestayStudent.GetHomestayStudentHistoryList(CurrentSiteLocationId, StudentId, HomestayStudentId);
            }
        }
    }
Beispiel #9
0
    public bool UpdateHomestayStudentStatus(int HomestayStudentId, int Status)
    {
        //Requested=1, Placed by School=2, Placed by Agency =3, Canceled =6,Schedule Changed=5,Rejected 7
        bool updateStatus       = false;
        var  cHomestayStudent   = new CHomestayStudentRequest();
        HomestayStudentBasic HS = cHomestayStudent.GetHomestayStudentRequest(HomestayStudentId);

        HS.HomestayStudentStatus = Status;
        HS.UpdateUserId          = CurrentUserId;
        HS.UpdatedDate           = DateTime.Now;
        if (Status == 2 || Status == 3)
        {
            HS.PlacedUserId = CurrentUserId;
            HS.PlacedDate   = DateTime.Now;
        }
        updateStatus = cHomestayStudent.Update(HS);

        return(updateStatus);
    }
Beispiel #10
0
    protected void ShowPlacementRequestDetail(int HomestayStudentId)
    {
        var cHomestayStudentBasic    = new CHomestayStudentRequest();
        HomestayStudentBasic Student = cHomestayStudentBasic.GetHomestayStudentRequest(HomestayStudentId);

        //Airpot Information

        ddl_pickup.SelectedValue           = Student.PickUp.ToString();
        DatePickArrivalDate.SelectedDate   = Student.ArrivalDate;
        TimePickerArrivalTime.SelectedTime = Student.ArriveTime;
        txtArrivalAirLine.Text             = Student.ArrivalAirLine;
        txtArrivalFlilghtNo.Text           = Student.ArrivalFlightNo;
        txtDepartingFrom.Text    = Student.DepartingFrom;
        ddlDropoff.SelectedValue = Student.DropOff.ToString();
        DatePicker_DepartureDate.SelectedDate = Student.DepartureDate;
        TimePickerDepartureTime.SelectedTime  = Student.DepartureTime;
        txtDepartureAirline.Text  = Student.DepartureAirLine;
        txtDepartureFlightNo.Text = Student.DepartureFlightNo;
        txtLeavingFrom.Text       = Student.LeavingFrom;

        //Preference
        ddlSmoking.SelectedValue  = Student.Smoking.ToString();
        ddlInternet.SelectedValue = Student.Internet.ToString();
        ddlRoomType.SelectedValue = Student.RoomType.ToString();
        ddlMealType.SelectedValue = Student.MealType.ToString();
        ddlGuardian.SelectedValue = Student.GuardianRequired.ToString();
        ddlPet.SelectedValue      = Student.Pet.ToString();
        ddlChildren.SelectedValue = Student.Children.ToString();
        txtMedication.Text        = Student.Medication;
        txtDiet.Text = Student.Diet;

        //General Information
        DatePickerStartDate.SelectedDate = Student.StartDate;
        DatePickerEndDate.SelectedDate   = Student.EndDate;

        ddlExtention.SelectedValue = Student.ExtensionFlag.ToString();

        int Weeks    = Convert.ToInt32(Student.HomestayWeeks);
        int ExtraDay = Convert.ToInt32(Student.ExtraDays);



        if (Weeks == 0)
        {
            TxtHomestayWeeks.Text = "";
        }
        else
        {
            TxtHomestayWeeks.Text = Weeks.ToString();
        }

        if (ExtraDay == 0)
        {
            TxtExtraDays.Text = "";
        }
        else
        {
            TxtExtraDays.Text = ExtraDay.ToString();
        }
        if (ExtraDay == 7)
        {
            Weeks = Weeks + 1;
            TxtHomestayWeeks.Text = Weeks.ToString();
            TxtExtraDays.Text     = "0";
        }


        ddlUrgent.SelectedValue  = Student.UrgentRequest.ToString();
        ddlAllergy.SelectedValue = Student.AllergyType.ToString();
        txtAllergyType.Text      = Student.AllergyNote;
        txtComments.Text         = Student.Comments;
        //File Upload
        file_upload.GetFileDownload(Convert.ToInt32(HomestayStudentId));
        Dropdown_StudentlList(Convert.ToInt32(Student.StudentId)); // Load Student List
    }
Beispiel #11
0
    protected void UpdateToolBar_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
    {
        if (HomestayStudentId > 0)
        {
            int Status = 0;
            switch (e.Item.Text)
            {
            case "Accepted":
                Status = 1;     //Accepted
                break;

            case "Cancelled:":
                Status = 0;     //Cancelled
                break;

            case "Rejected":
                Status = 3;     //Rejected
                break;

            default:
                Status = 0;
                break;
            }
            if (e.Item.Text != "Close Window")
            {
                HomestayStudentBasic Request = StudentRequest(HomestayStudentId);
                int StudentId = Convert.ToInt32(Request.StudentId);


                int AddResult               = 0;
                var cHomestayPlacement      = new CHomestayPlacement();
                HomestayPlacement Placement = new HomestayPlacement();
                Placement.StudentBasicId   = HomestayStudentId;
                Placement.StudentId        = StudentId;
                Placement.HostId           = 0;
                Placement.RoomId           = 0;
                Placement.BedId            = 0;
                Placement.HomestayAgencyId = 0;
                Placement.StartDate        = Request.StartDate;
                Placement.EndDate          = Request.EndDate;

                Placement.PlacementStatus = Status; //  Accepted=1, Canceled =0, Rejected:3, Schedule Change=2

                Placement.PlacementComment = txt_Comment.Text;
                Placement.PlacementType    = 2; // Placed by School=1, Place by Agency =2
                Placement.CreatedDate      = DateTime.Now;
                Placement.CreatedId        = CurrentUserId;
                Placement.UpdatedDate      = DateTime.Now;
                Placement.UpdatedId        = CurrentUserId;
                Placement.HomestayAgencyId = CurrentUserId;
                file_upload.GetFileDownload(Convert.ToInt32(HomestayStudentId));

                if (cHomestayPlacement.CountPlacementbyBasicId(HomestayStudentId) == 0)
                {
                    AddResult = cHomestayPlacement.Add(Placement);
                }
                else
                {
                    HomestayPlacement UpdatePlacement = cHomestayPlacement.GetByStudentBasicId(HomestayStudentId);
                    UpdatePlacement.PlacementStatus  = Status;
                    UpdatePlacement.PlacementComment = txt_Comment.Text;
                    UpdatePlacement.UpdatedDate      = DateTime.Now;
                    UpdatePlacement.UpdatedId        = CurrentUserId;
                    cHomestayPlacement.Update(UpdatePlacement);
                }


                file_upload.SaveFile(HomestayStudentId);
                // in HomestayBasic table
                int BasicStatus = 0;
                switch (Status)
                {
                case 0:
                    BasicStatus = 6;        // Cancelled by Agency
                    break;

                case 1:
                    BasicStatus = 3;         //Placed By Agency
                    break;

                case 3:
                    BasicStatus = 7;         //Rejected by Agency
                    break;

                default:
                    break;
                }
                UpdateHomestayStudentStatus(HomestayStudentId, BasicStatus);

                RunClientScript("Close();");
                ShowMessage("Homestay Placement Request has been updated successfully.");
            }
        }
    }
Beispiel #12
0
    protected void UpdateStudentRegistar()
    {
        if (Request["id"] != null)
        {
            int HomestayStudentId       = Id;
            var cHomestayStudentRequest = new CHomestayStudentRequest();

            if (ScheduleChange == 0)
            {
                if (HomestayStudentId == 0) //New Registrar
                {
                    int AddResult = 0;
                    HomestayStudentBasic Student = new HomestayStudentBasic();

                    //Retrive Data from Form
                    Student = GetFormData(Student);
                    //Homestay Status
                    Student.HomestayStudentStatus = 0; //Pending=0, Requested=1, Placed by School=2, Placed by Agency =3, Canceled =4
                    Student.CreatedDate           = DateTime.Now;
                    Student.CreatedUserId         = CurrentUserId;
                    AddResult = cHomestayStudentRequest.Add(Student);
                    if (AddResult > 0)
                    {
                        file_upload.SaveFile(AddResult);
                        //  GenerateInvoice(AddResult, (int)CConstValue.InvoiceType.Homestay);
                        RunClientScript("Close();");
                        ShowMessage("Added a new homestay registar and Generated an invoice successfully.");
                    }
                    else //Failed
                    {
                        ShowMessage("Failed to add a new homestay registar, Please try it again.");
                    }
                }
                else //Update Registrar
                {
                    bool UpdateResult = false;
                    HomestayStudentBasic UpdateStudent = cHomestayStudentRequest.GetHomestayStudentRequest(HomestayStudentId);
                    // Retrive Data from From
                    UpdateStudent = GetFormData(UpdateStudent);

                    UpdateStudent.HomestayStudentStatus = 1; //Requested

                    UpdateStudent.UpdateUserId = CurrentUserId;
                    UpdateStudent.UpdatedDate  = DateTime.Now;
                    UpdateResult = cHomestayStudentRequest.Update(UpdateStudent);
                    int InvoiceId = 0;
                    var cInvoice  = new CInvoice();
                    InvoiceId = cInvoice.GetInvoiceIdbyHomestayStudentId(HomestayStudentId);

                    if (InvoiceId == 0)
                    {
                        GenerateInvoice(HomestayStudentId, (int)CConstValue.InvoiceType.Homestay);  //Generate Invoice
                    }


                    file_upload.SaveFile(UpdateStudent.HomestayStudentId);

                    if (UpdateResult)
                    {
                        RunClientScript("Close();");
                        ShowMessage("Requested Homestay Registar successfully.");
                    }
                    else //Failed
                    {
                        ShowMessage("Failed to update Homestay Registrar, please try it again.");
                    }
                }
            }
            else  //Schedule Change: New Homestay Replacement Request
            {
                //int SCResult = 0;
                //HomestayStudentBasic StudentBasic = new HomestayStudentBasic();

                ////Retrive Data from Form
                //StudentBasic = GetFormData(StudentBasic);
                ////Homestay Status
                //StudentBasic.HomestayStudentStatus = 1; //Requested=1, Placed by School=2, Placed by Agency =3, Canceled =4, Schedule Change=5
                //StudentBasic.CreatedDate = DateTime.Now;
                //StudentBasic.CreatedUserId = CurrentUserId;
                //SCResult = cHomestayStudentRequest.Add(StudentBasic);
                //if (SCResult > 0)
                //{
                //    file_upload.SaveFile(SCResult);
                //    GenerateInvoice(SCResult, 16);
                //    var cHomestayCancleSheduleChange = new CHomestayCancelSheduleChange();
                //    HomestayCancelScheduleChange Cancel = new HomestayCancelScheduleChange();
                //    Cancel.CancellationDate = DateTime.MaxValue;
                //    Cancel.Comment = txtScheduleComment.Text;
                //    Cancel.ChangeType = 2; // 1=Cancel, 2=Schedule Change
                //    Cancel.OriginalStudentBasicId = Convert.ToInt32(Request["Id"]);
                //    Cancel.NewStudentBasicId = SCResult;
                //    Cancel.RequestStatus = 0; //0=Pending, 1=Rejected, 2=Approved
                //    Cancel.CreatedDate = DateTime.Now;
                //    Cancel.CreatedId = CurrentUserId;
                //    Cancel.UpdatedDate = DateTime.Now;
                //    Cancel.UpdatedId = CurrentUserId;

                //    int result = 0;
                //    result = cHomestayCancleSheduleChange.Add(Cancel);
                //    Grid_ChangeList.Rebind();
                //    ShowMessage("Homestay Schedule Change are added and Generated an invoice successfully.");
                //}
                //else //Failed
                //{
                //    ShowMessage("Failed to Add Schedule Change, Please try it again.");

                //}
                //Wait for Jun's Schedule Change Invoice Function
                //Update Student Request Status: Schedule Change
                //Release Homestay Placement (Host Bed)
            }
        }
    }