public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1"); //scriptManager.RegisterPostBackControl(RadToolBar1.FindItemByText("Excel")); if (CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.IT) { RadToolBar1.FindItemByText("Excel").Visible = true; RadToolBar1.FindItemByText("ExcelDetail").Visible = true; } } // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); // connect event of invoice Items. _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender; InvoiceListSearch(); }
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"; } } } }
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(); }