protected void RadToolBarUserInformation_OnButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Save": var cUsrinfo = new CUserInfomation(); var usrinfo = cUsrinfo.Get(Id); bool isSave = false; if (usrinfo == null) { usrinfo = new Erp2016.Lib.UserInformation(); isSave = true; usrinfo.UserId = Id; usrinfo.CreatedId = CurrentUserId; usrinfo.CreatedDate = DateTime.Now; } else { usrinfo.UpdatedId = CurrentUserId; usrinfo.UpdatedDate = DateTime.Now; } usrinfo.ActualHireDate = RadDatePickerActualHireDate.SelectedDate; usrinfo.JobType = Convert.ToInt32(RadComboBoxJobType.SelectedValue); usrinfo.BankInfo = CheckBoxBank.Checked; usrinfo.Diploma = CheckBoxDiploma.Checked; usrinfo.Resume = CheckBoxResume.Checked; usrinfo.OfferLetter = CheckBoxOfferLetter.Checked; if (isSave) { cUsrinfo.Add(usrinfo); } else { cUsrinfo.Update(usrinfo); } // UP LOAD FileDownloadList1.SaveFile(Id); RunClientScript("Close();"); break; case "Close": RunClientScript("Close();"); break; } }
protected void RadToolBar1_OnButtonClick(object sender, RadToolBarEventArgs e) { if (e.Item.Text == "Save") { var cBulletinBoard = new CBulletinBoard(); var bulletinBoard = cBulletinBoard.Get(Id); if (bulletinBoard == null) { bulletinBoard = new BulletinBoard(); bulletinBoard.CreatedDate = DateTime.Now; bulletinBoard.CreatedId = CurrentUserId; bulletinBoard.Subject = RadTextBoxSubject.Text; bulletinBoard.Body = RadEditorBody.Text; bulletinBoard.Views = 0; ViewState["NewIndex"] = cBulletinBoard.Add(bulletinBoard); } else { bulletinBoard.UpdatedDate = DateTime.Now; bulletinBoard.UpdatedId = CurrentUserId; bulletinBoard.Subject = RadTextBoxSubject.Text; bulletinBoard.Body = RadEditorBody.Content; cBulletinBoard.Update(bulletinBoard); ViewState["NewIndex"] = bulletinBoard.BulletinBoardId; } // save uploading file FileDownloadList1.SaveFile(Convert.ToInt32(ViewState["NewIndex"])); // save other tables RunClientScript("Close();"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }
protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": if (IsValid) { var cRefund1 = new CRefund(); var refund1 = cRefund1.Get(RefundId); FileDownloadList1.SaveFile(refund1.RefundId); var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(refund1.CreditMemoPayoutId); creditMemoPayout = CreditMemoPayout1.GetData(creditMemoPayout); creditMemoPayout.UpdatedId = CurrentUserId; if (cCreditMemoPayout.Update(creditMemoPayout)) { if (cRefund1.Update(refund1)) { if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Refund, RefundId); // approve request var approval = new CApproval().ApproveRequstCreate((int)CConstValue.Approval.Refund, CurrentUserId, RefundId); if (approval > 0) { var cRefund = new CRefund(); var refund = cRefund.Get(RefundId); refund.ApprovalStatus = approval; refund.ApprovalId = CurrentUserId; refund.ApprovalDate = DateTime.Now; //packageProgram.ApprovalMemo = ""; cRefund.Update(refund); new CMail().SendMail(CConstValue.Approval.Refund, CConstValue.MailStatus.ToApproveUser, refund.RefundId, string.Empty, CurrentUserId); RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } else { ShowMessage("Error updating refund"); } } else { ShowMessage("Error updating creditMemoPayout"); } } else { ShowMessage("Error can't find refund"); } break; case "Close": RunClientScript("Close();"); break; } }
//protected void LoadSite() //{ // var global = new CGlobal(); // RadComboBoxSite.DataSource = global.GetSiteId(); // RadComboBoxSite.DataTextField = "Name"; // RadComboBoxSite.DataValueField = "Value"; // RadComboBoxSite.DataBind(); // RadComboBoxSite.Items.Insert(0, new RadComboBoxItem("- Select Site - ")); //} protected void StudentButtonClicked(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": var cPromo = new CPromotion(); var promo = new Erp2016.Lib.Promotion(); // new if (Request["type"] == "0") { promo = new Erp2016.Lib.Promotion(); promo.CreatedId = CurrentUserId; promo.CreatedDate = DateTime.Now; } // modify else { promo = cPromo.Get(Id); } promo.CountryId = Convert.ToInt32(RadComboBoxCountry.SelectedValue); promo.Amount = (decimal)RadNumericTextBoxAmount.Value; promo.Memo = tbComment.Text; promo.CreatedDate = DateTime.Now; promo.CreatedId = CurrentUserId; promo.StartDate = (DateTime)RadDatePickerStartDate.SelectedDate; promo.EndDate = (DateTime)RadDatePickerEndDate.SelectedDate; promo.IsActive = false; int promotionId; // new if (Request["type"] == "0") { promo.IsActive = false; promotionId = cPromo.Add(promo); } // modify else { promo.UpdatedId = CurrentUserId; promo.UpdatedDate = DateTime.Now; cPromo.Update(promo); promotionId = promo.PromotionId; } var cPromotionSiteLocation = new CPromotionSiteLocation(); cPromotionSiteLocation.DelPromotionSiteLocationList(promotionId); foreach (var siteLocation in RadComboBoxSiteLocation.CheckedItems) { var promotionSiteLocation = new PromotionSiteLocation() { CreatedId = CurrentUserId, PromotionId = promotionId, SiteLocationId = Convert.ToInt32(siteLocation.Value), CreatedDate = DateTime.Now }; cPromotionSiteLocation.Add(promotionSiteLocation); } FileDownloadList1.SaveFile(promotionId); if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Promotion, promotionId); var approval = new CApproval().ApproveRequstCreate((int)CConstValue.Approval.Promotion, CurrentUserId, promotionId); if (approval > 0) { var cPromotion = new CPromotion(); var promotion = cPromotion.Get(promotionId); promotion.ApprovalStatus = approval; promotion.ApprovalId = CurrentUserId; promotion.ApprovalDate = DateTime.Now; cPromotion.Update(promotion); new CMail().SendMail(CConstValue.Approval.Promotion, CConstValue.MailStatus.ToApproveUser, promotion.PromotionId, promotion.PromotionMasterNo, CurrentUserId); RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } break; case "Close": RunClientScript("Close();"); break; } }
protected void StudentButtonClicked(object sender, RadToolBarEventArgs e) { if (e.Item.Text == "Update" && RadGridStudentList.SelectedValue != null) { if (IsValid) { var cStud = new CStudent(); var stud = cStud.Get(Convert.ToInt32(RadGridStudentList.SelectedValue)); stud.FirstName = tbFirstName.Text; stud.LastName1 = tbLastName1.Text; stud.LastName2 = tbLastName2.Text; stud.MiddleName1 = tbMiddleName1.Text; stud.MiddleName2 = tbMiddleName2.Text; stud.Address1InCanada = tbCadAddress.Text; stud.CityInCanada = tbCadCity.Text; stud.ProvinceInCanada = tbCadProvince.Text; stud.PostalCodeInCanada = tbCadZipcode.Text; stud.PermanentAddress1 = tbPerAddress.Text; stud.PermanentCity = tbPerCity.Text; stud.PermanentProvince = tbPerState.Text; stud.PermanentPostalCode = tbPerZiocode.Text; stud.PermanentCountry = (ddlPerCountry.SelectedValue == "") ? 239 : Convert.ToInt32(ddlPerCountry.SelectedValue); //239:N/A stud.Phone1 = tbPhone1.Text; stud.Phone2 = tbPhone2.Text; stud.Email1 = tbEmail1.Text; stud.Email2 = tbEmail2.Text; stud.Fax = tbFax.Text; stud.DOB = Convert.ToDateTime(tbDateOfBirth.SelectedDate); stud.StudentType = Convert.ToInt32(ddlStudentType.SelectedValue); stud.Passport = tbPassport.Text; stud.LoanNo = tbLoanNo.Text; stud.ContactName = tbContactName.Text; stud.ContactPhone = tbContactPhone.Text; stud.ContactRelationship = tbContactRelationship.Text; stud.Comment = tbComment.Text; stud.Gender = Convert.ToBoolean(ddlGender.SelectedValue); //stud.MarketerId = Convert.ToInt32(ddlmarketer.SelectedValue); stud.VisaStatus = Convert.ToInt32(ddlStatus.SelectedValue); stud.VisaStart = (tbStatusStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbStatusStartDate.SelectedDate); stud.VisaEnd = (tbStatusEndDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbStatusEndDate.SelectedDate); stud.WorkPermitStatus = Convert.ToInt32(ddlPermit.SelectedValue); stud.WorkPermitStart = (tbPermitStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbPermitStartDate.SelectedDate); stud.WorkPermitEnd = (tbPermitEndDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbPermitEndDate.SelectedDate); stud.Insurance = Convert.ToBoolean(ddlInsurance.SelectedValue); stud.InsuranceStart = (tbInsuranceStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbInsuranceStartDate.SelectedDate); stud.InsuranceEnd = (tbInsuranceEndtDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbInsuranceEndtDate.SelectedDate); stud.InsuranceDayFee = (tbInsuranceDayFee.Text == null || tbInsuranceDayFee.Text == "") ? 0 : Convert.ToDecimal(tbInsuranceDayFee.Text); stud.InsuranceTotal = (tbInsuranceTotalAmt.Text == null || tbInsuranceTotalAmt.Text == "") ? 0 : Convert.ToDecimal(tbInsuranceTotalAmt.Text); stud.CountryId = Convert.ToInt32(ddlCountry.SelectedValue); stud.UpdatedId = CurrentUserId; if (cStud.Update(stud)) { // UP LOAD FileDownloadList1.SaveFile(Convert.ToInt32(RadGridStudentList.SelectedValue)); ShowMessage("Update inqury successfully"); } else { ShowMessage("Failed to update inqury"); } RadGridStudentList.Rebind(); } } }
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; } }
protected void mainToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": if (IsValid) { var cProgram = new CPackageProgram(); Erp2016.Lib.PackageProgram packageProgram1 = null; // new if (hfType.Value == "0") { packageProgram1 = new Erp2016.Lib.PackageProgram(); packageProgram1.CreatedId = CurrentUserId; packageProgram1.CreatedDate = DateTime.Now; } // modify else { packageProgram1 = cProgram.GetPackageProgram(Convert.ToInt32(hfId.Value)); } packageProgram1.ProgramId = Convert.ToInt32(RadComboBoxProgram.SelectedValue); packageProgram1.PackageProgramName = RadTextBoxPackageProgramName.Text; packageProgram1.Description = RadTextBoxDescription.Text; packageProgram1.StartDate = RadDatePickerStartDate.SelectedDate; packageProgram1.EndDate = RadDatePickerEndDate.SelectedDate; int packageProgramId; // new if (hfType.Value == "0") { packageProgram1.IsActive = false; packageProgramId = cProgram.Add(packageProgram1); } // modify else { packageProgram1.UpdatedId = CurrentUserId; packageProgram1.UpdatedDate = DateTime.Now; //packageProgram.IsActive = btnToggleActive.Checked; cProgram.Update(packageProgram1); packageProgramId = packageProgram1.PackageProgramId; } var cPackageProgramSiteLocation = new CPackageProgramSiteLocation(); cPackageProgramSiteLocation.DelPackageProgramSiteLocation(packageProgramId); foreach (var siteLocation in RadComboBoxSiteLocation.CheckedItems) { var packageProgramSiteLocation = new PackageProgramSiteLocation() { CreatedId = CurrentUserId, PackageProgramId = packageProgramId, SiteLocationId = Convert.ToInt32(siteLocation.Value), CreatedDate = DateTime.Now }; cPackageProgramSiteLocation.Add(packageProgramSiteLocation); } FileDownloadList1.SaveFile(packageProgramId); if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Package, packageProgramId); // approve request var approval = new CApproval().ApproveRequstCreate((int)CConstValue.Approval.Package, CurrentUserId, packageProgramId); if (approval > 0) { var cP = new CPackageProgram(); var packageProgram = cP.GetPackageProgram(packageProgramId); packageProgram.ApprovalStatus = approval; packageProgram.ApprovalId = CurrentUserId; packageProgram.ApprovalDate = DateTime.Now; //packageProgram.ApprovalMemo = ""; cP.Update(packageProgram); new CMail().SendMail(CConstValue.Approval.Package, CConstValue.MailStatus.ToApproveUser, packageProgram.PackageProgramId, string.Empty, CurrentUserId); RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } 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 RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "TempSave": case "Request": if (IsValid) { var cC = new CCreditMemoPayout(); var c = new Erp2016.Lib.CreditMemoPayout(); // new if (Request["type"] == "0") { c = new Erp2016.Lib.CreditMemoPayout(); c.CreatedId = CurrentUserId; c.CreatedDate = DateTime.Now; c.CreditMemoId = Id; } // modify else { c = cC.Get(Id); } c = CreditMemoPayout1.GetData(c); c.Amount = (decimal)RadNumericTextBoxAmount.Value; c.IsActive = true; c.SiteLocationId = CurrentSiteLocationId; int creditMemoPayoutId; // new if (Request["type"] == "0") { decimal availableAmount = new CCreditMemo().GetAvailableCreditAmount(Id); if (availableAmount >= c.Amount) { decimal originalAmount = new CCreditMemo().GetOriginalCreditAmount(Id); if ((originalAmount - availableAmount) + c.Amount < 0) { ShowMessage("result of available amount can't be negative amount"); } else { creditMemoPayoutId = cC.Add(c); // save file FileDownloadList1.SaveFile(Id); if (e.Item.Text == "TempSave") { RunClientScript("Close();"); } else { if (SetReqeust(creditMemoPayoutId)) { RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } } else { ShowMessage("paid amount is bigger than available credit amount"); } } // modify else { c.UpdatedId = CurrentUserId; c.UpdatedDate = DateTime.Now; cC.Update(c); creditMemoPayoutId = c.CreditMemoPayoutId; // save file FileDownloadList1.SaveFile(Id); if (SetReqeust(creditMemoPayoutId)) { RunClientScript("Close();"); } else { ShowMessage("error requesting"); } } } break; case "Close": RunClientScript("Close();"); break; } }
protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e) { switch (e.Item.Text) { case "Save": if (IsValid) { var cDeposit = new CDeposit(); Erp2016.Lib.Deposit deposit; // new if (Request["type"] == "0") { deposit = new Erp2016.Lib.Deposit(); deposit.SiteLocationId = CurrentSiteLocationId; deposit.CreatedId = CurrentUserId; deposit.CreatedDate = DateTime.Now; } // modify else { deposit = cDeposit.Get(DepositId); } deposit.Bank = DepositInfomation1.GetBank(); deposit.Comment = DepositInfomation1.GetComment(); deposit.DepositDate = DepositInfomation1.GetDepositDate(); // new if (Request["type"] == "0") { int newIndex = cDeposit.Add(deposit); if (newIndex != -1) { FileDownloadList1.SaveFile(deposit.DepositId); RunClientScript("Close();"); } else { ShowMessage("Error updating"); } } // modify else { deposit.UpdatedId = CurrentUserId; deposit.UpdatedDate = DateTime.Now; if (cDeposit.Update(deposit)) { FileDownloadList1.SaveFile(deposit.DepositId); RunClientScript("Close();"); } else { ShowMessage("Error updating"); } } } else { ShowMessage("Error can't find deposit"); } break; case "Cancel": 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 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 RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { // Save if (e.Item.Text == "TempSave" || e.Item.Text == "Request") { if (IsValid) { var cObj = new CPurchaseOrder(); var obj = cObj.Get(Id); // new one if (obj == null) { obj = new Erp2016.Lib.PurchaseOrder(); obj.CreatedId = Convert.ToInt32(CurrentUserId); obj.CreatedDate = DateTime.Now; int newIndex = Convert.ToInt32(cObj.Add(obj).ToString()); obj = cObj.Get(newIndex); ViewState["NewIndex"] = newIndex; } else { obj.UpdatedId = Convert.ToInt32(CurrentUserId); obj.UpdatedDate = DateTime.Now; ViewState["NewIndex"] = obj.PurchaseOrderId.ToString(); } obj.ApprovalId = CurrentUserId; obj.ApprovalDate = DateTime.Now; if (e.Item.Text == "TempSave") { obj.ApprovalStatus = null; } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.PurchaseOrder, Convert.ToInt32(ViewState["NewIndex"])); // approve request var approval = new CApproval(); var approvalResult = approval.ApproveRequstCreate((int)CConstValue.Approval.PurchaseOrder, CurrentUserId, Convert.ToInt32(ViewState["NewIndex"])); if (approvalResult > 0) { obj.ApprovalStatus = approvalResult; } else { ShowMessage("Failed"); return; } // mail new CMail().SendMail(CConstValue.Approval.PurchaseOrder, CConstValue.MailStatus.ToApproveUser, Convert.ToInt32(ViewState["NewIndex"]), string.Empty, CurrentUserId); } obj.PurchaseOrderType = RadComboBoxType.SelectedIndex; obj.PriorityType = RadComboBoxPriority.SelectedIndex; obj.ShippingMethodType = RadComboBoxShippingMethod.SelectedIndex; obj.ShippingTerms = (int)RadNumericTextBoxShippingTerms.Value; obj.ShippingDeliveryDate = RadDatePickerDeliveryDate.SelectedDate.Value; obj.Description = RadTextBoxDescription.Text; obj.VendorName = RadTextBoxVendorName.Text; obj.VendorAddress = RadTextBoxVendorAddress.Text; obj.VendorCity = RadTextBoxVendorCity.Text; obj.VendorProvince = RadTextBoxVendorProvince.Text; obj.VendorPostalCode = RadTextBoxVendorPostalCode.Text; obj.VendorPhone = RadTextBoxVendorPhone.Text; obj.VendorEmail = RadTextBoxVendorEmail.Text; obj.ShipToName = RadTextBoxShipToName.Text; obj.ShipToAddress = RadTextBoxShipToAddress.Text; obj.ShipToCity = RadTextBoxShipToCity.Text; obj.ShipToProvince = RadTextBoxShipToProvince.Text; obj.ShipToPostalCode = RadTextBoxShipToPostalCode.Text; obj.ShipToPhone = RadTextBoxShipToPhone.Text; obj.ShipToEmail = RadTextBoxShipToEmail.Text; obj.Tax = (decimal)RadNumericTextBoxTax.Value; cObj.Update(obj); // save uploading file FileDownloadList1.SaveFile(Convert.ToInt32(ViewState["NewIndex"])); // save other tables RunClientScript("SaveChanges();"); } else { ShowMessage("Failed"); } } // Revise else if (e.Item.Text == "Revise") { RunClientScript("ShowApprovalReviseWindow('" + Id + "');"); } // Approval else if (e.Item.Text == "Approve") { RunClientScript("ShowApprovalWindow('" + Id + "');"); } // Reject else if (e.Item.Text == "Reject") { RunClientScript("ShowApprovalRejectWindow('" + Id + "');"); } // Accept else if (e.Item.Text == "Accept") { var cObj = new CPurchaseOrder(); var obj = cObj.Get(Id); if (obj != null) { if (!string.IsNullOrEmpty(RadComboBoxReviewType.SelectedValue)) { obj.ReviewType = Convert.ToInt32(RadComboBoxReviewType.SelectedValue); } obj.ReviewMemo = RadTextBoxReviewMemo.Text; obj.ReviewUserId = CurrentUserId; obj.ReviewDate = DateTime.Now; obj.UpdatedId = CurrentUserId; obj.UpdatedDate = DateTime.Now; cObj.Update(obj); //RunClientScript("Close();"); RunClientScript("ShowApprovalAcceptWindow('" + Id + "');"); } } // Complete else if (e.Item.Text == "Complete") { RunClientScript("ShowApprovalCompleteWindow('" + Id + "');"); } // Print else if (e.Item.Text == "Print") { RunClientScript("ShowPrint();"); } // Cancel else if (e.Item.Text == "Cancel") { RunClientScript("ShowApprovalCancelWindow('" + Id + "');"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }
protected void StudentButtonClicked(object sender, RadToolBarEventArgs e) { if (e.Item.Text == @"Save") { if (IsValid) { var cStudentRegi = new CStudent(); var studentRegi = new Erp2016.Lib.Student(); studentRegi.AcademicStatus = 1; // 1:NEW //studentRegi.IsActive = ; //studentRegi.RegisterDate = ; studentRegi.SiteLocationId = Convert.ToInt32(RadComboBoxSiteLocation.SelectedValue); studentRegi.FirstName = tbFirstName.Text; studentRegi.LastName1 = tbLastName1.Text; studentRegi.LastName2 = tbLastName2.Text; studentRegi.MiddleName1 = tbMiddleName1.Text; studentRegi.MiddleName2 = tbMiddleName2.Text; studentRegi.Address1InCanada = tbCadAddress.Text; studentRegi.CityInCanada = tbCadCity.Text; studentRegi.ProvinceInCanada = tbCadProvince.Text; studentRegi.PostalCodeInCanada = tbCadZipcode.Text; studentRegi.PermanentAddress1 = tbPerAddress.Text; studentRegi.PermanentCity = tbPerCity.Text; studentRegi.PermanentProvince = tbPerState.Text; studentRegi.PermanentPostalCode = tbPerZiocode.Text; studentRegi.PermanentCountry = Convert.ToInt32(ddlPerCountry.SelectedValue); studentRegi.Phone1 = tbPhone1.Text; studentRegi.Phone2 = tbPhone2.Text; studentRegi.Email1 = tbEmail1.Text; studentRegi.Email2 = tbEmail2.Text; studentRegi.Fax = tbFax.Text; studentRegi.DOB = Convert.ToDateTime(tbDateOfBirth.SelectedDate); studentRegi.StudentType = Convert.ToInt32(ddlStudentType.SelectedValue); studentRegi.Passport = tbPassport.Text; studentRegi.LoanNo = tbLoanNo.Text; studentRegi.ContactName = tbContactName.Text; studentRegi.ContactPhone = tbContactPhone.Text; studentRegi.ContactRelationship = tbContactRelationship.Text; studentRegi.Comment = tbComment.Text; studentRegi.Gender = Convert.ToBoolean(ddlGender.SelectedValue); if (!string.IsNullOrEmpty(ddlmarketer.SelectedValue)) { studentRegi.MarketerId = Convert.ToInt32(ddlmarketer.SelectedValue); } studentRegi.VisaStatus = Convert.ToInt32(ddlStatus.SelectedValue); studentRegi.VisaStart = (tbStatusStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbStatusStartDate.SelectedDate); studentRegi.VisaEnd = (tbStatusEndDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbStatusEndDate.SelectedDate); studentRegi.WorkPermitStatus = Convert.ToInt32(ddlPermit.SelectedValue); studentRegi.WorkPermitStart = (tbPermitStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbPermitStartDate.SelectedDate); studentRegi.WorkPermitEnd = (tbPermitEndDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbPermitEndDate.SelectedDate); studentRegi.Insurance = Convert.ToBoolean(ddlInsurance.SelectedValue); studentRegi.InsuranceStart = (tbInsuranceStartDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbInsuranceStartDate.SelectedDate); studentRegi.InsuranceEnd = (tbInsuranceEndtDate.SelectedDate == null) ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(tbInsuranceEndtDate.SelectedDate); studentRegi.InsuranceDayFee = (tbInsuranceDayFee.Text == null || tbInsuranceDayFee.Text == "") ? 0 : Convert.ToDecimal(tbInsuranceDayFee.Text); studentRegi.InsuranceTotal = (tbInsuranceTotalAmt.Text == null || tbInsuranceTotalAmt.Text == "") ? 0 : Convert.ToDecimal(tbInsuranceTotalAmt.Text); studentRegi.CountryId = Convert.ToInt32(ddlCountry.SelectedValue); studentRegi.CreatedId = CurrentUserId; int newStudentId = cStudentRegi.Add(studentRegi); if (newStudentId > 0) { // UP LOAD FileDownloadList1.SaveFile(newStudentId); RunClientScript("Save();"); } else { ShowMessage("failed to update the Student');"); } return; } else { ShowMessage("Please check wrong values"); } } else if (e.Item.Text == @"Cancel") { } }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { // Save if (e.Item.Text == "TempSave" || e.Item.Text == "Request") { if (IsValid) { var cObj = new CExpense(); var obj = cObj.Get(Id); // new one if (obj == null) { obj = new Erp2016.Lib.Expense(); obj.CreatedId = Convert.ToInt32(CurrentUserId); obj.CreatedDate = DateTime.Now; int newIndex = Convert.ToInt32(cObj.Add(obj).ToString()); obj = cObj.Get(newIndex); ViewState["NewIndex"] = newIndex; } else { obj.UpdatedId = Convert.ToInt32(CurrentUserId); obj.UpdatedDate = DateTime.Now; ViewState["NewIndex"] = obj.ExpenseId.ToString(); } obj.ApprovalId = CurrentUserId; obj.ApprovalDate = DateTime.Now; if (e.Item.Text == "TempSave") { obj.ApprovalStatus = null; } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.Expense, Convert.ToInt32(ViewState["NewIndex"])); // approve request var approval = new CApproval(); var approvalResult = approval.ApproveRequstCreate((int)CConstValue.Approval.Expense, CurrentUserId, Convert.ToInt32(ViewState["NewIndex"])); if (approvalResult > 0) { obj.ApprovalStatus = approvalResult; } else { ShowMessage("Failed"); return; } // $5000 if (RadNumericTextBoxGrandTotal.Value > 5000) { } new CMail().SendMail(CConstValue.Approval.Expense, CConstValue.MailStatus.ToApproveUser, Convert.ToInt32(ViewState["NewIndex"]), string.Empty, CurrentUserId); } obj.PeriodStart = RadDatePickerStart.SelectedDate; obj.PeriodEnd = RadDatePickerEnd.SelectedDate; obj.CashAdvance = (decimal)RadNumericTextBoxCashAdvance.Value; cObj.Update(obj); // save uploading file FileDownloadList1.SaveFile(Convert.ToInt32(ViewState["NewIndex"])); // save other tables RunClientScript("SaveChanges();"); } else { ShowMessage("Failed"); } } // Revise else if (e.Item.Text == "Revise") { RunClientScript("ShowApprovalReviseWindow('" + Id + "');"); } // Approval else if (e.Item.Text == "Approve") { RunClientScript("ShowApprovalWindow('" + Id + "');"); } // Reject else if (e.Item.Text == "Reject") { RunClientScript("ShowApprovalRejectWindow('" + Id + "');"); } // Accept else if (e.Item.Text == "Accept") { RunClientScript("ShowApprovalAcceptWindow('" + Id + "');"); } // Complete else if (e.Item.Text == "Complete") { RunClientScript("ShowApprovalCompleteWindow('" + Id + "');"); } // Print else if (e.Item.Text == "Print") { RunClientScript("ShowPrint();"); } // Cancel else if (e.Item.Text == "Cancel") { RunClientScript("ShowApprovalCancelWindow('" + Id + "');"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }
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.Invoiced_Hold; original.UpdatedId = CurrentUserId; if (cInvoice.Update(original)) { var cRefundInvoice = new CInvoice(); var refundInvoice = new Erp2016.Lib.Invoice(); CGlobal.Copy(original, refundInvoice); refundInvoice.OriginalInvoiceId = original.InvoiceId; switch (original.InvoiceType) { case (int)CConstValue.InvoiceType.General: case (int)CConstValue.InvoiceType.Simple: case (int)CConstValue.InvoiceType.Manual: refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_RF; break; case (int)CConstValue.InvoiceType.Homestay: refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_HR; break; case (int)CConstValue.InvoiceType.Dormitory: refundInvoice.InvoiceType = (int)CConstValue.InvoiceType.Refund_DR; break; } refundInvoice.Status = (int)CConstValue.InvoiceStatus.Pending; refundInvoice.CreatedId = CurrentUserId; refundInvoice.CreatedDate = DateTime.Now; var invoiceId = cRefundInvoice.Add(refundInvoice); if (invoiceId > 0) { var refundInvoiceItems = new CInvoiceItem(); refundInvoiceItems.RefundItemsUpdate(original.InvoiceId, invoiceId, Convert.ToDecimal(RefundInfo1.GetRefundRate().Value), CurrentUserId); var cCreditMemo = new CCreditMemo(); var creditMemo = new CreditMemo(); creditMemo.CreditMemoType = (int)CConstValue.CreditMemoType.Refund; creditMemo.InvoiceId = invoiceId; //Refund Invoice Id creditMemo.OriginalCreditMemoAmount = 0; creditMemo.CreatedId = CurrentUserId; creditMemo.CreatedDate = DateTime.Now; creditMemo.IsActive = false; var creditMemoId = cCreditMemo.Add(creditMemo); if (creditMemoId > 0) { var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = new CreditMemoPayout(); creditMemoPayout.CreditMemoId = creditMemoId; creditMemoPayout.Amount = 0; creditMemoPayout.IsActive = false; creditMemoPayout.CreatedId = CurrentUserId; creditMemoPayout.CreatedDate = DateTime.Now; var creditMemoPayoutId = cCreditMemoPayout.Add(creditMemoPayout); if (creditMemoPayoutId > 0) { var cRefund = new CRefund(); var refund = new Refund(); refund.CreditMemoPayoutId = creditMemoPayoutId; refund.InvoiceId = invoiceId; refund.RefundDate = Convert.ToDateTime(RefundInfo1.RadActualDate().SelectedDate); refund.RefundRate = Convert.ToDouble(RefundInfo1.GetRefundRate().Value); refund.RefundReason = RefundInfo1.GetReason().Text; refund.IsActive = false; refund.CreatedId = CurrentUserId; refund.CreatedDate = DateTime.Now; if (cRefund.Add(refund) > 0) { // save uploading file FileDownloadList1.SaveFile(refund.RefundId); RunClientScript("Close();"); } ShowMessage("failed to update inqury (Add Refund Info)"); } else { ShowMessage("failed to update inqury (Add CreditMemoPayout)"); } } else { ShowMessage("failed to update inqury (Add CreditMemo)"); } } else { ShowMessage("failed to update inqury (Add Refund Invoice)"); } } 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; } }
private void HirePop_FileUploaded(object sender, FileUploadedEventArgs e) { // save uploading file FileDownloadList1.SaveFile(Id); }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { // Save if (e.Item.Text == "TempSave" || e.Item.Text == "Request") { if (IsValid) { var cObj = new CBusinessTrip(); var obj = cObj.Get(Id); // new one if (obj == null) { obj = new Erp2016.Lib.BusinessTrip(); obj.CreatedId = Convert.ToInt32(CurrentUserId); obj.CreatedDate = DateTime.Now; int newIndex = Convert.ToInt32(cObj.Add(obj).ToString()); obj = cObj.Get(newIndex); ViewState["NewIndex"] = newIndex; } else { obj.UpdatedId = Convert.ToInt32(CurrentUserId); obj.UpdatedDate = DateTime.Now; ViewState["NewIndex"] = obj.BusinessTripId.ToString(); } obj.ApprovalId = CurrentUserId; obj.ApprovalDate = DateTime.Now; if (e.Item.Text == "TempSave") { obj.ApprovalStatus = null; } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.BusinessTrip, Convert.ToInt32(ViewState["NewIndex"])); // approve request var approval = new CApproval(); var approvalResult = approval.ApproveRequstCreate((int)CConstValue.Approval.BusinessTrip, CurrentUserId, Convert.ToInt32(ViewState["NewIndex"])); if (approvalResult > 0) { obj.ApprovalStatus = approvalResult; } else { ShowMessage("Failed"); return; } // mail new CMail().SendMail(CConstValue.Approval.BusinessTrip, CConstValue.MailStatus.ToApproveUser, Convert.ToInt32(ViewState["NewIndex"]), string.Empty, CurrentUserId); } obj.Type = RadButtonLocal.Checked ? RadButtonLocal.Text : RadButtonOverseas.Text; obj.AirSub = Convert.ToDecimal(GetAirRate().Value); obj.AccomSub = Convert.ToDecimal(GetAccomRate().Value); obj.GroundSub = Convert.ToDecimal(GetGroundRate().Value); obj.MealsSub = Convert.ToDecimal(GetMealsRate().Value); obj.CashSub = Convert.ToDecimal(GetCashAdvanceTotal().Value); obj.GrandSub = Convert.ToDecimal(RadNumericTextBoxGrandTotal.Value); cObj.Update(obj); // save uploading file FileDownloadList1.SaveFile(Convert.ToInt32(ViewState["NewIndex"])); // save other tables RunClientScript("SaveChanges();"); } } // Revise else if (e.Item.Text == "Revise") { RunClientScript("ShowApprovalReviseWindow('" + Id + "');"); } // Approval else if (e.Item.Text == "Approve") { RunClientScript("ShowApprovalWindow('" + Id + "');"); } // Reject else if (e.Item.Text == "Reject") { RunClientScript("ShowApprovalRejectWindow('" + Id + "');"); } // Accept else if (e.Item.Text == "Accept") { RunClientScript("ShowApprovalAcceptWindow('" + Id + "');"); } // Complete else if (e.Item.Text == "Complete") { RunClientScript("ShowApprovalCompleteWindow('" + Id + "');"); } // Cancel else if (e.Item.Text == "Cancel") { RunClientScript("ShowApprovalCancelWindow('" + Id + "');"); } // Print else if (e.Item.Text == "Print") { RunClientScript("ShowPrint();"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { // Save if (e.Item.Text == "Save") { if (IsValid) { var cObj = new CInventory(); var obj = cObj.Get(Id); var isNew = false; // new one if (obj == null) { obj = new Erp2016.Lib.Inventory(); obj.CreatedId = Convert.ToInt32(CurrentUserId); obj.CreatedDate = DateTime.Now; isNew = true; } else { obj.UpdatedId = Convert.ToInt32(CurrentUserId); obj.UpdatedDate = DateTime.Now; } obj.InventoryCategoryItemId = Convert.ToInt32(RadComboBoxInventoryCategoryItem.SelectedValue); obj.SiteLocationId = Convert.ToInt32(RadComboBoxSiteLocation.SelectedValue); obj.AssignedUserId = Convert.ToInt32(RadComboBoxAssignedUser.SelectedValue); obj.ConditionType = Convert.ToInt32(RadComboBoxCondition.SelectedValue); obj.InUseType = Convert.ToInt32(RadComboBoxInUse.SelectedValue); obj.Company = RadTextBoxCompany.Text; obj.Price = (decimal)(RadNumericTextBoxPrice.Value ?? 0); obj.PurchasedDate = RadDatePickerPurchased.SelectedDate?.Date; obj.ExpireDate = RadDatePickerExpire.SelectedDate?.Date; obj.Department = RadTextBoxDepartment.Text; obj.ModelNo = RadTextBoxModelNo.Text; obj.SerialNo = RadTextBoxSerialNo.Text; var index = 0; if (isNew) { index = cObj.Add(obj); } else { cObj.Update(obj); index = obj.InventoryId; } // save uploading file FileDownloadList1.SaveFile(index); RunClientScript("Close();"); } else { ShowMessage("Failed"); } } // Print else if (e.Item.Text == "Print") { RunClientScript("ShowPrint();"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { // Save if (e.Item.Text == "TempSave" || e.Item.Text == "Request") { if (IsValid) { var corporateCreditCardSchema = new CCorporateCreditCardSchema().GetByUserId(CurrentUserId); if (corporateCreditCardSchema != null) { var corporateCreditCard = new CCorporateCreditCard().GetByUserId(CurrentUserId); if (corporateCreditCard != null) { var startDay = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 4); var endDay = startDay.AddMonths(1); if (corporateCreditCard.PeriodStart >= startDay && corporateCreditCard.PeriodEnd < endDay) { ShowMessage("Credit on this month is already requested. Try it again when 4th beginning of month."); return; } } if (RadNumericTextBoxGrandTotal.Value > (double)corporateCreditCardSchema.CreditLimit) { ShowMessage("Your limited Credit Amount of is " + corporateCreditCardSchema.CreditLimit); return; } var cObj = new CCorporateCreditCard(); var obj = cObj.Get(Id); // new one if (obj == null) { obj = new Erp2016.Lib.CorporateCreditCard(); obj.CreatedId = Convert.ToInt32(CurrentUserId); obj.CreatedDate = DateTime.Now; obj.PeriodStart = (DateTime)RadDatePickerStart.SelectedDate; obj.PeriodEnd = (DateTime)RadDatePickerEnd.SelectedDate; int newIndex = Convert.ToInt32(cObj.Add(obj).ToString()); obj = cObj.Get(newIndex); ViewState["NewIndex"] = newIndex; } else { obj.PeriodStart = (DateTime)RadDatePickerStart.SelectedDate; obj.PeriodEnd = (DateTime)RadDatePickerEnd.SelectedDate; obj.UpdatedId = Convert.ToInt32(CurrentUserId); obj.UpdatedDate = DateTime.Now; ViewState["NewIndex"] = obj.CorporateCreditCardId.ToString(); } obj.ApprovalId = CurrentUserId; obj.ApprovalDate = DateTime.Now; if (e.Item.Text == "TempSave") { obj.ApprovalStatus = null; } else { var cApprovalHistory = new CApprovalHistory(); cApprovalHistory.DelApprovalHistory((int)CConstValue.Approval.CorporateCreditCard, Convert.ToInt32(ViewState["NewIndex"])); // approve request var approval = new CApproval(); var approvalResult = approval.ApproveRequstCreate((int)CConstValue.Approval.CorporateCreditCard, CurrentUserId, Convert.ToInt32(ViewState["NewIndex"])); if (approvalResult > 0) { obj.ApprovalStatus = approvalResult; } else { ShowMessage("Failed"); return; } new CMail().SendMail(CConstValue.Approval.CorporateCreditCard, CConstValue.MailStatus.ToApproveUser, Convert.ToInt32(ViewState["NewIndex"]), string.Empty, CurrentUserId); } cObj.Update(obj); // save uploading file FileDownloadList1.SaveFile(Convert.ToInt32(ViewState["NewIndex"])); // save other tables RunClientScript("SaveChanges();"); } else { ShowMessage("not found Limit credit amount. It needs to be registered."); } } else { ShowMessage("Failed"); } } // Revise else if (e.Item.Text == "Revise") { RunClientScript("ShowApprovalReviseWindow('" + Id + "');"); } // Approval else if (e.Item.Text == "Approve") { RunClientScript("ShowApprovalWindow('" + Id + "');"); } // Reject else if (e.Item.Text == "Reject") { RunClientScript("ShowApprovalRejectWindow('" + Id + "');"); } // Accept else if (e.Item.Text == "Accept") { RunClientScript("ShowApprovalAcceptWindow('" + Id + "');"); } // Complete else if (e.Item.Text == "Complete") { RunClientScript("ShowApprovalCompleteWindow('" + Id + "');"); } // Print else if (e.Item.Text == "Print") { RunClientScript("ShowPrint();"); } // Cancel else if (e.Item.Text == "Cancel") { RunClientScript("ShowApprovalCancelWindow('" + Id + "');"); } // close else if (e.Item.Text == "Close") { RunClientScript("Close();"); } }