protected void RadToolBarAgency_OnButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Request": if (RadGridAgency.SelectedValue != null) { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Agency, Convert.ToInt32(RadGridAgency.SelectedValue)); // approve request var approval = new CApproval().ApproveRequstCreate((int)CConstValue.Approval.Agency, CurrentUserId, Convert.ToInt32(RadGridAgency.SelectedValue)); if (approval > 0) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(RadGridAgency.SelectedValue)); agency.ApprovalStatus = approval; agency.ApprovalId = CurrentUserId; agency.ApprovalDate = DateTime.Now; //agency.ApprovalMemo = ""; cAgency.Update(agency); new CMail().SendMail(CConstValue.Approval.Agency, CConstValue.MailStatus.ToApproveUser, agency.AgencyId, agency.AgencyNumber, CurrentUserId); } RadGridAgency.Rebind(); } break; case "Approve": if (RadGridAgency.SelectedValue != null) { RunClientScript("ShowApprovalWindow('" + RadGridAgency.SelectedValue + "');"); } break; case "Reject": if (RadGridAgency.SelectedValue != null) { RunClientScript("ShowApprovalRejectWindow('" + RadGridAgency.SelectedValue + "');"); } break; case "Revise": if (RadGridAgency.SelectedValue != null) { RunClientScript("ShowApprovalReviseWindow('" + RadGridAgency.SelectedValue + "');"); } break; case "Cancel": if (RadGridAgency.SelectedValue != null) { RunClientScript("ShowApprovalCancelWindow('" + RadGridAgency.SelectedValue + "');"); } break; } }
protected void LoadAgency(int siteLocation) { var cAgency = new CAgency(); ddlAgency.DataSource = cAgency.GetAgency(siteLocation); ddlAgency.DataTextField = "Name"; ddlAgency.DataValueField = "Value"; ddlAgency.DataBind(); ddlAgency.Items.Insert(0, new RadComboBoxItem("-None(Direct Student)-", "0")); }
protected void ddlAgency_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { if (Convert.ToInt32(ddlAgency.SelectedValue) > 0) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(ddlAgency.SelectedValue)); tbCommissionRate.Value = agency.CommissionRateBasic; } else { tbCommissionRate.Value = 0; } }
protected void RadComboBoxAgencyName_OnTextChanged(object sender, EventArgs e) { var cAgency = new CAgency(); var agency = cAgency.Get(RadComboBoxAgencyName.Text); if (agency != null) { ShowMessage(RadComboBoxAgencyName.Text + " already has been registered. Please use another one."); RadComboBoxAgencyName.Text = string.Empty; } else { ShowMessage("It is possible to use."); } }
private bool GetAgencyRate() { if (!string.IsNullOrEmpty(ddlAgency.SelectedValue)) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(ddlAgency.SelectedValue)); if (agency != null) { tbCommissionRate.Value = RadButtonAgencyRateBasic.Checked ? agency.CommissionRateBasic : agency.CommissionRateSeasonal; } else { tbCommissionRate.Value = 0; } return(true); } tbCommissionRate.Value = 0; return(false); }
private string GetTableNameForViewType(string selectedText) { bool isApprovalList = selectedText == "My Approval" ? true : false; string tableName = string.Empty; switch (_menuId) { case (int)CConstValue.Menu.PackageProgram: var cPackageProgram = new CPackageProgram(); tableName = isApprovalList ? cPackageProgram.GetTableNameForVwPackageProgramApprovalList() : cPackageProgram.GetTableNameForVwPackageProgram(); break; case (int)CConstValue.Menu.CreditMemo: var cCreditMemo = new CCreditMemoPayout(); tableName = isApprovalList ? cCreditMemo.GetTableNameForvwCreditMemoPayoutApprovalList() : cCreditMemo.GetTableNameForVwCreditMemoPayout(); break; case (int)CConstValue.Menu.Refund: var cRefund = new CRefund(); tableName = isApprovalList ? cRefund.GetTableNameForVwRefundApprovalList() : cRefund.GetTableNameForVwRefund(); break; case (int)CConstValue.Menu.Scholarship: var cScholarship = new CScholarship(); tableName = isApprovalList ? cScholarship.GetTableNameForVwScholarshipApprovalList() : cScholarship.GetTableNameForVwScholarship(); break; case (int)CConstValue.Menu.Promotion: var cPromotion = new CPromotion(); tableName = isApprovalList ? cPromotion.GetTableNameForVwPromotionApprovalList() : cPromotion.GetTableNameForVwPromotion(); break; case (int)CConstValue.Menu.Agency: var cAgency = new CAgency(); tableName = isApprovalList ? cAgency.GetTableNameForVwAgencyApprovalList() : cAgency.GetTableNameForVwAgency(); break; } return(tableName); }
protected void GetStudent() { if (RadGrid1.SelectedValue != null) { var cStud = new CScholarship(); var stud = cStud.Get(Convert.ToInt32(RadGrid1.SelectedValue)); tbMaster.Text = stud.ScholarshipMasterNo; var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(stud.AgencyId)); tbAgency.Text = agency.Name; tbAmount.Text = stud.Amount.ToString(); rbAmount.Checked = tbAmount.Text == string.Empty ? false : true; tbWeek.Text = stud.Weeks.ToString(); rbWeeks.Checked = tbWeek.Text == string.Empty ? false : true; tbComment.Text = stud.Memo; } GetSiteLocation(); }
protected void ResetForm() { var global = new CGlobal(); var agcname = new CAgency(); ddlBusinessLocation.Items.Clear(); ddlBusinessLocation.Text = string.Empty; ddlBusinessLocation.DataSource = global.GetCountry(); ddlBusinessLocation.DataTextField = "Name"; ddlBusinessLocation.DataValueField = "Value"; ddlBusinessLocation.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlBusinessLocation.DataBind(); ddlMainTarget.Items.Clear(); ddlMainTarget.Text = string.Empty; ddlMainTarget.DataSource = global.GetCountry(); ddlMainTarget.DataTextField = "Name"; ddlMainTarget.DataValueField = "Value"; ddlMainTarget.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlMainTarget.DataBind(); ddlAgencyCountry.Items.Clear(); ddlAgencyCountry.Text = string.Empty; ddlAgencyCountry.DataSource = global.GetCountry(); ddlAgencyCountry.DataTextField = "Name"; ddlAgencyCountry.DataValueField = "Value"; ddlAgencyCountry.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlAgencyCountry.DataBind(); ddlAgencyCountry1.Items.Clear(); ddlAgencyCountry1.Text = string.Empty; ddlAgencyCountry1.DataSource = global.GetCountry(); ddlAgencyCountry1.DataTextField = "Name"; ddlAgencyCountry1.DataValueField = "Value"; ddlAgencyCountry1.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlAgencyCountry1.DataBind(); ddlPAgency.Items.Clear(); ddlPAgency.Text = string.Empty; ddlPAgency.DataSource = agcname.GetAgencyPName(); ddlPAgency.DataTextField = "Name"; ddlPAgency.DataValueField = "Value"; ddlPAgency.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlPAgency.DataBind(); ddlPAgency.Items.Insert(0, new RadComboBoxItem("N/A", null)); RadComboBoxAgencyName.Items.Clear(); RadComboBoxAgencyName.Text = string.Empty; RadComboBoxAgencyName.DataSource = agcname.GetAgencyName(); RadComboBoxAgencyName.DataTextField = "Name"; RadComboBoxAgencyName.DataValueField = "Value"; RadComboBoxAgencyName.Filter = (RadComboBoxFilter)Convert.ToInt32(1); RadComboBoxAgencyName.DataBind(); RadComboBoxAgencyName.Text = ""; tbAgencyShortName.Text = ""; tbAgencyGroupName.Text = ""; tbAgencyPrintName.Text = ""; tbAgencyType.Text = ""; tbCommissionRateBasic.Text = ""; tbCommissionRateSeason.Text = ""; tbCreditLimit.Text = ""; tbContractStart.SelectedDate = null; tbContractEnd.SelectedDate = null; tbAPPayTerm.Text = ""; tbAPPayMethod.Text = ""; tbAPBillingType.Text = ""; tbAPPAymentPriority.Text = ""; tbAPPaySchedule.Text = ""; tbARCollectionTerm.Text = ""; tbARType.Text = ""; tbARCollection.Text = ""; tbARCollectionSchedule.Text = ""; tbARCollectionMethod.Text = ""; tbAgencyNo.Text = ""; tbCurrency.Text = ""; tbComment.Text = ""; RadButtonActive.Checked = true; agFname.Text = ""; agLname.Text = ""; agTitle.Text = ""; agPhone.Text = ""; agMobile.Text = ""; agFax.Text = ""; agPEmail.Text = ""; agSEmail.Text = ""; agWebsite.Text = ""; agAddress.Text = ""; agCity.Text = ""; agProvince.Text = ""; agPostal.Text = ""; agFname1.Text = ""; agLname1.Text = ""; agTitle1.Text = ""; agPhone1.Text = ""; agMobile1.Text = ""; agFax1.Text = ""; agPEmail1.Text = ""; agSEmail1.Text = ""; agWebsite1.Text = ""; agAddress1.Text = ""; agCity1.Text = ""; agProvince1.Text = ""; agPostal1.Text = ""; if (RadToolBar1.FindItemByText("New") != null) { RadToolBar1.FindItemByText("New").Enabled = false; } if (RadToolBar1.FindItemByText("Update") != null) { RadToolBar1.FindItemByText("Update").Text = @"Save"; } GetSiteLocation(); }
protected void GetAgencyInfo() { ResetForm(); if (RadGridAgency.SelectedValue != null) { var cAgc = new CAgency(); var agc = cAgc.Get(Convert.ToInt32(RadGridAgency.SelectedValue)); if (agc.AgencyId > 0) { ddlPAgency.SelectedValue = Convert.ToString(agc.ParentAgencyId); RadComboBoxAgencyName.Text = agc.Name; tbAgencyShortName.Text = agc.Abbreviation; tbAgencyGroupName.Text = agc.GroupName; tbAgencyPrintName.Text = agc.PrintingName; tbAgencyType.Text = agc.AgencyType; tbCommissionRateBasic.Text = agc.CommissionRateBasic.ToString(); tbCommissionRateSeason.Text = agc.CommissionRateSeasonal.ToString(); tbCreditLimit.Text = agc.CreditLimit.ToString(); ddlBusinessLocation.SelectedValue = agc.Location.ToString(); ddlMainTarget.SelectedValue = agc.MainTargetCountry.ToString(); tbContractStart.SelectedDate = agc.ContractStartDate; tbContractEnd.SelectedDate = agc.ContractEndDate; tbAPPayTerm.Text = agc.APPaymentTerm; tbAPPayMethod.Text = agc.APPaymentMethod; tbAPBillingType.Text = agc.APBillingType; tbAPPAymentPriority.Text = agc.APPaymentPriority; tbAPPaySchedule.Text = agc.APPaymentSchedule; tbARCollectionTerm.Text = agc.ARCollectionTerm; tbARType.Text = agc.ARType; tbARCollection.Text = agc.ARCollectionPriority; tbARCollectionSchedule.Text = agc.ARCollectionSchedule; tbARCollectionMethod.Text = agc.ARCollectionMethod; tbAgencyNo.Text = agc.AgencyRegNo; tbCurrency.Text = agc.Currency; tbComment.Text = agc.Comment; RadButtonActive.Checked = agc.IsActive; agFname.Text = agc.FirstName; agLname.Text = agc.LastName; agTitle.Text = agc.Salutation; agPhone.Text = agc.Phone; agMobile.Text = agc.Mobile; agFax.Text = agc.Fax; agPEmail.Text = agc.PEmail; agSEmail.Text = agc.SEmail; agWebsite.Text = agc.Website; agAddress.Text = agc.Address; agCity.Text = agc.City; agProvince.Text = agc.Province; agPostal.Text = agc.Postal; ddlAgencyCountry.SelectedValue = agc.CountryId.ToString(); agFname1.Text = agc.FirstName1; agLname1.Text = agc.LastName1; agTitle1.Text = agc.Salutation1; agPhone1.Text = agc.Phone1; agMobile1.Text = agc.Mobile1; agFax1.Text = agc.Fax1; agPEmail1.Text = agc.PEmail1; agSEmail1.Text = agc.SEmail1; agWebsite1.Text = agc.Website1; agAddress1.Text = agc.Address1; agCity1.Text = agc.City1; agProvince1.Text = agc.Province1; agPostal1.Text = agc.Postal1; ddlAgencyCountry1.SelectedValue = agc.CountryId1.ToString(); if (RadToolBar1.FindItemByText("New") != null) { RadToolBar1.FindItemByText("New").Enabled = true; } if (RadToolBar1.FindItemByText("Save") != null) { RadToolBar1.FindItemByText("Save").Text = @"Update"; } } } }
protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == @"Reject" && !string.IsNullOrEmpty(hfId.Value)) { if (IsValid) { try { 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; // Reject approvalHistory.ApprovalStep = (int)CConstValue.ApprovalStatus.Rejected; if (type == (int)CConstValue.Approval.Refund) { var cC = new CRefund(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; if (cC.Update(c)) { var cInvoiceInfo = new CInvoice(); var invoiceInfo = cInvoiceInfo.Get(c.InvoiceId); var cOriginalInvoiceInfo = new CInvoice(); var originalInvoiceInfo = cOriginalInvoiceInfo.Get(Convert.ToInt32(invoiceInfo.OriginalInvoiceId)); invoiceInfo.Status = (int)CConstValue.InvoiceStatus.Cancelled_RF; // Canceled_R invoiceInfo.UpdatedId = CurrentUserId; originalInvoiceInfo.Status = (int)CConstValue.InvoiceStatus.Invoiced; // Invoiced originalInvoiceInfo.UpdatedId = CurrentUserId; cInvoiceInfo.Update(invoiceInfo); cOriginalInvoiceInfo.Update(originalInvoiceInfo); } } // Agency else if (type == (int)CConstValue.Approval.Agency) { var cC = new CAgency(); var c = cC.Get(id); idNumber = c.AgencyNumber; c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.CorporateCreditCard) { var cC = new CCorporateCreditCard(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // BusinessTrip else if (type == (int)CConstValue.Approval.BusinessTrip) { var cC = new CBusinessTrip(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // PackageProgram else if (type == (int)CConstValue.Approval.Package) { var cC = new CPackageProgram(); var c = cC.GetPackageProgram(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // Expense else if (type == (int)CConstValue.Approval.Expense) { var cC = new CExpense(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // Purchase Order else if (type == (int)CConstValue.Approval.PurchaseOrder) { var cP = new CPurchaseOrder(); var c = cP.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cP.Update(c); } // Hire else if (type == (int)CConstValue.Approval.Hire) { var cC = new CHire(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // Vacation else if (type == (int)CConstValue.Approval.Vacation) { var cC = new CVacation(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } //Scholarship else if (type == (int)CConstValue.Approval.Scholarship) { var cC = new CScholarship(); var c = cC.Get(id); idNumber = c.ScholarshipMasterNo; c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } //Promotion else if (type == (int)CConstValue.Approval.Promotion) { var cC = new CPromotion(); var c = cC.Get(id); idNumber = c.PromotionMasterNo; c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // CreditMemo else if (type == (int)CConstValue.Approval.CreditMemoPayout) { var cC = new CCreditMemoPayout(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // update approvalHistory cApprovalHistory.Update(approvalHistory); new CMail().SendMail((CConstValue.Approval)type, CConstValue.MailStatus.ToRequestUser, id, idNumber, CurrentUserId); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } } }
public void ValidateInvoiceItems() { if (ViewState["IsSaveChanged"] != null) { // init ViewState["IsSaveChanged"] = null; // =========== // validation // =========== var cInvoice = new CInvoice(); var invoice = cInvoice.Get(InvoiceId); var cInvoiceItem = new CInvoiceItem(); var invoiceItem = cInvoiceItem.GetInvoiceItems(InvoiceId); decimal calCommissionFee = 0; foreach (InvoiceItem item in invoiceItem) { // direct Student if (invoice.AgencyId == null) { if (item.AgencyPrice != 0) { // update price which isnot zero item.AgencyPrice = 0; cInvoiceItem.Update(item); } } // from Agency else { switch (item.InvoiceCoaItemId) { // tuition case 1: calCommissionFee = (decimal)item.AgencyPrice; break; // scholarship case 2: // promotion Credit case 3: // Advertising fee case 4: // Commision - Incentive case 5: calCommissionFee += (decimal)item.AgencyPrice; break; // Commission - Tuition case 6: var cAgency = new CAgency(); var agency = cAgency.Get((int)invoice.AgencyId); if (agency.CommissionRateBasic != null) { // update calculated commissionFee item.AgencyPrice = calCommissionFee * ((decimal)agency.CommissionRateBasic / -100); cInvoiceItem.Update(item); } break; } } // get standardPrice decimal maximumPrice = (decimal)(item.StudentPrice > item.AgencyPrice ? (item.StudentPrice < 0 ? 0 : item.StudentPrice) : (item.AgencyPrice < 0 ? 0 : item.AgencyPrice)); decimal?tempStandardPrice = 0; // tuition if (item.InvoiceCoaItemId == 1) { if (item.StandardPrice > 0) { tempStandardPrice = item.StandardPrice; } else { tempStandardPrice = item.StandardPrice > maximumPrice ? item.StandardPrice : maximumPrice; } } // others else { tempStandardPrice = item.StandardPrice > maximumPrice ? item.StandardPrice : maximumPrice; } if (item.StandardPrice != tempStandardPrice) { item.StandardPrice = tempStandardPrice; cInvoiceItem.Update(item); } } } }
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); } } } }
protected void AgencyButtonClicked(object sender, RadToolBarEventArgs e) { if (e.Item.Text == @"New") { RadGridAgency.SelectedIndexes.Clear(); ResetForm(); } else if (e.Item.Text == @"Update" && RadGridAgency.SelectedValue != null) { if (IsValid) { var cAgency = new CAgency(); var agc = cAgency.Get(Convert.ToInt32(RadGridAgency.SelectedValue)); var oriBasicCommission = Convert.ToDouble(agc.CommissionRateBasic); var oriSeasonalCommission = Convert.ToDouble(agc.CommissionRateSeasonal); var oriCreditLimit = Convert.ToDouble(agc.CreditLimit); agc.Name = RadComboBoxAgencyName.Text; agc.Abbreviation = tbAgencyShortName.Text; agc.GroupName = tbAgencyGroupName.Text; agc.PrintingName = tbAgencyPrintName.Text; agc.AgencyType = tbAgencyType.Text; agc.CommissionRateBasic = tbCommissionRateBasic.Value; agc.CommissionRateSeasonal = tbCommissionRateSeason.Value; agc.CreditLimit = tbCreditLimit.Value; agc.Location = Convert.ToInt32(ddlBusinessLocation.SelectedValue); agc.MainTargetCountry = Convert.ToInt32(ddlMainTarget.SelectedValue); if (tbContractStart.SelectedDate != null) { agc.ContractStartDate = Convert.ToDateTime(tbContractStart.SelectedDate); } if (tbContractEnd.SelectedDate != null) { agc.ContractEndDate = Convert.ToDateTime(tbContractEnd.SelectedDate); } agc.APPaymentTerm = tbAPPayTerm.Text; agc.APPaymentMethod = tbAPPayMethod.Text; agc.APBillingType = tbAPBillingType.Text; agc.APPaymentPriority = tbAPPAymentPriority.Text; agc.APPaymentSchedule = tbAPPaySchedule.Text; agc.ARCollectionTerm = tbARCollectionTerm.Text; agc.ARType = tbARType.Text; agc.ARCollectionPriority = tbARCollection.Text; agc.ARCollectionSchedule = tbARCollectionSchedule.Text; agc.ARCollectionMethod = tbARCollectionMethod.Text; agc.AgencyRegNo = tbAgencyNo.Text; agc.Currency = tbCurrency.Text; agc.Comment = tbComment.Text; agc.AgencyId = agc.AgencyId; agc.FirstName = agFname.Text; agc.LastName = agLname.Text; agc.Salutation = agTitle.Text; agc.Phone = agPhone.Text; agc.Mobile = agMobile.Text; agc.Fax = agFax.Text; agc.PEmail = agPEmail.Text; agc.SEmail = agSEmail.Text; agc.Website = agWebsite.Text; agc.Address = agAddress.Text; agc.City = agCity.Text; agc.Province = agProvince.Text; agc.Postal = agPostal.Text; if (ddlAgencyCountry.SelectedValue != string.Empty) { agc.CountryId = Convert.ToInt32(ddlAgencyCountry.SelectedValue); } agc.FirstName1 = agFname1.Text; agc.LastName1 = agLname1.Text; agc.Salutation1 = agTitle1.Text; agc.Phone1 = agPhone1.Text; agc.Mobile1 = agMobile1.Text; agc.Fax1 = agFax1.Text; agc.PEmail1 = agPEmail1.Text; agc.SEmail1 = agSEmail1.Text; agc.Website1 = agWebsite1.Text; agc.Address1 = agAddress1.Text; agc.City1 = agCity1.Text; agc.Province1 = agProvince1.Text; agc.Postal1 = agPostal1.Text; if (ddlAgencyCountry1.SelectedValue != string.Empty) { agc.CountryId1 = Convert.ToInt32(ddlAgencyCountry1.SelectedValue); } agc.IsActive = RadButtonActive.Checked; agc.UpdatedId = CurrentUserId; agc.UpdatedDate = DateTime.Now; if (oriBasicCommission == tbCommissionRateBasic.Value && oriSeasonalCommission == tbCommissionRateSeason.Value && oriCreditLimit == tbCreditLimit.Value) { cAgency.Update(agc); } else { cAgency.Update(agc); var cHistory = new CAgencyCommissionHistory(); var history = new AgencyCommissionHistory(); history.AgencyId = agc.AgencyId; history.OriBasicCommission = oriBasicCommission; history.OriSeasonCommission = oriSeasonalCommission; history.OriCreditLimit = oriCreditLimit; history.ChBasicCommission = (double)agc.CommissionRateBasic; history.ChSeasonCommission = (double)agc.CommissionRateSeasonal; history.ChCreditLimit = (double)agc.CreditLimit; history.SiteLocationId = CurrentSiteLocationId; history.UpdatedDate = DateTime.Now; history.UpdatedId = CurrentUserId; cHistory.Add(history); } var cAgencySiteLocation = new CAgencySiteLocation(); cAgencySiteLocation.DelAgencySiteLocationList(Convert.ToInt32(RadGridAgency.SelectedValue)); foreach (var siteLocation in RadComboBoxSiteLocation.CheckedItems) { var agencySiteLocation = new AgencySiteLocation() { CreatedId = CurrentUserId, AgencyId = Convert.ToInt32(RadGridAgency.SelectedValue), SiteLocationId = Convert.ToInt32(siteLocation.Value), CreatedDate = DateTime.Now }; cAgencySiteLocation.Add(agencySiteLocation); } RadGridAgency.Rebind(); ShowMessage("Update Agency Info Successfully"); } } else if (e.Item.Text == @"Save") { if (IsValid) { var cAgency = new CAgency(); var agc = new Erp2016.Lib.Agency(); agc.Name = RadComboBoxAgencyName.Text; agc.Abbreviation = tbAgencyShortName.Text; agc.GroupName = tbAgencyGroupName.Text; agc.PrintingName = tbAgencyPrintName.Text; agc.AgencyType = tbAgencyType.Text; agc.CommissionRateBasic = tbCommissionRateBasic.Value; agc.CommissionRateSeasonal = tbCommissionRateSeason.Value; agc.CreditLimit = tbCreditLimit.Value; agc.Location = Convert.ToInt32(ddlBusinessLocation.SelectedValue); agc.MainTargetCountry = Convert.ToInt32(ddlMainTarget.SelectedValue); agc.ContractStartDate = (tbContractStart.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbContractStart.SelectedDate); agc.ContractEndDate = (tbContractEnd.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbContractEnd.SelectedDate); agc.APPaymentTerm = tbAPPayTerm.Text; agc.APPaymentMethod = tbAPPayMethod.Text; agc.APBillingType = tbAPBillingType.Text; agc.APPaymentPriority = tbAPPAymentPriority.Text; agc.APPaymentSchedule = tbAPPaySchedule.Text; agc.ARCollectionTerm = tbARCollectionTerm.Text; agc.ARType = tbARType.Text; agc.ARCollectionPriority = tbARCollection.Text; agc.ARCollectionSchedule = tbARCollectionSchedule.Text; agc.ARCollectionMethod = tbARCollectionMethod.Text; agc.AgencyRegNo = tbAgencyNo.Text; agc.Currency = tbCurrency.Text; agc.Comment = tbComment.Text; agc.ApprovalDate = DateTime.Now; agc.IsActive = RadButtonActive.Checked; agc.CreatedId = CurrentUserId; agc.CreatedDate = DateTime.Now; agc.AgencyId = agc.AgencyId; agc.FirstName = agFname.Text; agc.LastName = agLname.Text; agc.Salutation = agTitle.Text; agc.Phone = agPhone.Text; agc.Mobile = agMobile.Text; agc.Fax = agFax.Text; agc.PEmail = agPEmail.Text; agc.SEmail = agSEmail.Text; agc.Website = agWebsite.Text; agc.Address = agAddress.Text; agc.City = agAddress.Text; agc.Province = agProvince.Text; agc.Postal = agPostal.Text; if (ddlAgencyCountry.SelectedValue != string.Empty) { agc.CountryId = Convert.ToInt32(ddlAgencyCountry.SelectedValue); } agc.FirstName1 = agFname1.Text; agc.LastName1 = agLname1.Text; agc.Salutation1 = agTitle1.Text; agc.Phone1 = agPhone1.Text; agc.Mobile1 = agMobile1.Text; agc.Fax1 = agFax1.Text; agc.PEmail1 = agPEmail1.Text; agc.SEmail1 = agSEmail1.Text; agc.Website1 = agWebsite1.Text; agc.Address1 = agAddress1.Text; agc.City1 = agCity1.Text; agc.Province1 = agProvince1.Text; agc.Postal1 = agPostal1.Text; if (ddlAgencyCountry1.SelectedValue != string.Empty) { agc.CountryId1 = Convert.ToInt32(ddlAgencyCountry1.SelectedValue); } int agencyId = cAgency.Add(agc); if (agencyId > 0) { var cAgencySiteLocation = new CAgencySiteLocation(); cAgencySiteLocation.DelAgencySiteLocationList(agencyId); foreach (var siteLocation in RadComboBoxSiteLocation.CheckedItems) { var agencySiteLocation = new AgencySiteLocation() { CreatedId = CurrentUserId, AgencyId = agencyId, SiteLocationId = Convert.ToInt32(siteLocation.Value), CreatedDate = DateTime.Now }; cAgencySiteLocation.Add(agencySiteLocation); } RadGridAgency.Rebind(); ShowMessage("Add Agency Info Successfully"); } } else { ShowMessage("Failed To Add."); } } else if (e.Item.Text == "Old Agency Lookup") { RunClientScript("ShowAgencyOldInfoWindow();"); } }
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); } }
public void GetInvoiceItems() { var btnConfirm = RadToolBar1.FindItemByText("Confirm"); var btnModify = RadToolBar1.FindItemByText("Modify"); var btnCancel = RadToolBar1.FindItemByText("Cancel"); var btnStudentInvoice = RadToolBar1.FindItemByText("Student Invoice"); var btnAgencyInvoice = RadToolBar1.FindItemByText("Agency Invoice"); var btnNewSimpleInvoice = RadToolBar1.FindItemByText("New Simple Invoice"); if (RadGridInvoice.SelectedValue == null) { _sqlDataSourceInvoiceItems.WhereParameters.Clear(); _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, "0"); _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId"; LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, "0"); LinqDataSourceInvoiceHistory.Where = "InvoiceId == @InvoiceId"; } else { var cInvoice = new CInvoice(); var invoice = cInvoice.Get(Convert.ToInt32(RadGridInvoice.SelectedValue.ToString())); _sqlDataSourceInvoiceItems.WhereParameters.Clear(); _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, RadGridInvoice.SelectedValue.ToString()); _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId"; if (invoice.OriginalInvoiceId != null) { LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, invoice.InvoiceId.ToString()); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceNumber", DbType.String, invoice.InvoiceNumber.Substring(2, 8)); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoicePartialIndex", DbType.Int32, invoice.InvoicePartialIndex.ToString()); LinqDataSourceInvoiceHistory.Where = "InvoiceId != @InvoiceId && InvoiceNumber.Contains(@InvoiceNumber) && InvoicePartialIndex < @InvoicePartialIndex"; } else { LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("OriginalInvoiceId", DbType.Int32, "0"); LinqDataSourceInvoiceHistory.Where = "InvoiceId == @OriginalInvoiceId"; } ddlFG.SelectedValue = invoice.IsFinancialGurantee.ToString(); var status = Convert.ToInt32(invoice.Status); var invoiceType = Convert.ToInt32(invoice.InvoiceType); var delete = _radGridInvoiceItems.MasterTableView.GetColumn("DeleteColumn"); if (status == (int)CConstValue.InvoiceStatus.Pending) { switch (invoiceType) { case (int)CConstValue.InvoiceType.Simple: case (int)CConstValue.InvoiceType.General: case (int)CConstValue.InvoiceType.Manual: case (int)CConstValue.InvoiceType.Dormitory: case (int)CConstValue.InvoiceType.Homestay: btnConfirm.Enabled = true; btnModify.Enabled = false; btnCancel.Enabled = true; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.Batch; delete.Visible = true; ddlFG.Enabled = true; break; default: btnConfirm.Enabled = false; //Confirm btnModify.Enabled = false; //Modify btnCancel.Enabled = false; //Cancel btnStudentInvoice.Enabled = true; //Student Invoice Print btnAgencyInvoice.Enabled = true; //Agency Invoice Print _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; } } else if (status == (int)CConstValue.InvoiceStatus.Invoiced) //Invoiced { switch (invoiceType) { case (int)CConstValue.InvoiceType.Simple: case (int)CConstValue.InvoiceType.General: case (int)CConstValue.InvoiceType.Manual: case (int)CConstValue.InvoiceType.Dormitory: case (int)CConstValue.InvoiceType.Homestay: btnConfirm.Enabled = false; btnModify.Enabled = true; btnCancel.Enabled = true; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; default: btnConfirm.Enabled = false; //Confirm btnModify.Enabled = false; //Modify btnCancel.Enabled = false; //Cancel btnStudentInvoice.Enabled = true; //Student Invoice Print btnAgencyInvoice.Enabled = true; //Agency Invoice Print _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; } } else { btnConfirm.Enabled = false; btnModify.Enabled = false; btnCancel.Enabled = false; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; } if (invoice.AgencyId != null) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(invoice.AgencyId)); if (agency != null) { tbAgencyName.Text = agency.Name; if (agency.Location != null) { var country = new CCountry().Get((int)agency.Location); tbCountryCity.Text = country.Name; } else { tbCountryCity.Text = string.Empty; } if (agency.ContractStartDate != null && agency.ContractEndDate != null) { tbContractDate.Text = agency.ContractStartDate.Value.Date.ToString("MM-dd-yyyy") + " - " + agency.ContractEndDate.Value.Date.ToString("MM-dd-yyyy"); } tbCommissionRate.Text = invoice.AgencyRate + "%"; tbDescription.Text = agency.Comment; } } else { tbAgencyName.Text = "Direct Student"; tbCountryCity.Text = string.Empty; tbContractDate.Text = string.Empty; tbCommissionRate.Text = string.Empty; tbDescription.Text = string.Empty; } if (_radGridInvoiceItems.MasterTableView.EditMode == GridEditMode.Batch) { InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(invoice.InvoiceType); } } _radGridInvoiceItems.Rebind(); RadGridInvoiceHistory.Rebind(); }
protected void RadGridAgency_OnPreRender(object sender, EventArgs e) { if (ViewState["AgencyId"] != null) { foreach (GridDataItem item in RadGridAgency.Items) { if (item.GetDataKeyValue("AgencyId").ToString() == ViewState["AgencyId"].ToString()) { if (item.Selected == false) { item.Selected = true; break; } } } } SetApprovalList(); // toolbar foreach (RadToolBarItem toolbarItem in RadToolBarAgency.Items) { if (RadGridAgency.SelectedValue != null) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(RadGridAgency.SelectedValue)); // request active check if (toolbarItem.Text == "Request") { if ((agency.ApprovalStatus == null || agency.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise) && agency.CreatedId == CurrentUserId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } else if (toolbarItem.Text == "Cancel") { if ((agency.ApprovalStatus == null || agency.ApprovalStatus == (int)CConstValue.ApprovalStatus.Revise || agency.ApprovalStatus == (int)CConstValue.ApprovalStatus.Requested) && agency.CreatedId == CurrentUserId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } else if (toolbarItem.Text == "Approve" || toolbarItem.Text == "Reject") { // approve active check var refundApproveInfo = new CGlobal(); var supervisor = refundApproveInfo.CheckApprovalEnable((int)CConstValue.Approval.Agency, Convert.ToInt32(agency.AgencyId)); // supervisor or loy employees if ((CurrentUserId == supervisor) && agency.ApprovalStatus != (int)CConstValue.ApprovalStatus.Approved && agency.ApprovalStatus != (int)CConstValue.ApprovalStatus.Rejected && agency.ApprovalStatus != (int)CConstValue.ApprovalStatus.Canceled && agency.ApprovalStatus != null && CurrentUserId != agency.ApprovalId) { toolbarItem.Enabled = true; } else { toolbarItem.Enabled = false; } } } else { if (toolbarItem.Text == "View") { continue; } toolbarItem.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { Id = Convert.ToInt32(Request["Id"]); if (!IsPostBack) { var cAgency = new CAgency(); ddlAgencyName.DataSource = cAgency.GetAgency(CurrentSiteLocationId); ddlAgencyName.DataTextField = "Name"; ddlAgencyName.DataValueField = "Value"; ddlAgencyName.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlAgencyName.Items.Insert(0, new RadComboBoxItem("Type a Agency Name")); ddlAgencyName.DataBind(); //LoadSite(); // new if (Request["type"] == "0") { GetSiteLocation(false); } // modify else { GetSiteLocation(true); var cP = new CScholarship().Get(Id); foreach (RadComboBoxItem item in ddlAgencyName.Items) { if (item.Value == cP.AgencyId.ToString()) { item.Selected = true; break; } } if (cP.Amount == 0) { rbWeeks.Checked = true; tbWeeks.Text = cP.Weeks.ToString(); } else { rbAmount.Checked = true; RadNumericTextBoxAmount.Value = (double)cP.Amount; } tbExpireDate.SelectedDate = cP.ExpireDate; foreach (RadComboBoxItem item in RadComboBoxMinimum.Items) { if (item.Value == cP.MininumRegistrationWeeks.ToString()) { item.Selected = true; break; } } tbComment.Text = cP.Memo; } } }
protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == "Cancel" && !string.IsNullOrEmpty(hfId.Value)) { if (IsValid) { try { var type = Convert.ToInt32(hfType.Value); var id = Convert.ToInt32(hfId.Value); var cApprovalHistory = new CApprovalHistory(); var approvalHistory = cApprovalHistory.Get(type, id, CurrentUserId); bool isExists = true; if (approvalHistory == null) { approvalHistory = new ApprovalHistory(); approvalHistory.ApprovalUser = CurrentUserId; isExists = false; } approvalHistory.ApprovalDate = DateTime.Now; approvalHistory.ApprovalMemo = tbRemark.Text; approvalHistory.ApprovalStep = (int)CConstValue.ApprovalStatus.Canceled; // update approvalHistory if (isExists) { cApprovalHistory.Update(approvalHistory); } if (type == (int)CConstValue.Approval.Refund) { var cRefund = new CRefund(); var refund = cRefund.Get(id); refund.ApprovalDate = approvalHistory.ApprovalDate; refund.ApprovalId = approvalHistory.ApprovalUser; refund.ApprovalMemo = approvalHistory.ApprovalMemo; refund.ApprovalStatus = approvalHistory.ApprovalStep; if (cRefund.Update(refund)) { var cInvoiceInfo = new CInvoice(); var invoiceInfo = cInvoiceInfo.Get(refund.InvoiceId); var cOriginalInvoiceInfo = new CInvoice(); var originalInvoiceInfo = cOriginalInvoiceInfo.Get(Convert.ToInt32(invoiceInfo.OriginalInvoiceId)); invoiceInfo.Status = (int)CConstValue.InvoiceStatus.Cancelled_RF; // Canceled_R invoiceInfo.UpdatedId = CurrentUserId; originalInvoiceInfo.Status = (int)CConstValue.InvoiceStatus.Invoiced; // Invoiced originalInvoiceInfo.UpdatedId = CurrentUserId; cInvoiceInfo.Update(invoiceInfo); cOriginalInvoiceInfo.Update(originalInvoiceInfo); } } else if (type == (int)CConstValue.Approval.Agency) { var cAgency = new CAgency(); var agency = cAgency.Get(id); agency.ApprovalDate = approvalHistory.ApprovalDate; agency.ApprovalId = approvalHistory.ApprovalUser; agency.ApprovalMemo = approvalHistory.ApprovalMemo; agency.ApprovalStatus = approvalHistory.ApprovalStep; cAgency.Update(agency); } else if (type == (int)CConstValue.Approval.CreditMemoPayout) { var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(id); creditMemoPayout.ApprovalDate = approvalHistory.ApprovalDate; creditMemoPayout.ApprovalId = approvalHistory.ApprovalUser; creditMemoPayout.ApprovalMemo = approvalHistory.ApprovalMemo; creditMemoPayout.ApprovalStatus = approvalHistory.ApprovalStep; cCreditMemoPayout.Update(creditMemoPayout); } else if (type == (int)CConstValue.Approval.Package) { var cPackageProgram = new CPackageProgram(); var packageProgram = cPackageProgram.GetPackageProgram(id); packageProgram.ApprovalDate = approvalHistory.ApprovalDate; packageProgram.ApprovalId = approvalHistory.ApprovalUser; packageProgram.ApprovalMemo = approvalHistory.ApprovalMemo; packageProgram.ApprovalStatus = approvalHistory.ApprovalStep; cPackageProgram.Update(packageProgram); } else if (type == (int)CConstValue.Approval.Promotion) { var cPromotion = new CPromotion(); var promotion = cPromotion.Get(id); promotion.ApprovalDate = approvalHistory.ApprovalDate; promotion.ApprovalId = approvalHistory.ApprovalUser; promotion.ApprovalMemo = approvalHistory.ApprovalMemo; promotion.ApprovalStatus = approvalHistory.ApprovalStep; cPromotion.Update(promotion); } else if (type == (int)CConstValue.Approval.Scholarship) { var cScholarship = new CScholarship(); var scholarship = cScholarship.Get(id); scholarship.ApprovalDate = approvalHistory.ApprovalDate; scholarship.ApprovalId = approvalHistory.ApprovalUser; scholarship.ApprovalMemo = approvalHistory.ApprovalMemo; scholarship.ApprovalStatus = approvalHistory.ApprovalStep; cScholarship.Update(scholarship); } else if (type == (int)CConstValue.Approval.CorporateCreditCard) { var cCorporateCreditCard = new CCorporateCreditCard(); var corporateCreditCard = cCorporateCreditCard.Get(id); corporateCreditCard.ApprovalDate = approvalHistory.ApprovalDate; corporateCreditCard.ApprovalId = approvalHistory.ApprovalUser; corporateCreditCard.ApprovalMemo = approvalHistory.ApprovalMemo; corporateCreditCard.ApprovalStatus = approvalHistory.ApprovalStep; cCorporateCreditCard.Update(corporateCreditCard); } // BusinessTrip else if (type == (int)CConstValue.Approval.BusinessTrip) { 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); } // Purchase Order else if (type == (int)CConstValue.Approval.PurchaseOrder) { 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); } // Expense else if (type == (int)CConstValue.Approval.Expense) { 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); } // Hire else if (type == (int)CConstValue.Approval.Hire) { 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); } // Vacation else if (type == (int)CConstValue.Approval.Vacation) { var cVacation = new CVacation(); var vacation = cVacation.Get(id); vacation.ApprovalDate = approvalHistory.ApprovalDate; vacation.ApprovalId = approvalHistory.ApprovalUser; vacation.ApprovalMemo = approvalHistory.ApprovalMemo; vacation.ApprovalStatus = approvalHistory.ApprovalStep; cVacation.Update(vacation); } RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } } }
protected void MainToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == "Revise" && !string.IsNullOrEmpty(hfId.Value)) { if (IsValid) { try { var type = Convert.ToInt32(hfType.Value); var id = Convert.ToInt32(hfId.Value); var cApprovalHistory = new CApprovalHistory(); var approvalHistory = cApprovalHistory.Get(type, id, CurrentUserId); approvalHistory.ApprovalDate = DateTime.Now; approvalHistory.ApprovalMemo = tbRemark.Text; // Revice approvalHistory.ApprovalStep = (int)CConstValue.ApprovalStatus.Revise; if (type == (int)CConstValue.Approval.Refund) { var cC = new CRefund(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Agency) { var cC = new CAgency(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.CorporateCreditCard) { var cC = new CCorporateCreditCard(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.BusinessTrip) { var cC = new CBusinessTrip(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Package) { var cC = new CPackageProgram(); var c = cC.GetPackageProgram(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Expense) { var cC = new CExpense(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.PurchaseOrder) { var cC = new CPurchaseOrder(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Hire) { var cC = new CHire(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Vacation) { var cC = new CVacation(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Scholarship) { var cC = new CScholarship(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.Promotion) { var cC = new CPromotion(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } else if (type == (int)CConstValue.Approval.CreditMemoPayout) { var cC = new CCreditMemoPayout(); var c = cC.Get(id); c.ApprovalDate = approvalHistory.ApprovalDate; c.ApprovalId = approvalHistory.ApprovalUser; c.ApprovalMemo = approvalHistory.ApprovalMemo; c.ApprovalStatus = approvalHistory.ApprovalStep; cC.Update(c); } // update approvalHistory cApprovalHistory.Update(approvalHistory); new CMail().SendMail((CConstValue.Approval)type, CConstValue.MailStatus.ToRequestUser, id, string.Empty, CurrentUserId); RunClientScript("Close();"); } catch (Exception ex) { ShowMessage(ex.Message); } } } }