protected void tbTransferDate_SelectedDateChanged(object sender, SelectedDateChangedEventArgs e) { var cInvoice = new CInvoice(); var qryInvoice = cInvoice.Get(InvoiceId); var cQryProRegi = new CProgramRegistration(); var qryProRegi = cQryProRegi.Get(Convert.ToInt32(qryInvoice.ProgramRegistrationId)); var TransferDate = Convert.ToDateTime(tbTransferDate.SelectedDate); var StartDate = Convert.ToDateTime(qryProRegi.StartDate); var EndDate = Convert.ToDateTime(qryProRegi.EndDate); var totalProgramDays = EndDate - StartDate; var totalTakenDays = new TimeSpan(); var totalTransferDays = new TimeSpan(); if (TransferDate <= StartDate) { totalTransferDays = totalProgramDays; } else { totalTakenDays = TransferDate - StartDate; totalTransferDays = totalProgramDays - totalTakenDays; } tbTotalDaysOfProgram.Value = Convert.ToInt32(totalProgramDays.Days); tbTotalTakenDays.Value = Convert.ToInt32(totalTakenDays.Days); tbTransferDays.Value = Convert.ToInt32(totalTransferDays.Days); }
protected void RadGridClassStudent_OnRowDrop(object sender, GridDragDropEventArgs e) { if (e.DraggedItems.Count != 0) { foreach (var dataItem in e.DraggedItems) { var sid = dataItem.GetDataKeyValue("ProgramClassStudentId").ToString(); var cProgramClassStudent = new CProgramClassStudent(); var programClassStudent = cProgramClassStudent.Get(Convert.ToInt32(sid)); var cStudent = new CStudent(); var student = cStudent.Get(programClassStudent.StudentId); var cProgramRegistration = new CProgramRegistration(); var programRegistration = cProgramRegistration.Get(programClassStudent.ProgramRegistrationId); if (programRegistration.EndDate < DateTime.Today) { ShowMessage("Move Failed : " + cStudent.GetStudentName(student) + "'s the End Date should not be earlier than today."); } else if (cProgramClassStudent.Delete(programClassStudent)) { ShowMessage("Moved successfuly : " + cStudent.GetStudentName(student)); } } refreshGrid(); } else { ShowMessage("Transfer Failed"); } }
protected void RadDatePickerEndDate_OnSelectedDateChanged(object sender, SelectedDateChangedEventArgs e) { var cInvoice = new CInvoice(); var invoiceInfo = cInvoice.Get(InvoiceId); var cProgramReg = new CProgramRegistration(); var ProReg = cProgramReg.Get(Convert.ToInt32(invoiceInfo.ProgramRegistrationId)); if (RadDatePickerEndDate.SelectedDate > ProReg.EndDate) { RadDatePickerEndDate.SelectedDate = ProReg.EndDate; } if (RadDatePickerStartDate != null) { if (RadDatePickerEndDate.SelectedDate < RadDatePickerStartDate.SelectedDate) { RadDatePickerEndDate.SelectedDate = RadDatePickerStartDate.SelectedDate; RadNumericTextBoxBreakDays.Value = 1; } else { var days = new TimeSpan(); days = Convert.ToDateTime(RadDatePickerEndDate.SelectedDate) - Convert.ToDateTime(RadDatePickerStartDate.SelectedDate); RadNumericTextBoxBreakDays.Value = Convert.ToInt32(days.Days) + 1; } } else { RadDatePickerStartDate.SelectedDate = RadDatePickerEndDate.SelectedDate; RadNumericTextBoxBreakDays.Value = 1; } UpdatedEndDate(); }
protected void RadComboBoxWeeks_OnSelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { if (RadDatePickerStartDate.SelectedDate != null) { var weeks = Convert.ToInt32(e.Value); var start = Convert.ToDateTime(RadDatePickerStartDate.SelectedDate); RadDatePickerEndDate.SelectedDate = CProgramRegistration.GetEndDate(start, weeks); } }
public RCertification(int invoiceId) { // // Required for telerik Reporting designer support // InitializeComponent(); var invoice = new CInvoice().Get(invoiceId); if (invoice?.ProgramRegistrationId == null) { return; } var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId); if (programRegistration == null) { return; } var cStudent = new CStudent(); var student = cStudent.Get((int)invoice.StudentId); if (student == null) { return; } var program = new CProgram().Get(programRegistration.ProgramId); var siteLocation = new CSiteLocation().Get(student.SiteLocationId); var site = new CSite().Get(siteLocation.SiteId); var weeks = programRegistration.Weeks == null ? string.Empty : programRegistration.Weeks + " weeks"; var programDescription = program.ProgramFullName + (programRegistration.HrsStatus != null ? $"({programRegistration.HrsStatus}/week)" : string.Empty) + " Program"; htmlTextBoxBody.Value = $@"This Certification awarded to<br> <b>{cStudent.GetStudentFullName(student)}</b><br> for successfully completing {weeks} in the<br> <b>{programDescription}</b><br> at {site.Name}, {siteLocation.Name}, ON, Canada"; htmlTextBoxDate.Value = $"Dated : <b>{DateTime.Today.ToString("MM-dd-yy")}</b>"; try { var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign); if (signPath != string.Empty) { pictureBoxSign.Value = Image.FromFile(signPath); } } catch (Exception ex) { Debug.Print(ex.Message); } }
protected void ddlProgramWeeks_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { var weeks = Convert.ToInt32(e.Value); var start = Convert.ToDateTime(tbPrgStartDate.SelectedDate); tbPrgEndDate.SelectedDate = CProgramRegistration.GetEndDate(start, weeks); tbPrgEndDate.Enabled = true; ddlPrgHours.Enabled = true; }
private void CalRefundDate() { var refundDate = Convert.ToDateTime(RadDatePickerActualDate.SelectedDate); //if (RefundDate < RequestDate) // tbRefundDate.SelectedDate = RequestDate; var cInvoice = new CInvoice(); var invoice = cInvoice.Get(InvoiceId); DateTime startDate = DateTime.Now; DateTime endDate = DateTime.Now; // Program if (invoice.ProgramRegistrationId != null) { var cProgramRegiInfo = new CProgramRegistration(); var programRegiInfo = cProgramRegiInfo.Get(Convert.ToInt32(invoice.ProgramRegistrationId)); startDate = Convert.ToDateTime(programRegiInfo.StartDate); endDate = Convert.ToDateTime(programRegiInfo.EndDate); } // Homestay else if (invoice.HomestayRegistrationId != null) { var cHomestayPlacement = new CHomestayPlacement(); var homestayStudentRequest = cHomestayPlacement.GetByStudentBasicId(Convert.ToInt32(invoice.HomestayRegistrationId)); startDate = Convert.ToDateTime(homestayStudentRequest.StartDate); endDate = Convert.ToDateTime(homestayStudentRequest.EndDate); } // Dormitory else if (invoice.DormitoryRegistrationId != null) { var cDormitoryPlacement = new CDormitoryPlacement(); var programRegiInfo = cDormitoryPlacement.GetByStudentBasicId(Convert.ToInt32(invoice.DormitoryRegistrationId)); startDate = Convert.ToDateTime(programRegiInfo.StartDate); endDate = Convert.ToDateTime(programRegiInfo.EndDate); } if (refundDate < startDate) { RadNumericTextBoxRefundRate.Value = 100; } else { ////////////////////////////////////////// //Refund Policy Method Call ( CRefund.cs ) ////////////////////////////////////////// var refundData = new CRefund(); var rates = refundData.RefundPolicy(startDate, endDate, refundDate, CurrentSiteLocationId); RadNumericTextBoxRefundRate.Value = rates[0]; var studyRate = rates[1] > 100 ? 100 : rates[1]; RadNumericTextBoxStudyRate.Value = studyRate; } }
protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Request": if (IsValid) { var cInvoice = new CInvoice(); var original = cInvoice.Get(InvoiceId); if (original != null) { original.Status = (int)CConstValue.InvoiceStatus.Cancelled_CC; original.UpdatedId = CurrentUserId; if (cInvoice.Update(original)) { var cCancel = new CCancel(); var cancel = new Cancel(); cancel.InvoiceId = original.InvoiceId; cancel.ApplyDate = RadDatePickerApply.SelectedDate.Value; cancel.Reason = RadTextBoxReason.Text; cancel.IsActive = true; cancel.CreatedId = CurrentUserId; int cancelId = cCancel.Add(cancel); if (cancelId > 0) { // save uploading file FileDownloadList1.SaveFile(cancelId); // Program if (original.ProgramRegistrationId != null) { var cProgramRegiInfo = new CProgramRegistration(); var programRegiInfo = cProgramRegiInfo.Get(Convert.ToInt32(original.ProgramRegistrationId)); programRegiInfo.UpdatedId = CurrentUserId; programRegiInfo.UpdatedDate = DateTime.Now; programRegiInfo.ProgramRegistrationType = 12; // cancel cProgramRegiInfo.Update(programRegiInfo); } // Homestay else if (original.HomestayRegistrationId != null) { var cHomestayStudentRequest = new CHomestayStudentRequest(); var homestayStudentRequest = cHomestayStudentRequest.GetHomestayStudentRequest(Convert.ToInt32(original.HomestayRegistrationId)); homestayStudentRequest.UpdateUserId = CurrentUserId; homestayStudentRequest.UpdatedDate = DateTime.Now; homestayStudentRequest.HomestayStudentStatus = 1; // cancel cHomestayStudentRequest.Update(homestayStudentRequest); } // Dormitory else if (original.DormitoryRegistrationId != null) { var cDormitoryStudentRequest = new CDormitoryRegistrations(); var dormitoryStudentRequest = cDormitoryStudentRequest.GetDormitoryStudentRequest(Convert.ToInt32(original.DormitoryRegistrationId)); dormitoryStudentRequest.DormitoryStudentStatus = 1; // cancel dormitoryStudentRequest.UpdatedId = CurrentUserId; dormitoryStudentRequest.UpdatedDate = DateTime.Now; cDormitoryStudentRequest.Update(dormitoryStudentRequest); } if (original.ScholarshipId != null) { var cScholarship = new CScholarship(); var scholarship = cScholarship.Get((int)original.ScholarshipId); if (scholarship != null) { scholarship.IsActive = true; cScholarship.Update(scholarship); } } RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Add Cancel)"); } } else { ShowMessage("failed to update inqury (Update Original Invoice)"); } } else { ShowMessage("failed to update inqury (Original Invoice is null)"); } } break; case "Close": RunClientScript("Close();"); break; } }
public RLetterOfAcceptanceInTable(int invoiceId) { // // Required for telerik Reporting designer support // InitializeComponent(); var invoice = new CInvoice().Get(invoiceId); if (invoice?.ProgramRegistrationId == null) { return; } var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId); if (programRegistration == null) { return; } var cStudent = new CStudent(); var student = cStudent.Get((int)invoice.StudentId); if (student == null) { return; } var program = new CProgram().Get(programRegistration.ProgramId); var siteLocation = new CSiteLocation().Get(student.SiteLocationId); var site = new CSite().Get(siteLocation.SiteId); textBoxDLI.Value = $@"Designated learning institution number (DLI #) : {"O19375754382"}"; textBoxDateOfIssue.Value = $@"Date of Issue : {DateTime.Today.ToString("MM-dd-yy")}"; htmlTextBoxFaimlyName.Value = $@"1. Family Name : <br><b>{student.LastName1}</b>"; htmlTextBoxFirstName.Value = $@"2. First Name and Initials : <br><b>{student.FirstName}</b>"; htmlTextBoxDateOfBirth.Value = $@"3. Date of Birth : <br><b>{student.DOB?.ToString("MM-dd-yy")}</b>"; htmlTextBoxStudentId.Value = $@"4. Student ID Number : <br><b>{student.StudentNo}</b>"; htmlTextBoxStudentFull.Value = $@"5. Student Full Mailing Address : <br><b>{student.Address1InCanada}</b>"; htmlTextBoxDates.Value = $@"6. Dates : <br>Start Date : <b>{programRegistration.StartDate?.ToString("MM-dd-yy")}</b><br>Completion Date : <b>{programRegistration.EndDate?.ToString("MM-dd-yy")}</b>"; htmlTextBoxNameOfSchool.Value = $@"7. Name of School/Institution(include public or private) : <br><b>{site.Name}</b>"; htmlTextBoxLevelOfStudy.Value = $@"8. Level of Study : <br><b>{"N/A"}</b>"; htmlTextBoxProgram.Value = $@"9. Program/Major/Course : <br><b>{program.ProgramFullName + " " + (programRegistration.HrsStatus == null ? string.Empty : "(" + programRegistration.HrsStatus + "/week)")}</b>"; htmlTextBoxHoursOfInstruction.Value = $@"10. Hours of Instruction per Week : <br><b>{programRegistration.Weeks}</b>"; htmlTextBoxAcademicYear.Value = $@"11. Academic Year of Study which the student will enter (e.g., Year 2 of 3 Year Program)<br><b>{"N/A"}</b>"; htmlTextBoxLateRegistrationDate.Value = $@"12. Late Registration Date : <br><b>{"N/A"}</b>"; var vwStudentContract = new CStudent().GetVwStudentContract(invoiceId); var isFullPayment = false; if (vwStudentContract?.DepositConfirmCnt == vwStudentContract?.PaymentCnt && vwStudentContract.Balance == 0) { isFullPayment = true; } htmlTextBoxConditionOfAcceptance.Value = $@"13. Condition of Acceptance : (must be paid in full at least 2 weeks before start date)<br><b>{(isFullPayment ? "Full Fee Payment" : "Not fully Fee Payment")}</b>"; var invoiceItemList = new CInvoiceItem().GetInvoiceItems(invoiceId); var tuitionFee = invoiceItemList.FirstOrDefault(x => x.InvoiceCoaItemId == (int)CConstValue.InvoiceCoaItem.TuitionBasic); htmlTextBoxEstimatedTuitionFees.Value = $@"14. Estimated Tuition Fees : (not including homestay accommodation fee)<br>Tuition Fee : <b>${tuitionFee}</b>"; string scholarshipMasterNo = string.Empty; if (invoice.ScholarshipId != null) { scholarshipMasterNo = new CScholarship().Get((int)invoice.ScholarshipId)?.ScholarshipMasterNo; } htmlTextBoxScholarship.Value = $@"15. Scholarship/Teaching Assistantship: <br><b>{scholarshipMasterNo}</b>"; htmlTextBoxExchangeStudent.Value = $@"16. Exchange Student (yes/no) : <br><b>{"No"}</b>"; htmlTextBoxLicensingInformation.Value = $@"17. Licensing Information where applicable for Private Institution (yes/no/not applicable): <br><b>{"N/A"}</b>"; htmlTextBoxIfDestinedForQuebec.Value = $@"18. If destined for Quebec, has CAQ information been sent to student (yes/no/not applicable) : <br><b>{"N/A"}</b>"; htmlTextBoxGuardianship.Value = $@"19. Guardianship/Custodianship details if applicable : <br><b>{"N/A"}</b>"; htmlTextBoxCredentials.Value = $@"20. Credentials : <br><b>{site.Name} Certificates and/or Diploma</b>"; htmlTextBoxRequirementsForSuccessful.Value = $@"21. Requirements for successful program completion : <br><b>{"70% grade and 85% attendance"}</b>"; htmlTextBoxSignatureOfInstitution.Value = $@"22. Signature of Institution Representative : <br>"; string name = string.Empty; string position = string.Empty; switch (siteLocation.SiteId) { // CAC case 2: name = "Christine Jang"; position = "Site Administrator"; break; default: name = string.Empty; position = string.Empty; break; } htmlTextBoxNameOfInstitution.Value = $@"23. Name of Institution Representative (please print) : <br><b>{name} - {position}</b>"; htmlTextBoxStudentSignature.Value = $@"24. Student's signature : <br><br><br><br><br>I have read and received a copy this contract and a copy of statement of the student's rights and responsibilities."; try { var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo); if (logoPath != string.Empty) { pictureBoxCompanyLogo.Value = Image.FromFile(logoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } try { var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign); if (signPath != string.Empty) { pictureBoxSign.Value = Image.FromFile(signPath); } } catch (Exception ex) { Debug.Print(ex.Message); } try { var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide); if (sideLogoPath != string.Empty) { pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } }
public static void SetFilterCheckListItems(GridFilterCheckListItemsRequestedEventArgs e) { object dataSource = null; string dataField = (e.Column as IGridDataColumn).GetActiveDataField(); switch (dataField) { // Common case "SiteName": dataSource = new CSite().GetSiteNameList(); break; case "SiteLocationName": dataSource = new CSiteLocation().GetSiteLocationNameList(); break; case "CountryName": dataSource = new CCountry().GetCountryNameList(); break; case "AgencyName": dataSource = new CAgency().GetAgencyNameList(); break; case "ProgramName": dataSource = new CProgram().GetProgramNameList(); break; case "InvoiceCoaItemId": dataSource = new CInvoiceCoaItem().GetInvoiceCoaItemIdNameList(); break; case "InvoiceName": dataSource = new CProgram().GetInvoiceNameList(); break; case "StudentName": dataSource = new CStudent().GetStudentNameList(); break; case "UserName": dataSource = new CUser().GetUserNameList(); break; case "Status": dataSource = new CApproval().GetStatusNameList(); break; case "ApprovalUserName": dataSource = new CUser().GetApprovalUserNameList(); break; case "InstructorName": dataSource = new CUser().GetInstructorNameList(); break; case "ProgramStatusName": dataSource = new CProgramRegistration().GetProgramStatusList(); break; // Dashboard case "Type": dataSource = new CApproval().GetApprovalTypeNameList(); break; // Invoice case "InvoiceType": dataSource = new CInvoice().GetInvoiceTypeList(); break; case "InvoiceStatus": dataSource = new CInvoice().GetInvoiceStatusList(); break; // Deposit case "DepositStatus": dataSource = new CDeposit().GetDepositStatusNameList(); break; case "DepositBank": dataSource = new CDeposit().GetDepositBankNameList(); break; case "PaidMethod": dataSource = new CDeposit().GetPaidMethodNameList(); break; case "ExtraTypeName": dataSource = new CDeposit().GetExtraTypeNameList(); break; // CreditMemo case "CreditMemoType": dataSource = new CCreditMemo().GetCreditMemoTypeNameList(); break; case "PayoutMethodName": dataSource = new CCreditMemoPayout().GetPayoutMethodNameList(); break; // Academic case "FacultyName": dataSource = new CFaculty().GetFacultyNameList(); break; case "ProgramGroupName": dataSource = new CProgramGroup().GetProgramGroupNameList(); break; // Vacation case "VacationType": dataSource = new CVacation().GetVacationTypeNameList(); break; // User case "CreatedUserName": dataSource = new CUser().GetCreatedUserNameList(); break; case "UpdatedUserName": dataSource = new CUser().GetUpdatedUserNameList(); break; case "PositionName": dataSource = new CUser().GetPositionNameList(); break; case "Email": dataSource = new CUser().GetEmailNameList(); break; case "LoginId": dataSource = new CUser().GetLoginIdNameList(); break; // PurchaseOrder case "PurchaseOrderTypeName": dataSource = new CPurchaseOrder().GetPurchaseOrderTypeNameList(); break; case "PriorityTypeName": dataSource = new CPurchaseOrder().GetPriorityTypeNameList(); break; case "ReviewTypeName": dataSource = new CPurchaseOrder().GetReviewTypeNameList(); break; ////Invoice# //case "SchoolName": // dataSource = new CSite().GetSiteNameList(); // break; // Inventory case "AssignedUserName": dataSource = new CUser().GetAssignedUserNameList(); break; case "InventoryCategoryName": dataSource = new CInventory().GetInventoryCategoryNameList(); break; case "InventoryCategoryItemName": dataSource = new CInventory().GetInventoryCategoryItemNameList(); break; case "ConditionName": dataSource = new CInventory().GetConditionNameList(); break; case "InUseName": dataSource = new CInventory().GetInUseNameList(); break; } if (dataSource != null) { SetFilter(e, dataField, dataSource); } }
protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == "Save") { if (IsValid) { if (!string.IsNullOrEmpty(ddlAgency.SelectedValue) && (tbCommissionRate.Value == 0 || tbCommissionRate.Value == null)) { ShowMessage("Commision Rate should be written."); return; } var cScholarship = new CScholarship(); if (ScholarshipId != null) { var scholarship = cScholarship.GetVwScholarship((int)ScholarshipId); if (RadButtonAvailableScholarshipAmount.Checked) { if (scholarship.AvailableAmount == 0 || (double)scholarship.AvailableAmount < RadNumericTextBoxScholarshipAmount.Value) { ShowMessage("Scholarship Amount is bigger than availalble Amount."); return; } } else { if (scholarship.AvailableWeeks == 0 || (double)scholarship.AvailableWeeks < RadNumericTextBoxScholarshipWeeks.Value) { ShowMessage("Scholarship Weeks are bigger than availalble Weeks."); return; } } } var cProgramReg = new CProgramRegistration(); var programReg = new ProgramRegistration(); programReg.StudentId = Id; programReg.ProgramId = Convert.ToInt32(ddlProgramName.SelectedValue); programReg.StartDate = tbPrgStartDate.SelectedDate; programReg.EndDate = tbPrgEndDate.SelectedDate; programReg.ProgramRegistrationType = 9; if (!string.IsNullOrEmpty(ddlProgramWeeks.SelectedValue)) { programReg.Weeks = Convert.ToInt32(ddlProgramWeeks.SelectedValue); } if (!string.IsNullOrEmpty(ddlPrgHours.SelectedValue)) { programReg.HrsStatus = Convert.ToInt32(ddlPrgHours.SelectedValue); } programReg.CreatedId = CurrentUserId; programReg.CreatedDate = DateTime.Now; var proRegId = cProgramReg.Add(programReg); //DB:ProgramRegistration if (proRegId > 0) { var cInvoice = new CInvoice(); var invoice = new Invoice(); invoice.ProgramRegistrationId = proRegId; invoice.StudentId = Id; if (!string.IsNullOrEmpty(ddlAgency.SelectedValue)) { invoice.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue); invoice.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked; invoice.AgencyRate = tbCommissionRate.Value; } if (ScholarshipId != null) { invoice.ScholarshipId = ScholarshipId; if (RadButtonAvailableScholarshipAmount.Checked) { invoice.ScholarshipAmount = (decimal)RadNumericTextBoxScholarshipAmount.Value; } else { invoice.ScholarshipAmount = (decimal)RadNumericTextBoxScholarshipAmount.Value; invoice.ScholarshipWeeks = (int)RadNumericTextBoxScholarshipWeeks.Value; } } invoice.PromotionId = PromotionId; invoice.SiteLocationId = CurrentSiteLocationId; invoice.InvoiceType = (int)CConstValue.InvoiceType.General; //General Invoice(IN) invoice.Status = (int)CConstValue.InvoiceStatus.Pending; // Pending invoice.CreatedId = CurrentUserId; invoice.CreatedDate = DateTime.Now; var invoiceId = cInvoice.Add(invoice); //DB:Invoice if (invoiceId > 0) { var cInvoiceItem = new CInvoiceItem(); foreach (GridDataItem item in _radGridInvoiceItems.Items) { var invoiceCoaItemId = (RadDropDownList)item.FindControl("ddlInvoiceItems"); var standardPrice = (Label)item.FindControl("lblStandardPrice"); var studentPrice = (Label)item.FindControl("lblStudentPrice"); var agencyPrice = (Label)item.FindControl("lblAgencyPrice"); var invoiceItem = new InvoiceItem(); invoiceItem.InvoiceId = invoiceId; invoiceItem.InvoiceCoaItemId = Convert.ToInt32(invoiceCoaItemId.SelectedValue); invoiceItem.StandardPrice = Convert.ToDecimal(standardPrice.Text.Replace("$", string.Empty)); invoiceItem.StudentPrice = Convert.ToDecimal(studentPrice.Text.Replace("$", string.Empty)); invoiceItem.AgencyPrice = Convert.ToDecimal(agencyPrice.Text.Replace("$", string.Empty)); invoiceItem.CreatedId = CurrentUserId; invoiceItem.CreatedDate = DateTime.Now; cInvoiceItem.Add(invoiceItem); } // disable used scholarship if (ScholarshipId != null) { var sScholarship = new CScholarship(); var scholarship = sScholarship.Get((int)ScholarshipId); scholarship.IsActive = true; sScholarship.Update(scholarship); } RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Add Invoice Items)"); } } else { ShowMessage("failed to update inqury (Invoice)"); } } } else { ShowMessage("Fill in data"); } }
protected int NewProgramInvoiceCreate() { var cProgRegInfo = new CProgramRegistration(); var programReg = new ProgramRegistration(); programReg.StudentId = 0; programReg.ProgramId = Convert.ToInt32(ddlProgramName.SelectedValue); programReg.StartDate = tbPrgStartDate.SelectedDate; programReg.EndDate = tbPrgEndDate.SelectedDate; programReg.Weeks = Convert.ToInt32(ddlProgramWeeks.SelectedValue); programReg.HrsStatus = Convert.ToInt32(ddlPrgHours.SelectedValue); var proRegId = cProgRegInfo.Add(programReg); //DB:ProgramRegistration if (proRegId > 0) { var cInvoice = new CInvoice(); var invoice = new Invoice(); invoice.ProgramRegistrationId = proRegId; invoice.StudentId = 0; invoice.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue); //invoice.ScholarshipId = Scholarship; invoice.SiteLocationId = CurrentSiteLocationId; invoice.InvoiceType = (int)CConstValue.InvoiceType.General; //General Invoice(IN) invoice.Status = (int)CConstValue.InvoiceStatus.Pending; // Pending invoice.CreatedId = CurrentUserId; invoice.CreatedDate = DateTime.Now; var invoiceId = cInvoice.Add(invoice); //DB:Invoice //if (invoiceId > 0) //{ // var cInvoiceItem = new CInvoiceItem(); // var invoiceItem = new InvoiceItem(); // invoiceItem.InvoiceId = invoiceId; // invoiceItem.InvoiceCoaItemId = 1; //1:Tuition // invoiceItem.StandardPrice = Convert.ToDecimal(tbPrgStandardTuition.Value); // invoiceItem.StudentPrice = Convert.ToDecimal(tbPrgTuition.Value); // invoiceItem.AgencyPrice = Convert.ToDecimal(tbPrgTuition.Value); // invoiceItem.CreatedId = CurrentUserId; // invoiceItem.CreatedDate = DateTime.Now; // if (cInvoiceItem.Add(invoiceItem) > 0) //DB:InvoiceItem(Tuition Item) // { // var standardTuitionId = Convert.ToInt32(ViewState["ProgramTuitionId"]); // var commission = Convert.ToDecimal(tbPrgTuition.Value) * Convert.ToDecimal(tbCommissionRate.Value) / 100; // if (commission > 0) // { // cInvoiceItem.CommissionAdd(invoiceId, commission, CurrentUserId); //DB:InvoiceItem(Commission-Tuition) // } // if (cInvoiceItem.ItemsAdd(invoiceId, standardTuitionId, CurrentUserId)) // //DB:InvoiceItem(Other Items) // { // return invoiceId; // } // ShowMessage("failed to update inqury (Add Invoice Items)"); // } // else // { // ShowMessage("failed to update inqury (Add Invoice Items)"); // } //} //else //{ // ShowMessage("failed to update inqury (Invoice)"); //} } else { ShowMessage("failed to update inqury (Program Registragion)"); } return(0); }
protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Request": if (IsValid) { var cInvoice = new CInvoice(); var original = cInvoice.Get(InvoiceId); if (original != null) { var startDate = DateTime.Today; var endDate = DateTime.Today; // Program if (original.ProgramRegistrationId != null) { var cProgramRegiInfo = new CProgramRegistration(); var programRegiInfo = cProgramRegiInfo.Get(Convert.ToInt32(original.ProgramRegistrationId)); startDate = programRegiInfo.StartDate.Value; endDate = programRegiInfo.EndDate.Value; programRegiInfo.StartDate = RadDatePickerStartDate.SelectedDate.Value; programRegiInfo.EndDate = RadDatePickerEndDate.SelectedDate.Value; programRegiInfo.UpdatedId = CurrentUserId; programRegiInfo.UpdatedDate = DateTime.Now; cProgramRegiInfo.Update(programRegiInfo); } // Homestay else if (original.HomestayRegistrationId != null) { var cHomestayStudentRequest = new CHomestayStudentRequest(); var homestayStudentRequest = cHomestayStudentRequest.GetHomestayStudentRequest(Convert.ToInt32(original.HomestayRegistrationId)); startDate = homestayStudentRequest.StartDate.Value; endDate = homestayStudentRequest.EndDate.Value; homestayStudentRequest.StartDate = RadDatePickerStartDate.SelectedDate.Value; homestayStudentRequest.EndDate = RadDatePickerEndDate.SelectedDate.Value; homestayStudentRequest.UpdateUserId = CurrentUserId; homestayStudentRequest.UpdatedDate = DateTime.Now; homestayStudentRequest.HomestayStudentStatus = 2; // scheduel Change cHomestayStudentRequest.Update(homestayStudentRequest); } // Dormitory else if (original.DormitoryRegistrationId != null) { var cDormitoryStudentRequest = new CDormitoryRegistrations(); var dormitoryStudentRequest = cDormitoryStudentRequest.GetDormitoryStudentRequest(Convert.ToInt32(original.DormitoryRegistrationId)); startDate = dormitoryStudentRequest.StartDate.Value; endDate = dormitoryStudentRequest.EndDate.Value; dormitoryStudentRequest.StartDate = RadDatePickerStartDate.SelectedDate.Value; dormitoryStudentRequest.EndDate = RadDatePickerEndDate.SelectedDate.Value; dormitoryStudentRequest.DormitoryStudentStatus = 2; // scheduel Change dormitoryStudentRequest.UpdatedId = CurrentUserId; dormitoryStudentRequest.UpdatedDate = DateTime.Now; cDormitoryStudentRequest.Update(dormitoryStudentRequest); } var cScheduleChange = new CScheduleChange(); var s = new ScheduleChange(); s.InvoiceId = original.InvoiceId; s.ApplyDate = RadDatePickerApplyDate.SelectedDate.Value; s.StartDate = startDate; s.EndDate = endDate; s.Reason = RadTextBoxReason.Text; s.IsActive = true; s.CreatedId = CurrentUserId; int scheduleChangeId = cScheduleChange.Add(s); if (scheduleChangeId > 0) { // save uploading file FileDownloadList1.SaveFile(scheduleChangeId); RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Add Schedule Change)"); } } else { ShowMessage("failed to update inqury (Original Invoice is null)"); } } break; case "Close": RunClientScript("Close();"); break; } }
protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Request": if (IsValid) { var cInvoice = new CInvoice(); var original = cInvoice.Get(InvoiceId); if (original != null) { var cBreak = new CBreak(); var b = new Break(); b.InvoiceId = original.InvoiceId; b.BreakStartDate = RadDatePickerStartDate.SelectedDate.Value; b.BreakEndDate = RadDatePickerEndDate.SelectedDate.Value; b.StartDate = RadDatePickerProgramStartDate.SelectedDate.Value; b.EndDate = RadDatePickerProgramEndDate.SelectedDate.Value; b.Reason = RadTextBoxReason.Text; b.IsActive = true; b.CreatedId = CurrentUserId; int breakId = cBreak.Add(b); if (breakId > 0) { // save uploading file FileDownloadList1.SaveFile(breakId); // Program if (original.ProgramRegistrationId != null) { var cProgramRegiInfo = new CProgramRegistration(); var programRegiInfo = cProgramRegiInfo.Get(Convert.ToInt32(original.ProgramRegistrationId)); programRegiInfo.EndDate = RadDatePickerProgramEndDate.SelectedDate.Value; programRegiInfo.UpdatedId = CurrentUserId; programRegiInfo.UpdatedDate = DateTime.Now; cProgramRegiInfo.Update(programRegiInfo); } // Homestay else if (original.HomestayRegistrationId != null) { var cHomestayPlacement = new CHomestayPlacement(); var homestayStudentRequest = cHomestayPlacement.GetByStudentBasicId(Convert.ToInt32(original.HomestayRegistrationId)); homestayStudentRequest.EndDate = RadDatePickerProgramEndDate.SelectedDate.Value; homestayStudentRequest.UpdatedId = CurrentUserId; homestayStudentRequest.UpdatedDate = DateTime.Now; cHomestayPlacement.Update(homestayStudentRequest); } // Dormitory else if (original.DormitoryRegistrationId != null) { var cDormitoryPlacement = new CDormitoryPlacement(); var dormitoryPlacement = cDormitoryPlacement.GetByStudentBasicId(Convert.ToInt32(original.DormitoryRegistrationId)); dormitoryPlacement.EndDate = RadDatePickerProgramEndDate.SelectedDate.Value; dormitoryPlacement.UpdatedId = CurrentUserId; dormitoryPlacement.UpdatedDate = DateTime.Now; cDormitoryPlacement.Update(dormitoryPlacement); } RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Add Break)"); } } else { ShowMessage("failed to update inqury (Original Invoice is null)"); } } break; case "Close": RunClientScript("Close();"); break; } }
protected void ToolbarButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == @"Save") { if (IsValid) { if (!string.IsNullOrEmpty(ddlAgency.SelectedValue) && (tbCommissionRate.Value == 0 || tbCommissionRate.Value == null)) { ShowMessage("Commision Rate should be written."); return; } var programId = Convert.ToInt32(ddlPackageProgram.SelectedValue.Split(',')[1]); var packageProgramId = Convert.ToInt32(ddlPackageProgram.SelectedValue.Split(',')[0]); var cProgramReg = new CProgramRegistration(); var programReg = new ProgramRegistration(); programReg.StudentId = Id; programReg.ProgramId = programId; programReg.PackageProgramId = packageProgramId; programReg.StartDate = tbPrgStartDate.SelectedDate; programReg.EndDate = tbPrgEndDate.SelectedDate; programReg.ProgramRegistrationType = 9; programReg.CreatedId = CurrentUserId; programReg.CreatedDate = DateTime.Now; var proRegId = cProgramReg.Add(programReg); //DB:ProgramRegistration if (proRegId > 0) { // add basic invoice first, then homestay or dormitory if exists. var cInvoice = new CInvoice(); var invoice = new Invoice(); invoice.ProgramRegistrationId = proRegId; invoice.StudentId = Id; if (!string.IsNullOrEmpty(ddlAgency.SelectedValue)) { invoice.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue); invoice.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked; invoice.AgencyRate = tbCommissionRate.Value; } invoice.SiteLocationId = CurrentSiteLocationId; invoice.InvoiceType = (int)CConstValue.InvoiceType.General; //General Invoice(IN) invoice.Status = (int)CConstValue.InvoiceStatus.Pending; // Pending invoice.CreatedId = CurrentUserId; invoice.CreatedDate = DateTime.Now; var invoiceId = cInvoice.Add(invoice); //DB:Invoice if (invoiceId > 0) { var invoiceItems = new List <InvoiceItem>(); var homestayInvoiceItems = new List <InvoiceItem>(); var dormitoryInvoiceItems = new List <InvoiceItem>(); var airportInvoiceItems = new List <InvoiceItem>(); var cInvoiceItem = new CInvoiceItem(); foreach (GridDataItem item in _radGridInvoiceItems.Items) { var invoiceCoaItemId = (RadDropDownList)item.FindControl("ddlInvoiceItems"); var standardPrice = (Label)item.FindControl("lblStandardPrice"); var studentPrice = (Label)item.FindControl("lblStudentPrice"); var agencyPrice = (Label)item.FindControl("lblAgencyPrice"); var invoiceItem = new InvoiceItem(); invoiceItem.InvoiceId = invoiceId; invoiceItem.InvoiceCoaItemId = Convert.ToInt32(invoiceCoaItemId.SelectedValue); invoiceItem.StandardPrice = Convert.ToDecimal(standardPrice.Text.Replace("$", string.Empty)); invoiceItem.StudentPrice = Convert.ToDecimal(studentPrice.Text.Replace("$", string.Empty)); invoiceItem.AgencyPrice = Convert.ToDecimal(agencyPrice.Text.Replace("$", string.Empty)); invoiceItem.CreatedId = CurrentUserId; invoiceItem.CreatedDate = DateTime.Now; switch (invoiceItem.InvoiceCoaItemId) { case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayBasic: case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayBasicDiscount: case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayPlacement: case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayPlacementDiscount: case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayInternetGuarantee: case (int)CConstValue.InvoiceCoaItemForHomestay.HomestayOtherDiscount: homestayInvoiceItems.Add(invoiceItem); break; case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryBasic: case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryBasicDiscount: case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryPlacement: case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryPlacementDiscount: case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryKeyDeposit: case (int)CConstValue.InvoiceCoaItemForDormitory.DormitoryKeyDepositDiscount: dormitoryInvoiceItems.Add(invoiceItem); break; case (int)CConstValue.InvoiceCoaItem.AirportPickup: case (int)CConstValue.InvoiceCoaItem.AirportPickupDiscount: case (int)CConstValue.InvoiceCoaItem.AirportDropoff: case (int)CConstValue.InvoiceCoaItem.AirportDropoffDiscount: case (int)CConstValue.InvoiceCoaItem.AirportPickupAndDropoff: case (int)CConstValue.InvoiceCoaItem.AirportPickupAndDropoffDiscount: airportInvoiceItems.Add(invoiceItem); break; default: invoiceItems.Add(invoiceItem); break; } } // add invoiceItems except for homestay and dormitory if (cInvoiceItem.Add(invoiceItems) == false) { ShowMessage("Error : add invoiceItem"); } // add homestay if exist. if (homestayInvoiceItems.Count > 0) { var newHomestayRegistrationId = new CHomestayStudentRequest().Add(new HomestayStudentBasic() { HomestayStudentStatus = 0, // Pending StudentId = Id, PlacedUserId = 0, CreatedUserId = CurrentUserId, CreatedDate = DateTime.Now }); if (newHomestayRegistrationId > 0) { var invoiceForHomestay = new Invoice(); invoiceForHomestay.HomestayRegistrationId = newHomestayRegistrationId; invoiceForHomestay.StudentId = Id; if (!string.IsNullOrEmpty(ddlAgency.SelectedValue)) { invoiceForHomestay.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue); invoiceForHomestay.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked; invoiceForHomestay.AgencyRate = tbCommissionRate.Value; } invoiceForHomestay.SiteLocationId = CurrentSiteLocationId; invoiceForHomestay.InvoiceType = (int)CConstValue.InvoiceType.Homestay; invoiceForHomestay.Status = (int)CConstValue.InvoiceStatus.Pending; invoiceForHomestay.CreatedId = CurrentUserId; invoiceForHomestay.CreatedDate = DateTime.Now; var invoiceForHomestayId = cInvoice.Add(invoiceForHomestay); if (invoiceForHomestayId > 0) { foreach (var h in homestayInvoiceItems) { h.InvoiceId = invoiceForHomestayId; } foreach (var a in airportInvoiceItems) { a.InvoiceId = invoiceForHomestayId; } // merge between homestay Items and airport Items homestayInvoiceItems.AddRange(airportInvoiceItems); if (cInvoiceItem.Add(homestayInvoiceItems) == false) { ShowMessage("Error : add invoiceHomestayItem"); } } else { ShowMessage("Error : add Homestay"); } } else { ShowMessage("Error : add Homestay registration"); } } // add dormitory if exist. if (dormitoryInvoiceItems.Count > 0) { var newDormitoryRegistrationId = new CDormitoryRegistrations().Add(new DormitoryRegistration() { DormitoryStudentStatus = 0, // Pending StudentId = Id, PlacedUserId = 0, CreatedId = CurrentUserId, CreatedDate = DateTime.Now }); if (newDormitoryRegistrationId > 0) { var invoiceForDormitory = new Invoice(); invoiceForDormitory.DormitoryRegistrationId = newDormitoryRegistrationId; invoiceForDormitory.StudentId = Id; if (!string.IsNullOrEmpty(ddlAgency.SelectedValue)) { invoiceForDormitory.AgencyId = Convert.ToInt32(ddlAgency.SelectedValue); invoiceForDormitory.IsAgencySeasonalRate = RadButtonAgencyRateSeasonal.Checked; invoiceForDormitory.AgencyRate = tbCommissionRate.Value; } invoiceForDormitory.SiteLocationId = CurrentSiteLocationId; invoiceForDormitory.InvoiceType = (int)CConstValue.InvoiceType.Dormitory; invoiceForDormitory.Status = (int)CConstValue.InvoiceStatus.Pending; invoiceForDormitory.CreatedId = CurrentUserId; invoiceForDormitory.CreatedDate = DateTime.Now; var invoiceForDormitoryId = cInvoice.Add(invoiceForDormitory); if (invoiceForDormitoryId > 0) { foreach (var h in dormitoryInvoiceItems) { h.InvoiceId = invoiceForDormitoryId; } foreach (var a in airportInvoiceItems) { a.InvoiceId = invoiceForDormitoryId; } // merge between dormitory Items and airport Items dormitoryInvoiceItems.AddRange(airportInvoiceItems); if (cInvoiceItem.Add(dormitoryInvoiceItems) == false) { ShowMessage("Error : add invoiceDormitoryItem"); } } else { ShowMessage("Error : add Dormitory"); } } else { ShowMessage("Error : add Dormitory registration"); } } RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Invoice)"); } } else { ShowMessage("failed to update inqury (Program Registragion)"); } } } }
public RConfirmationOfEnrollment(int invoiceId) { // // Required for telerik Reporting designer support // InitializeComponent(); var invoice = new CInvoice().Get(invoiceId); if (invoice?.ProgramRegistrationId == null) { return; } var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId); if (programRegistration == null) { return; } var cStudent = new CStudent(); var student = cStudent.Get((int)invoice.StudentId); if (student == null) { return; } var studentGender = (student.Gender == false ? "Mr. " : "Ms. "); textBoxDate.Value = DateTime.Today.ToString("MM-dd-yy"); // id textBoxId.Value = "ID : " + student.StudentNo; // letter of acceptance textBoxConfirmationOfEnrollment.Value = $@"Confirmation Of Enrollment : {studentGender + cStudent.GetStudentFullName(student)}"; // date of birth textBoxDateOfBirth.Value = $@"(Date of Birth: {student.DOB?.ToString("MM-dd-yy")})"; var programType = "Part-time"; var hours = string.Empty; var weeks = string.Empty; if (programRegistration.HrsStatus != null) { if (programRegistration.HrsStatus >= 20) { programType = "Full-time"; } hours = $"({programRegistration.HrsStatus} hours per week)"; } if (programRegistration.Weeks != null) { weeks = programRegistration.Weeks + " weeks"; } var program = new CProgram().Get(programRegistration.ProgramId); var siteLocation = new CSiteLocation().Get(student.SiteLocationId); var site = new CSite().Get(siteLocation.SiteId); // this letter htmlTextBoxThisLetter.Value = $@"This letter certifies that {studentGender + cStudent.GetStudentFullName(student)} has been accepted for {programType} studies {hours} of {program?.ProgramFullName} at the {siteLocation.Name} campus of {site.Abbreviation}. The period of enrollment is {weeks} beginning {programRegistration.StartDate?.ToString("MM-dd-yy")} and ending {programRegistration.EndDate?.ToString("MM-dd-yy")}.<br><br> During the student's enrollment {studentGender + cStudent.GetStudentFullName(student)} attended classes.<br> During the {weeks} of study, {studentGender + cStudent.GetStudentFullName(student)}'s attendance was above 85%.<br><br><br> If you should have any questions regarding the enrollment of {studentGender + student.FirstName} at our college, please do not hesitate to contact our campus director."; switch (siteLocation.SiteId) { // CAC case 2: textBoxName.Value = "Christine Jang"; textBoxJobTitle.Value = "Site Administrator"; break; default: textBoxName.Value = string.Empty; textBoxJobTitle.Value = string.Empty; break; } try { var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo); if (logoPath != string.Empty) { pictureBoxCompanyLogo.Value = Image.FromFile(logoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } try { var signPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Sign); if (signPath != string.Empty) { pictureBoxSign.Value = Image.FromFile(signPath); } } catch (Exception ex) { Debug.Print(ex.Message); } }
public RConfirmationOfCompletionLetter(int invoiceId) { // // Required for telerik Reporting designer support // InitializeComponent(); var invoice = new CInvoice().Get(invoiceId); if (invoice?.ProgramRegistrationId == null) { return; } var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId); if (programRegistration == null) { return; } var cStudent = new CStudent(); var student = cStudent.Get((int)invoice.StudentId); if (student == null) { return; } var program = new CProgram().Get(programRegistration.ProgramId); var siteLocation = new CSiteLocation().Get(student.SiteLocationId); var site = new CSite().Get(siteLocation.SiteId); htmlTextBoxSubTitle.Value = $@"{site.Name} - {siteLocation.Name} - Canada"; htmlTextBoxStudentId.Value = $@"Student ID : {student.StudentNo}"; htmlTextBoxDateOfIssue.Value = $@"Date of Issue : {DateTime.Today}"; htmlTextBoxThisIs.Value = $@"This is to confirm that the following student has successfully completed their studies at {site.Name}."; htmlTextBoxFamilyName.Value = $@"FAMILY NAME : {student.LastName1}"; htmlTextBoxFirstName.Value = $@"FIRST NAME : {student.FirstName}"; htmlTextBoxDateOfBirth.Value = $@"DATE OF BIRTH : {student.DOB?.ToString("MM-dd-yy")}"; htmlTextBoxProgram.Value = $@"PROGRAM : {program.ProgramFullName}"; htmlTextBoxPeriod.Value = $@"PERIOD : {programRegistration.StartDate?.ToString("MM-dd-yy")} ~ {programRegistration.EndDate?.ToString("MM-dd-yy")}"; switch (siteLocation.SiteId) { // CAC case 2: textBoxName.Value = "Christine Jang"; textBoxJobTitle.Value = "Site Administrator"; break; default: textBoxName.Value = string.Empty; textBoxJobTitle.Value = string.Empty; break; } try { var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo); if (logoPath != string.Empty) { pictureBoxCompanyLogo.Value = Image.FromFile(logoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } try { var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide); if (sideLogoPath != string.Empty) { pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } }
public ROrientationForm(int invoiceId) { // // Required for telerik Reporting designer support // InitializeComponent(); var invoice = new CInvoice().Get(invoiceId); if (invoice?.ProgramRegistrationId == null) { return; } var programRegistration = new CProgramRegistration().Get((int)invoice.ProgramRegistrationId); if (programRegistration == null) { return; } var cStudent = new CStudent(); var student = cStudent.Get((int)invoice.StudentId); if (student == null) { return; } var program = new CProgram().Get(programRegistration.ProgramId); var siteLocation = new CSiteLocation().Get(student.SiteLocationId); var site = new CSite().Get(siteLocation.SiteId); htmlTextBoxDate.Value = "Date : " + DateTime.Today.ToString("MM-dd-yy"); textBoxRe.Value = $"RE: STUDENT ORIENTATION FOR {program.ProgramFullName}"; htmlTextBoxBody.Value = $@" <b>TO: {new CStudent().GetStudentFullName(student)} #{student.StudentNo}</b><br> C/O: GLOBAL INTERCITY STUDENT CENTER<br><br> We sincerely welcome you to {site.Name}. Your session starts {programRegistration.StartDate?.ToString("MM-dd-yy")} and it is very important that you be here for your level placement and orientation.<br><br> <b>ORIENTATION</b><br> <b><u>{site.Abbreviation}'s orientation starts 9:00am {programRegistration.StartDate?.ToString("MM-dd-yy")} and students are asked to come to school by no later than 8:50am.</u></b>Counselors will inform you on school policies, class schedules along with a brief tour of the outlying area.<br> <b><u>YOUR FIRST DAY AT SCHOOL INCLUDES</u></b><br> 1. A written placement test<br> 2. Orientation with counselors<br> 3. Individual oral interview with a school instructor<br><br> <b>PLEASE MAKE SURE TO BRING FOLLOWNG ITEMS WITH YOU:</b><br> 1. A pencil and an eraser for the Placement Test<br> 2. A photocopy of your passport(the page with your passport photo)<br> 3. A photocopy of your Valid Immigration Document(Study Permit / Work Permit / Visitor's Record)<br> 4. A photocopy of your Medical Insurance Document<br> 5. A photocopy of your Letter of Acceptance and the Refund Policy with your signatures on<br><br> <b>CHANGE OF SCHEDULE</b><br> <b>If you are not able to attend the placement/orientation, you must notify the school immediately.</b><br><br> <b>CLEARING CUSTOMS</b><br> You may not study for over 6 months when entering Canada with a tourist visa. Please have with you your {site.Abbreviation} Letter of Acceptance and Homestay detail. Also, it is a good idea to be prepared to answer simple question that the customs officer may have for you."; try { var logoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.Logo); if (logoPath != string.Empty) { pictureBoxCompanyLogo.Value = Image.FromFile(logoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } try { var sideLogoPath = new CGlobal().GetLogoImagePath((int)invoice.SiteLocationId, CConstValue.ImageType.LogoSide); if (sideLogoPath != string.Empty) { pictureBoxSideLogo.Value = Image.FromFile(sideLogoPath); } } catch (Exception ex) { Debug.Print(ex.Message); } }
protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == @"Approve" && !string.IsNullOrEmpty(hfId.Value)) { if (IsValid) { var type = Convert.ToInt32(hfType.Value); var id = Convert.ToInt32(hfId.Value); var idNumber = string.Empty; var cApprovalHistory = new CApprovalHistory(); var approvalHistory = cApprovalHistory.Get(type, id, CurrentUserId); approvalHistory.ApprovalDate = DateTime.Now; approvalHistory.ApprovalMemo = tbRemark.Text; // cal int approvalStatus = cApprovalHistory.CheckApprovalStep(type, id); if (approvalStatus == (int)CConstValue.ApprovalStatus.Approved) { approvalStatus = new CGlobal().GetApprovalValue(type); } approvalHistory.ApprovalStep = approvalStatus; // update approvalHistory cApprovalHistory.Update(approvalHistory); //Refund & Commission if (type == (int)CConstValue.Approval.Refund) { var cRefundInfo = new CRefund(); var refundInfo = cRefundInfo.Get(Convert.ToInt32(hfId.Value)); refundInfo.ApprovalDate = approvalHistory.ApprovalDate; refundInfo.ApprovalId = approvalHistory.ApprovalUser; refundInfo.ApprovalMemo = approvalHistory.ApprovalMemo; refundInfo.ApprovalStatus = approvalHistory.ApprovalStep; if (cRefundInfo.Update(refundInfo)) { //if last approve if (refundInfo.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved) { var vwRefund = cRefundInfo.GetVwRefund(refundInfo.RefundId); var refundAmount = Math.Abs((decimal)vwRefund.RefundAmount); var sumOfMdfAndCp = new CCreditMemo().GetSumOfMdfAndCp(vwRefund.RefundId); var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(refundInfo.CreditMemoPayoutId); var cCreditMemo = new CCreditMemo(); var creditMemo = cCreditMemo.Get(creditMemoPayout.CreditMemoId); creditMemo.OriginalCreditMemoAmount = refundAmount - sumOfMdfAndCp; creditMemo.CreditMemoStartDate = DateTime.Now; creditMemo.CreditMemoEndDate = DateTime.Now.AddYears(1); creditMemo.IsActive = true; creditMemo.UpdatedId = CurrentUserId; creditMemo.UpdatedDate = DateTime.Now; // Approved creditMemoPayout.ApprovalStatus = (int)CConstValue.ApprovalStatus.Approved; creditMemoPayout.ApprovalDate = DateTime.Now; creditMemoPayout.ApprovalId = CurrentUserId; creditMemoPayout.Amount = refundAmount; creditMemoPayout.PayoutMethod = vwRefund.PayoutMethod; creditMemoPayout.IsActive = true; creditMemoPayout.UpdatedId = CurrentUserId; creditMemoPayout.UpdatedDate = DateTime.Now; cCreditMemoPayout.Update(creditMemoPayout); if (cCreditMemo.Update(creditMemo)) { var cInvoiceInfo = new CInvoice(); var invoiceInfo = cInvoiceInfo.Get(refundInfo.InvoiceId); var cOriginalInvoiceInfo = new CInvoice(); var originalInvoiceInfo = cOriginalInvoiceInfo.Get(Convert.ToInt32(invoiceInfo.OriginalInvoiceId)); invoiceInfo.Status = (int)CConstValue.InvoiceStatus.Invoiced; // Invoiced invoiceInfo.UpdatedId = CurrentUserId; originalInvoiceInfo.Status = (int)CConstValue.InvoiceStatus.Cancelled_RF; // Canceled_RF originalInvoiceInfo.UpdatedId = CurrentUserId; var startDate = DateTime.Now; var endDate = DateTime.Now; //invoice status update if (cInvoiceInfo.Update(invoiceInfo) && cOriginalInvoiceInfo.Update(originalInvoiceInfo)) { // Program if (invoiceInfo.ProgramRegistrationId != null) { var cProgramRegiInfo = new CProgramRegistration(); var programRegiInfo = cProgramRegiInfo.Get(Convert.ToInt32(invoiceInfo.ProgramRegistrationId)); programRegiInfo.UpdatedId = CurrentUserId; programRegiInfo.UpdatedDate = DateTime.Now; programRegiInfo.ProgramRegistrationType = 12; // cancel cProgramRegiInfo.Update(programRegiInfo); startDate = programRegiInfo.StartDate.Value; endDate = programRegiInfo.EndDate.Value; } // Homestay else if (invoiceInfo.HomestayRegistrationId != null) { var cHomestayStudentRequest = new CHomestayStudentRequest(); var homestayStudentRequest = cHomestayStudentRequest.GetHomestayStudentRequest(Convert.ToInt32(invoiceInfo.HomestayRegistrationId)); homestayStudentRequest.UpdateUserId = CurrentUserId; homestayStudentRequest.UpdatedDate = DateTime.Now; homestayStudentRequest.HomestayStudentStatus = 1; // cancel cHomestayStudentRequest.Update(homestayStudentRequest); startDate = homestayStudentRequest.StartDate.Value; endDate = homestayStudentRequest.EndDate.Value; } // Dormitory else if (invoiceInfo.DormitoryRegistrationId != null) { var cDormitoryStudentRequest = new CDormitoryRegistrations(); var dormitoryStudentRequest = cDormitoryStudentRequest.GetDormitoryStudentRequest(Convert.ToInt32(invoiceInfo.ProgramRegistrationId)); dormitoryStudentRequest.DormitoryStudentStatus = 1; // cancel dormitoryStudentRequest.UpdatedId = CurrentUserId; dormitoryStudentRequest.UpdatedDate = DateTime.Now; cDormitoryStudentRequest.Update(dormitoryStudentRequest); startDate = dormitoryStudentRequest.StartDate.Value; endDate = dormitoryStudentRequest.EndDate.Value; } // Rev var cInterimInvoice = new CInvoice(); var interimInvoice = new Invoice(); CGlobal.Copy(invoiceInfo, interimInvoice); interimInvoice.OriginalInvoiceId = invoiceInfo.InvoiceId; interimInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_RV; interimInvoice.Status = (int)CConstValue.InvoiceStatus.Invoiced; interimInvoice.CreatedId = CurrentUserId; interimInvoice.CreatedDate = DateTime.Now; if (cInterimInvoice.Add(interimInvoice) > 0) { var totalDays = Convert.ToDateTime(endDate) - Convert.ToDateTime(startDate); var interimDays = Convert.ToDateTime(endDate) - Convert.ToDateTime(refundInfo.RefundDate); var interimRate = Math.Round((interimDays.TotalDays / totalDays.TotalDays), 2) * 100; var cInvoiceItem = new CInvoiceItem(); var cOriginalInvoiceItemModels = cInvoiceItem.GetInvoiceItemModels(invoiceInfo.InvoiceId); List <InvoiceItem> newInvoiceItems = new List <InvoiceItem>(); foreach (CInvoiceItemModel ori in cOriginalInvoiceItemModels) { if (ori.InvoiceCoaItem.RevenueRecognition == 1) { var newInvoiceRevItem = new InvoiceItem(); CGlobal.Copy(ori.InvoiceItem, newInvoiceRevItem); newInvoiceRevItem.InvoiceId = interimInvoice.InvoiceId; newInvoiceRevItem.StandardPrice *= (decimal)interimRate; newInvoiceRevItem.StudentPrice *= (decimal)interimRate; newInvoiceRevItem.AgencyPrice *= (decimal)interimRate; newInvoiceRevItem.CreatedId = CurrentUserId; newInvoiceRevItem.CreatedDate = DateTime.Now; newInvoiceRevItem.Remark = "Refund Rev"; newInvoiceItems.Add(newInvoiceRevItem); } } if (newInvoiceItems.Count > 0) { // copy invoiceItems if (cInvoiceItem.Add(newInvoiceItems)) { RunClientScript("Close();"); } else { ShowMessage("failed to update inqury (Refund Ref Invoice Item)"); } } else { RunClientScript("Close();"); } } else { ShowMessage("failed to update inqury (Refund Ref Invoice)"); } } else { ShowMessage("failed to update inqury (Original Invoice and Refund Invoice)"); } } else { ShowMessage("failed to update inqury (CreditMemo Info)"); } } else { RunClientScript("Close();"); } } else { ShowMessage("failed to update inqury (Refund Info)"); } } // Agency else if (type == (int)CConstValue.Approval.Agency) { try { var cAgency = new CAgency(); var agency = cAgency.Get(id); idNumber = agency.AgencyNumber; agency.ApprovalDate = approvalHistory.ApprovalDate; agency.ApprovalId = approvalHistory.ApprovalUser; agency.ApprovalMemo = approvalHistory.ApprovalMemo; agency.ApprovalStatus = approvalHistory.ApprovalStep; cAgency.Update(agency); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // BusinessTrip else if (type == (int)CConstValue.Approval.BusinessTrip) { try { var cBusinessTrip = new CBusinessTrip(); var businessTrip = cBusinessTrip.Get(id); businessTrip.ApprovalDate = approvalHistory.ApprovalDate; businessTrip.ApprovalId = approvalHistory.ApprovalUser; businessTrip.ApprovalMemo = approvalHistory.ApprovalMemo; businessTrip.ApprovalStatus = approvalHistory.ApprovalStep; cBusinessTrip.Update(businessTrip); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // Purchase Order else if (type == (int)CConstValue.Approval.PurchaseOrder) { try { var cPurchaseOrder = new CPurchaseOrder(); var purchaseOrder = cPurchaseOrder.Get(id); purchaseOrder.ApprovalDate = approvalHistory.ApprovalDate; purchaseOrder.ApprovalId = approvalHistory.ApprovalUser; purchaseOrder.ApprovalMemo = approvalHistory.ApprovalMemo; purchaseOrder.ApprovalStatus = approvalHistory.ApprovalStep; cPurchaseOrder.Update(purchaseOrder); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // Package Program else if (type == (int)CConstValue.Approval.Package) { try { var cP = new CPackageProgram(); var packageProgram = cP.GetPackageProgram(id); packageProgram.ApprovalDate = approvalHistory.ApprovalDate; packageProgram.ApprovalId = approvalHistory.ApprovalUser; packageProgram.ApprovalMemo = approvalHistory.ApprovalMemo; packageProgram.ApprovalStatus = approvalHistory.ApprovalStep; if (packageProgram.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved) { packageProgram.IsActive = true; } cP.Update(packageProgram); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } //Scholarship// else if (type == (int)CConstValue.Approval.Scholarship) { try { var cScholar = new CScholarship(); var scholar = cScholar.Get(Convert.ToInt32(id)); idNumber = scholar.ScholarshipMasterNo; scholar.ApprovalDate = approvalHistory.ApprovalDate; scholar.ApprovalId = approvalHistory.ApprovalUser; scholar.ApprovalMemo = approvalHistory.ApprovalMemo; scholar.ApprovalStatus = approvalHistory.ApprovalStep; if (scholar.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved) { scholar.IsActive = true; } cScholar.Update(scholar); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } //Promotion// else if (type == (int)CConstValue.Approval.Promotion) { try { var cPromo = new CPromotion(); var promo = cPromo.Get(Convert.ToInt32(id)); idNumber = promo.PromotionMasterNo; promo.ApprovalDate = approvalHistory.ApprovalDate; promo.ApprovalId = approvalHistory.ApprovalUser; promo.ApprovalMemo = approvalHistory.ApprovalMemo; promo.ApprovalStatus = approvalHistory.ApprovalStep; if (promo.ApprovalStatus == (int)CConstValue.ApprovalStatus.Approved) { promo.IsActive = true; } cPromo.Update(promo); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // Expense Program else if (type == (int)CConstValue.Approval.Expense) { try { var cExpense = new CExpense(); var expense = cExpense.Get(id); expense.ApprovalDate = approvalHistory.ApprovalDate; expense.ApprovalId = approvalHistory.ApprovalUser; expense.ApprovalMemo = approvalHistory.ApprovalMemo; expense.ApprovalStatus = approvalHistory.ApprovalStep; cExpense.Update(expense); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // Hire else if (type == (int)CConstValue.Approval.Hire) { try { var cHire = new CHire(); var hire = cHire.Get(id); hire.ApprovalDate = approvalHistory.ApprovalDate; hire.ApprovalId = approvalHistory.ApprovalUser; hire.ApprovalMemo = approvalHistory.ApprovalMemo; hire.ApprovalStatus = approvalHistory.ApprovalStep; cHire.Update(hire); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // Vacation else if (type == (int)CConstValue.Approval.Vacation) { try { var cVacationDetail = new CVacation(); var vacation = cVacationDetail.Get(id); vacation.ApprovalDate = approvalHistory.ApprovalDate; vacation.ApprovalId = approvalHistory.ApprovalUser; vacation.ApprovalMemo = approvalHistory.ApprovalMemo; vacation.ApprovalStatus = approvalHistory.ApprovalStep; cVacationDetail.Update(vacation); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } // CreditMemoPayout else if (type == (int)CConstValue.Approval.CreditMemoPayout) { try { var cCreditMemo = new CCreditMemoPayout(); var creditMemo = cCreditMemo.Get(id); creditMemo.ApprovalDate = approvalHistory.ApprovalDate; creditMemo.ApprovalId = approvalHistory.ApprovalUser; creditMemo.ApprovalMemo = approvalHistory.ApprovalMemo; creditMemo.ApprovalStatus = approvalHistory.ApprovalStep; cCreditMemo.Update(creditMemo); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } if (approvalHistory.ApprovalStep != (int)CConstValue.ApprovalStatus.Approved) //if has a next approver, request approve { var approvalInfo = new CApproval(); var supervisor = approvalInfo.GetSupuervisor(type, CurrentUserId); if (supervisor > 0) { var cNextApprove = new CApprovalHistory(); var nextApprove = cNextApprove.Get(type, id, supervisor); nextApprove.IsApprovalRequest = true; cNextApprove.Update(nextApprove); } new CMail().SendMail((CConstValue.Approval)type, CConstValue.MailStatus.ToApproveUserAndRequestUser, id, idNumber, CurrentUserId); } // approved else { new CMail().SendMail((CConstValue.Approval)type, CConstValue.MailStatus.ToRequestUser, id, idNumber, CurrentUserId); } } } }