// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP5 - SUMMARY // // //////////////////////////////////////////////////////////////////////// // STEP5 - SUMMARY - METHODS // private void StepSummaryIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Summary"; hdfUpdate.Value = "yes"; string isTowable = "No"; if (cbxIsTowable.Checked) isTowable = "Yes"; else isTowable = "No"; string unitType = (rbtnVehicle.Checked) ? unitType = "Vehicle" : unitType = "Equipment"; string vinOrSerialNumber = (rbtnVehicle.Checked) ? vinOrSerialNumber = "VIN" : vinOrSerialNumber = "Serial Number"; string categoriesSelected = ""; foreach (int categoryId in arrayCategoriesSelected) { CategoryGateway categoryGateway = new CategoryGateway(); categoryGateway.LoadByCategoryId(categoryId, Int32.Parse(hdfCompanyId.Value)); categoriesSelected += categoryGateway.GetName(categoryId) + ", "; } if (categoriesSelected.Length > 2) { categoriesSelected = categoriesSelected.Substring(0, categoriesSelected.Length - 2); } string companyLevelsSelected = ""; foreach (int companyLevelId in arrayCompanyLevelsSelected) { CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevelId, Int32.Parse(hdfCompanyId.Value)); companyLevelsSelected += companyLevelGateway.GetName(companyLevelId) + ", "; } if (companyLevelsSelected.Length > 2) { companyLevelsSelected = companyLevelsSelected.Substring(0, companyLevelsSelected.Length - 2); } tbxSummary.Text = "Unit Type: " + unitType + "\nCode: " + tbxCode.Text + "\nDescription: " + tbxDescription.Text + "\n" + vinOrSerialNumber + ": " + tbxVinSerialNumber.Text + "\nManufacturer: " + tbxManufacturer.Text + "\nModel: " + tbxModel.Text + "\nYear: " + tbxYear.Text + "\nIs Towable?: " + isTowable + "\nCategories: " + categoriesSelected + "\nCompany Levels: " + companyLevelsSelected; if (rbtnVehicle.Checked) { string licenseCountry = ""; string licenceState = ""; if (ddlLicenseCountry.SelectedValue != "-1") { licenseCountry = ddlLicenseCountry.SelectedItem.Text; if (ddlLicenseState.SelectedValue != "-1" && ddlLicenseState.SelectedValue != "") { licenceState = ddlLicenseState.SelectedItem.Text; } } tbxSummary.Text += "\nLicense Country: " + licenseCountry + "\nLicense State: " + licenceState + "\nLicense Plate Number: " + tbxLicensePlateNumber.Text + "\nApportioned Tag Number: " + tbxApportionedTagNumber.Text; } }
/// <summary> /// Save /// </summary> /// <returns>newCompanyLevelIdForInsert</returns> public int Save() { int companyLevelIdForManagers = 0 ; foreach (CompanyLevelsAddTDS.CompanyLevelsAddNewRow row in (CompanyLevelsAddTDS.CompanyLevelsAddNewDataTable)Data.Tables["CompanyLevelsAddNew"]) { // Insert CompanyLevel if ((!row.Deleted) && (!row.InDatabase)) { int? parentId = null; if (!row.IsParentIDNull()) parentId = row.ParentID; string unitsUnitOfMeasurement = ""; if (!row.IsUnitsUnitOfMeasurementNull()) unitsUnitOfMeasurement = row.UnitsUnitOfMeasurement; companyLevelIdForManagers = InsertCompanyLevel(row.Name, parentId, row.Deleted, row.COMPANY_ID, unitsUnitOfMeasurement); } // Update CompanyLevel if ((!row.Deleted) && (row.InDatabase)) { int companyId = row.COMPANY_ID; CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(row.CompanyLevelID, companyId); int companyLevelId = row.CompanyLevelID; companyLevelIdForManagers = row.CompanyLevelID; string originalName = companyLevelGateway.GetName(companyLevelId); int? originalParentId = null; if (companyLevelGateway.GetParentId(companyLevelId).HasValue) originalParentId = (int)companyLevelGateway.GetParentId(companyLevelId); bool originalDeleted = companyLevelGateway.GetDeleted(companyLevelId); UpdateCompanyLevel(companyLevelId, originalName, originalParentId, originalDeleted, companyId, row.UnitsUnitOfMeasurement, companyLevelId, row.Name, originalParentId, row.Deleted, companyId, row.UnitsUnitOfMeasurement); } // Delete CompanyLevel if ((row.Deleted) && (row.InDatabase)) { int companyLevelId = row.CompanyLevelID; companyLevelIdForManagers = row.CompanyLevelID; int? newCompanyLevelId = null; if (!row.IsNewCompanyLevelIDNull()) newCompanyLevelId = row.NewCompanyLevelID; int companyId = row.COMPANY_ID; UpdateUnitsAndRulesCompanyLevels(companyLevelId, newCompanyLevelId, companyId); DeleteCompanyLevel(companyLevelId, companyId); } } return companyLevelIdForManagers; }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP6 - SUMMARY // // //////////////////////////////////////////////////////////////////////// // STEP6 - SUMMARY - METHODS // private void StepSummaryIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Summary"; hdfUpdate.Value = "yes"; string mto = "No"; if (cbxMtoDot.Checked) mto = "Yes"; string generateServiceRequest = tbxServicesRequestDaysBefore.Text + " days before"; string categoriesSelected = ""; foreach (int categoryId in arrayCategoriesSelected) { CategoryGateway categoryGateway = new CategoryGateway(); categoryGateway.LoadByCategoryId(categoryId, Int32.Parse(hdfCompanyId.Value)); categoriesSelected += categoryGateway.GetName(categoryId)+ ", "; } if (categoriesSelected.Length > 2) { categoriesSelected = categoriesSelected.Substring(0, categoriesSelected.Length - 2); } string unitsSelected = ""; foreach (ListItem lst in cbxlUnitsSelected.Items) { if (lst.Selected) unitsSelected += lst.Text + ", "; } if (unitsSelected.Length > 2) { unitsSelected = unitsSelected.Substring(0, unitsSelected.Length - 2); } string companyLevelsSelected = ""; foreach (int companyLevelId in arrayCompanyLevelsSelected) { CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevelId, Int32.Parse(hdfCompanyId.Value)); companyLevelsSelected += companyLevelGateway.GetName(companyLevelId) + ", "; } if (companyLevelsSelected.Length > 2) { companyLevelsSelected = companyLevelsSelected.Substring(0, companyLevelsSelected.Length - 2); } tbxSummary.Text = "Name: " + tbxName.Text + "\nFixed Date: " + mto + "\nDescription: " + tbxDescription.Text + "\nFrequency: " + ddlFrequency.SelectedValue + "\nGenerate Service Request?: " + generateServiceRequest + "\nCompany Levels: " + companyLevelsSelected+ "\nCategories: " + categoriesSelected + "\nUnits: " + unitsSelected ; }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP5 - SUMMARY // // //////////////////////////////////////////////////////////////////////// // STEP5 - SUMMARY - METHODS // private void StepSummaryIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Summary"; hdfUpdate.Value = "yes"; // Operation if (rbtnAddCompanyLevel.Checked) tbxSummary.Text = "Operation: Add company level"; if (rbtnDeleteCompanyLevel.Checked) tbxSummary.Text = "Operation: Delete company level"; if (rbtnEditCompanyLevel.Checked) tbxSummary.Text = "Operation: Edit company level"; // Update managers int companyId = Int32.Parse(hdfCompanyId.Value); foreach (int companyLevelIdInArray in arrayCompanyLevelsSelected) { if (rbtnDeleteCompanyLevel.Checked) { CompanyLevelsAddManagers companyLevelMangers = new CompanyLevelsAddManagers(companyLevelsAddTDS); companyLevelMangers.UpdateManagers(companyLevelIdInArray, companyId); } //Tag page hdfCompanyLevelId.Value = companyLevelIdInArray.ToString(); } Session["companyLevelsAddTDS"] = companyLevelsAddTDS; Session["companyLevelManagers"] = companyLevelsAddTDS.CompanyLevelManagers; companyLevelManagers = companyLevelsAddTDS.CompanyLevelManagers; // Company Levels if (!rbtnDeleteCompanyLevel.Checked) { if (arrayCompanyLevelsSelected.Count > 0) { foreach (int companyLevelIdInArray in arrayCompanyLevelsSelected) { CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevelIdInArray, int.Parse(hdfCompanyId.Value)); tbxSummary.Text += "\nParent company level: " + companyLevelGateway.GetName(companyLevelIdInArray); } } else { tbxSummary.Text += "\nParent company level: (Empty)"; } } // Name if (!rbtnDeleteCompanyLevel.Checked) { tbxSummary.Text += "\nName: " + tbxName.Text.Trim(); } else { foreach (int companyLevelIdInArray in arrayCompanyLevelsSelected) { CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevelIdInArray, int.Parse(hdfCompanyId.Value)); tbxSummary.Text += "\nName: " + companyLevelGateway.GetName(companyLevelIdInArray); } } // Unit Of Measurement tbxSummary.Text += "\nUnit Of Measurement: " + tbxUnitsUnitOfMeasurement.Text.Trim(); // Managers CompanyLevelsAddManagers companyLevelManagersForSummary = new CompanyLevelsAddManagers(companyLevelsAddTDS); tbxSummary.Text += "\nManagers: " + companyLevelManagersForSummary.GetManagers(); }