protected void btnDelete_Click(object sender, EventArgs e) { int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); PostPageChanges(); int unitId = GetUnitId(); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); string unitState = unitsGateway.GetState(unitId); if (unitId > 0) { switch (Delete(unitId, companyId)) { case 0: // Store active tab for postback Session["activeTabUnits"] = "0"; Session["dialogOpenedUnits"] = "0"; // Redirect string url = "./units_delete.aspx?source_page=units_navigator2.aspx&unit_id=" + unitId + "&unit_type=" + unitType + "&unit_state=" + unitState + GetNavigatorState() + "&update=yes&active_tab=0"; Response.Redirect(url); break; case 1: cvSelection.ErrorMessage = "The unit has been registered in a Timesheet, you cannot delete it."; cvSelection.IsValid = false; break; case 2: cvSelection.ErrorMessage = "The unit has been registered in the Add Team Project Time wizard, you cannot delete him."; cvSelection.IsValid = false; break; case 3: cvSelection.ErrorMessage = "The unit has been registered in the Add Team Project Time wizard, you cannot delete him."; cvSelection.IsValid = false; break; case 4: cvSelection.ErrorMessage = "The unit has services active, you cannot delete him."; cvSelection.IsValid = false; break; } } else { RestoreNavigatorState(); cvSelection.IsValid = false; } }
public string GetUrl(object str) { int unitId = Int32.Parse(str.ToString()); int companyId = Int32.Parse(hdfCompanyId.Value); string url = ""; UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); if (unitsGateway.Table.Rows.Count > 0) { string unitType = unitsGateway.GetType(unitId); string unitState = unitsGateway.GetState(unitId); url = "./../../Units/units_summary.aspx?source_page=wucAlarms.ascx&dashboard=True&dashboard=True&unit_id=" + unitId + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=0" + GetNavigatorState(); } return url; }
protected void cvCompleteMileage_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = true; int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfServiceId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(serviceInformationTDS); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); if (unitType == "Vehicle") { if (tbxPnlCompleteWorkCompleteMileage.Text == "") { args.IsValid = false; } } }
/// <summary> /// DeleteDirect /// </summary> /// <param name="unitId">unitId</param> /// <param name="unitType">unitType</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int unitId, string unitType, int companyId) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); if (unitsGateway.Table.Rows.Count > 0) { // ... Delete unit categories UnitsCategory unitsCategory = new UnitsCategory(null); UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(); unitsCategoryGateway.LoadByUnitId(unitId, companyId); foreach (UnitsTDS.LFS_FM_UNIT_CATEGORYRow rowCategories in (UnitsTDS.LFS_FM_UNIT_CATEGORYDataTable)unitsCategoryGateway.Table) { unitsCategory.DeleteDirect(unitId, rowCategories.CategoryID, companyId); } // ... if vehicle type then delete unit if (unitType == "Vehicle") { UnitsVehicle unitsVehicle = new UnitsVehicle(null); unitsVehicle.DeleteDirect(unitId, companyId); } // ... Delete inspections UnitsInspection unitsInspection = new UnitsInspection(null); UnitsInspectionGateway unitsInspectionGateway = new UnitsInspectionGateway(); unitsInspectionGateway.LoadByUnitId(unitId, companyId); foreach (UnitsTDS.LFS_FM_UNIT_INSPECTIONRow rowInspections in (UnitsTDS.LFS_FM_UNIT_INSPECTIONDataTable)unitsInspectionGateway.Table) { unitsInspection.DeletedDirect(unitId, rowInspections.InspectionID, companyId); } // ... Delete unit unitsGateway.Delete(unitId, companyId); } }
private void Generate() { mReport1 master = (mReport1)this.Master; // Get Data string projectTimeState = (ddlProjectTimeState.SelectedValue == "(All)") ? "%" : ddlProjectTimeState.SelectedValue; PrintVehicleLocationGateway printVehicleLocationGateway = new PrintVehicleLocationGateway(); if (ddlCountry.SelectedValue == "(All)") { if (ddlUnit.SelectedValue == "-1") { printVehicleLocationGateway.LoadByStartDateEndDateProjectTimeState(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), projectTimeState); } else { printVehicleLocationGateway.LoadByStartDateEndDateUnitIdProjectTimeState(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), int.Parse(ddlUnit.SelectedValue), projectTimeState); } } else { if (ddlUnit.SelectedValue == "-1") { printVehicleLocationGateway.LoadByStartDateEndDateProjectTimeStateCountryId(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), projectTimeState, int.Parse(ddlCountry.SelectedValue)); } else { printVehicleLocationGateway.LoadByStartDateEndDateUnitIdProjectTimeStateCountryId(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), int.Parse(ddlUnit.SelectedValue), projectTimeState, int.Parse(ddlCountry.SelectedValue)); } } // ... set properties to master page master.Data = printVehicleLocationGateway.Data; master.Table = printVehicleLocationGateway.TableName; // Get report int companyId = Convert.ToInt32(Session["companyID"]); if (printVehicleLocationGateway.Table.Rows.Count > 0) { if (master.Format == "pdf") { master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintVehicleLocationReport(); } else { master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintVehicleLocationReportExport(); } // ... set parameters to report if (master.Format == "pdf") { // ... For report // ... ... project time state if (ddlProjectTimeState.SelectedValue == "(All)") { master.SetParameter("projectTimeState", "All"); } else { master.SetParameter("projectTimeState", ddlProjectTimeState.SelectedItem.Text); } // ... ... unit if (ddlUnit.SelectedValue == "-1") { master.SetParameter("unitName", "All"); } else { int unitId = Int32.Parse(ddlUnit.SelectedValue); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitName = "(" + unitsGateway.GetUnitCode(unitId) + ") " + unitsGateway.GetDescription(unitId); master.SetParameter("unitName", unitName); } // ... ... user int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); // ... ... dates master.SetParameter("dateFrom", tkrdpStartDate.SelectedDate.Value.ToShortDateString()); master.SetParameter("dateTo", tkrdpEndDate.SelectedDate.Value.ToShortDateString()); // ... ... country if (ddlCountry.SelectedValue == "2") { master.SetParameter("Country", "USA"); } else { if (ddlCountry.SelectedValue == "1") { master.SetParameter("Country", "Canada"); } else { master.SetParameter("Country", "All"); } } } } }
protected void Page_PreRender(object sender, EventArgs e) { // Set active toolbar mForm6 master = (mForm6)this.Master; master.ActiveToolbar = "FleetManagement"; // Validate left menu if the user has admin permission if (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_SERVICES_ADMIN"])) { tkrpbLeftMenuAllServiceRequests.Visible = true; tkrpbLeftMenuMyServiceRequests.Visible = false; tkrpbLeftMenuTools.Visible = true; } else { tkrpbLeftMenuAllServiceRequests.Visible = false; tkrpbLeftMenuMyServiceRequests.Visible = true; tkrpbLeftMenuTools.Visible = false; } // Tabs validation // ... Validate vehicle info int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfServiceId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(serviceInformationTDS); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); int companyLevel = unitsGateway.GetCompanyLevelId((int)unitId); if (unitType != "Vehicle") { lblGeneralMileage.Visible = false; tbxGeneralMileage.Visible = false; lblGeneralMileageUnitOfMeasurement.Visible = false; lblStartWorkDataStartMileage.Visible = false; tbxStartWorkDataStartMileage.Visible = false; lblStartWorkDataMileageUnitOfMeasurement.Visible = false; lblCompleteWorkDataCompleteMileage.Visible = false; tbxCompleteWorkDataCompleteMileage.Visible = false; lblCompleteWorkDataMileageUnitOfMeasurement.Visible = false; } else { lblGeneralMileage.Visible = true; tbxGeneralMileage.Visible = true; lblStartWorkDataStartMileage.Visible = true; tbxStartWorkDataStartMileage.Visible = true; lblCompleteWorkDataCompleteMileage.Visible = true; tbxCompleteWorkDataCompleteMileage.Visible = true; lblGeneralMileageUnitOfMeasurement.Visible = true; lblStartWorkDataMileageUnitOfMeasurement.Visible = true; lblCompleteWorkDataMileageUnitOfMeasurement.Visible = true; } // ... Validate Assignation result hdfServiceState.Value = serviceInformationBasicInformationGatewayForId.GetServiceState(serviceId); string state = hdfServiceState.Value; if ((state == "Accepted") || (state == "In Progress") || (state == "Completed")) { pnlAssignmentAccept.Visible = true; pnlAssignmentReject.Visible = false; } else { if (state == "Rejected") { pnlAssignmentAccept.Visible = false; pnlAssignmentReject.Visible = true; } else { pnlAssignmentAccept.Visible = false; pnlAssignmentReject.Visible = false; } } // ... Validate for assignated person if (serviceInformationBasicInformationGatewayForId.GetToTeamMember(serviceId)) { pnlTeamMemberAssigned.Visible = true; pnlThirdPartyVendorAssigned.Visible = false; } else { pnlTeamMemberAssigned.Visible = false; pnlThirdPartyVendorAssigned.Visible = true; } // Validations for Top Menu // ... Get user and service data // ... ... Get logged employeeId int loginId = Int32.Parse(hdfLoginId.Value); bool serviceAdmin = Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_SERVICES_ADMIN"]); EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet()); int employeeId = employeeGateway.GetEmployeIdByLoginId(loginId); // ... ... Get ownerId, assignTeamMemberId int ownerId = serviceInformationBasicInformationGatewayForId.GetOwnerID(serviceId); int? assignTeamMemberId = null; if (serviceInformationBasicInformationGatewayForId.GetAssignTeamMemberId(serviceId).HasValue) assignTeamMemberId = (int)serviceInformationBasicInformationGatewayForId.GetAssignTeamMemberId(serviceId); // ... Delete option if (((employeeId == ownerId) || (serviceAdmin)) && (IsDeletedSR(serviceId))) { tkrmTop.Items[1].Visible = true; } else { tkrmTop.Items[1].Visible = false; } // ... Assign option if ((serviceAdmin) && ((state == "Unassigned") || (state == "Rejected"))) { tkrmTop.Items[2].Visible = true; } else { tkrmTop.Items[2].Visible = false; } // ... User options tkrmTop.Items[3].Visible = false; // Accept tkrmTop.Items[4].Visible = false; // Reject tkrmTop.Items[5].Visible = false; // Start Work tkrmTop.Items[6].Visible = false; // Complete Work // ... Accept/Reject options if (((employeeId == assignTeamMemberId)|| (serviceAdmin)) && (state == "Assigned")) { tkrmTop.Items[3].Visible = true; tkrmTop.Items[4].Visible = true; tkrmTop.Items[5].Visible = false; tkrmTop.Items[6].Visible = false; } // ... Start work option if (((employeeId == assignTeamMemberId)|| (serviceAdmin)) && (state == "Accepted")) { tkrmTop.Items[3].Visible = false; tkrmTop.Items[4].Visible = false; tkrmTop.Items[5].Visible = true; tkrmTop.Items[6].Visible = false; } // ... Start work option if (((employeeId == assignTeamMemberId) || (serviceAdmin)) && (state == "In Progress")) { tkrmTop.Items[3].Visible = false; tkrmTop.Items[4].Visible = false; tkrmTop.Items[5].Visible = false; tkrmTop.Items[6].Visible = true; } // ... Last Search or Dashboard tkrmTopNavigation.Items[2].Visible = true; // Last search tkrmTopNavigation.Items[3].Visible = false; // Dashboard if (hdfDashboard.Value == "True") { tkrmTopNavigation.Items[2].Visible = false; // Last search tkrmTopNavigation.Items[3].Visible = true; // Dashboard } }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Validate query string if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["others"] == null) && ((string)Request.QueryString["employee_id"] == null) && ((string)Request.QueryString["period_id"] == null) && ((string)Request.QueryString["projecttime_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in timesheet_summary.aspx"); } // Security check if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_FULL_EDITING"])) { if (Request.QueryString["others"] == "no") { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } } } } else { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_VIEW"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT"])) { if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT_WED"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } } } } } } } } // Initialize viewstate's variables ViewState["others"] = Request.QueryString["others"]; ViewState["employee_id"] = int.Parse(Request.QueryString["employee_id"]); ViewState["period_id"] = int.Parse(Request.QueryString["period_id"]); ViewState["projecttime_id"] = int.Parse(Request.QueryString["projecttime_id"]); System.Configuration.AppSettingsReader appSettingReader = new System.Configuration.AppSettingsReader(); ViewState["LHMode"] = appSettingReader.GetValue("LABOUR_HOURS_OPERATION_MODE", typeof(System.String)).ToString(); // Get ProjectTime record projectTimeTDS = new ProjectTimeTDS(); ProjectTimeGateway projectTimeGateway = new ProjectTimeGateway(projectTimeTDS); projectTimeGateway.LoadByProjectTimeId((int)ViewState["projecttime_id"]); // Store datasets Session["projectTimeTDS"] = projectTimeTDS; // Databind tbxDate.DataBind(); tbxWorkingDetails.DataBind(); tbxStartTime.DataBind(); tbxEndTime.DataBind(); tbxLunch.DataBind(); tbxComments.DataBind(); tbxState.DataBind(); // Prepare initial data for client StoreNavigatorState(); EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet()); employeeGateway.LoadByEmployeeId((int)ViewState["employee_id"]); tbxEmployee.Text = employeeGateway.GetFullName((int)ViewState["employee_id"]); int companyId = Int32.Parse(Session["companyID"].ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(new DataSet()); companiesGateway.LoadAllByCompaniesId(projectTimeGateway.GetCompaniesId((int)ViewState["projecttime_id"]), companyId); tbxClient.Text = companiesGateway.GetName(projectTimeGateway.GetCompaniesId((int)ViewState["projecttime_id"])); ProjectGateway projectGateway = new ProjectGateway(new DataSet()); projectGateway.LoadByProjectId(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])); tbxProject.Text = projectGateway.GetName(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])) + "(" + projectGateway.GetProjectNumber(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])) + ")"; if (projectGateway.GetFairWageApplies(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"]))) { tbxJobClassType.Visible = true; lblJobClassType.Visible = true; tbxJobClassType.Text = projectTimeGateway.GetJobClassType((int)ViewState["projecttime_id"]); } else { tbxJobClassType.Visible = false; lblJobClassType.Visible = false; } if (projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]).HasValue) { CountryGateway countryGateway = new CountryGateway(new DataSet()); countryGateway.LoadByCountryId((Int64)projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"])); tbxMealsCountry.Text = countryGateway.GetName((Int64)projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"])); } //if (projectTimeGateway.GetMealsAllowance((int)ViewState["projecttime_id"]) > 0) //{ // cbxMealsAllowance.Checked = true; //} //if (projectTimeGateway.GetFairWage((int)ViewState["projecttime_id"])) //{ // cbxFairWage.Checked = true; //} if (projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]).HasValue) { UnitsGateway unitGateway = new UnitsGateway(new DataSet()); unitGateway.LoadByUnitId((int)projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]), Convert.ToInt32(Session["companyID"])); tbxUnit.Text = unitGateway.GetUnitCode((int)projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"])); } if (projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]).HasValue) { UnitsGateway unitGateway = new UnitsGateway(new DataSet()); unitGateway.LoadByUnitId((int)projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]), Convert.ToInt32(Session["companyID"])); tbxTowed.Text = unitGateway.GetUnitCode((int)projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"])); } tbxTypeOfWork.Text = ""; if (projectTimeGateway.GetWork((int)ViewState["projecttime_id"]) != "") { tbxTypeOfWork.Text = projectTimeGateway.GetWork((int)ViewState["projecttime_id"]); } tbxFunction.Text = ""; if (projectTimeGateway.GetFunction((int)ViewState["projecttime_id"]) != "") { tbxFunction.Text = projectTimeGateway.GetFunction((int)ViewState["projecttime_id"]); } } else { // Restore datasets projectTimeTDS = (ProjectTimeTDS)Session["projectTimeTDS"]; } }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // STEP6 - FINISH OPTIONS // // //////////////////////////////////////////////////////////////////////// // STEP6 - FINISH OPTIONS - METHODS // private void StepFinalStepIn() { // Set instruction mWizard2 master2 = (mWizard2)this.Master; master2.WizardInstruction = "What would you like to do?"; string url = ""; UnitsGateway unitsGateway = new UnitsGateway(null); int unitId = unitsGateway.GetLastUnitId(); UnitsGateway unitsGatewayForLoad = new UnitsGateway(); unitsGatewayForLoad.LoadByUnitId(unitId, int.Parse(hdfCompanyId.Value)); string unitType = unitsGatewayForLoad.GetType(unitId); string unitState = unitsGatewayForLoad.GetState(unitId); hdfUpdate.Value = "yes"; // Store active tab for postback Session["activeTabUnits"] = "0"; Session["dialogOpenedUnits"] = "0"; url = "./units_summary.aspx?source_page=units_add.aspx&unit_id=" + unitId.ToString() + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=0" + GetNavigatorState(); lkbtnOpenUnit.Attributes.Add("onclick", string.Format("return lkbtnOpenServiceClick('{0}');", url)); url = "./units_edit.aspx?source_page=units_add.aspx&unit_id=" + unitId.ToString() + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=0" + GetNavigatorState(); lkbtnEditUnit.Attributes.Add("onclick", string.Format("return lkbtnEditServiceClick('{0}');", url)); lkbtnClose.Attributes.Add("onclick", "return lkbtnCloseClick();"); }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// Insert a new service (direct to DB) /// </summary> /// <param name="dateTime_">dateTime_</param> /// <param name="mto">mto</param> /// <param name="description">description</param> /// <param name="unitId">unitId</param> /// <param name="type">type</param> /// <param name="state">state</param> /// <param name="ownerId">ownerId</param> /// <param name="assignDateTime">assignDateTime</param> /// <param name="assignDeadlineDate">assignDeadlineDate</param> /// <param name="assignTeamMember">assignTeamMember</param> /// <param name="assignTeamMemberID">assignTeamMemberID</param> /// <param name="assignThirdPartyVendor">assignThirdPartyVendor</param> /// <param name="acceptDateTime">acceptDateTime</param> /// <param name="rejectDateTime">rejectDateTime</param> /// <param name="rejectReason">rejectReason</param> /// <param name="startWorkDateTime">startWorkDateTime</param> /// <param name="startWorkOutOfServiceDate">startWorkOutOfServiceDate</param> /// <param name="startWorkOutOfServiceTime">startWorkOutOfServiceTime</param> /// <param name="completeWorkDateTime">completeWorkDateTime</param> /// <param name="completeWorkBackToServiceDate">completeWorkBackToServiceDate</param> /// <param name="completeWorkBackToServiceTime">completeWorkBackToServiceTime</param> /// <param name="completeWorkDetailDescription">completeWorkDetailDescription</param> /// <param name="completeWorkDetailPreventable">completeWorkDetailPreventable</param> /// <param name="completeWorkDetailTMLabourHours">completeWorkDetailTMLabourHours</param> /// <param name="completeWorkDetailTMCost">completeWorkDetailTMCost</param> /// <param name="completeWorkDetailTPVInvoiceNumber">completeWorkDetailTPVInvoiceNumber</param> /// <param name="completeWorkDetailTPVInvoiceAmout">completeWorkDetailTPVInvoiceAmout</param> /// <param name="notes">notes</param> /// <param name="ruleId">ruleId</param> /// <param name="mileage">mileage</param> /// <param name="startWorkMileage">startWorkMileage</param> /// <param name="completeWorkMileage">completeWorkMileage</param> /// <param name="deleted">deleted</param> /// <param name="companyId">companyId</param> /// <param name="libraryCategoriesId">libraryCategoriesId</param> /// <returns>int</returns> public int InsertDirect(DateTime? dateTime_, bool mto, string description, int? unitId, string type, string state, int ownerId, DateTime? assignDateTime, DateTime? assignDeadlineDate, bool assignTeamMember, int? assignTeamMemberID, string assignThirdPartyVendor, DateTime? acceptDateTime, DateTime? rejectDateTime, string rejectReason, DateTime? startWorkDateTime, DateTime? startWorkOutOfServiceDate, string startWorkOutOfServiceTime, DateTime? completeWorkDateTime, DateTime? completeWorkBackToServiceDate, string completeWorkBackToServiceTime, string completeWorkDetailDescription, bool completeWorkDetailPreventable, decimal? completeWorkDetailTMLabourHours, decimal? completeWorkDetailTMCost, string completeWorkDetailTPVInvoiceNumber, decimal? completeWorkDetailTPVInvoiceAmout, string notes, int? ruleId, string mileage, string startWorkMileage, string completeWorkMileage, bool deleted, int companyId, int? libraryCategoriesId) { // Get new service number by commpany string number = GetServiceNumber(companyId); // Get serviceId and insert request ServicesGateway servicesGateway = new ServicesGateway(null); int serviceId = servicesGateway.Insert(number, dateTime_, mto, description, unitId, type, state, ownerId, assignDateTime, assignDeadlineDate, assignTeamMember, assignTeamMemberID, assignThirdPartyVendor, acceptDateTime, rejectDateTime, rejectReason, startWorkDateTime, startWorkOutOfServiceDate, startWorkOutOfServiceTime, completeWorkDateTime, completeWorkBackToServiceDate, completeWorkBackToServiceTime, completeWorkDetailDescription, completeWorkDetailPreventable, completeWorkDetailTMLabourHours, completeWorkDetailTMCost, completeWorkDetailTPVInvoiceNumber, completeWorkDetailTPVInvoiceAmout, notes, ruleId, deleted, companyId, libraryCategoriesId); // Validate unit type if (unitId.HasValue) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); // ... Insert vehicle info if (unitType == "Vehicle") { ServicesVehicle servicesVehicle = new ServicesVehicle(null); servicesVehicle.InsertDirect(serviceId, mileage, startWorkMileage, completeWorkMileage, deleted, companyId); } } return serviceId; }
protected void Page_PreRender(object sender, EventArgs e) { // Set active toolbar mForm6 master = (mForm6)this.Master; master.ActiveToolbar = "FleetManagement"; // For error message hdfErrorFieldList.Value = ""; // Validate left menu if the user has admin permission if (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_SERVICES_ADMIN"])) { tkrpbLeftMenuAllServiceRequests.Visible = true; tkrpbLeftMenuMyServiceRequests.Visible = false; tkrpbLeftMenuTools.Visible = true; } else { tkrpbLeftMenuAllServiceRequests.Visible = false; tkrpbLeftMenuMyServiceRequests.Visible = true; tkrpbLeftMenuTools.Visible = false; } // Tabs validation // ... Validate vehicle info int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfServiceId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(serviceInformationTDS); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); int companyLevel = unitsGateway.GetCompanyLevelId((int)unitId); if (unitType != "Vehicle") { lblGeneralMileage.Visible = false; tbxGeneralMileage.Visible = false; lblGeneralMileageUnitOfMeasurement.Visible = false; lblStartWorkDataStartMileage.Visible = false; tbxStartWorkDataStartMileage.Visible = false; lblStartWorkDataMileageUnitOfMeasurement.Visible = false; lblStartWorkDataMileageUnitOfMeasurementReadOnly.Visible = false; lblCompleteWorkDataCompleteMileage.Visible = false; tbxCompleteWorkDataCompleteMileage.Visible = false; lblCompleteWorkDataMileageUnitOfMeasurement.Visible = false; lblCompleteWorkDataMileageUnitOfMeasurementReadOnly.Visible = false; } else { // .. For Vehicles lblGeneralMileage.Visible = true; tbxGeneralMileage.Visible = true; lblStartWorkDataStartMileage.Visible = true; tbxStartWorkDataStartMileage.Visible = true; lblCompleteWorkDataCompleteMileage.Visible = true; tbxCompleteWorkDataCompleteMileage.Visible = true; lblGeneralMileageUnitOfMeasurement.Visible = true; lblStartWorkDataMileageUnitOfMeasurement.Visible = true; lblStartWorkDataMileageUnitOfMeasurementReadOnly.Visible = true; lblCompleteWorkDataMileageUnitOfMeasurementReadOnly.Visible = true; } // Assign Tab // ... Assigned To hdfServiceState.Value = serviceInformationBasicInformationGatewayForId.GetServiceState(serviceId); string state = hdfServiceState.Value; if (state == "Unassigned") { // ... Princial Panels pnlAssignmentData.Visible = false; pnlAssignmentDataReadOnly.Visible = true; // ... ...Subpanels pnlAssignedTo.Visible = false; pnlAssignedToReadOnly.Visible = false; pnlAssignmentAccept.Visible = false; pnlAssignmentReject.Visible = false; pnlAssignmentAcceptReadOnly.Visible = true; pnlAssignmentRejectReadOnly.Visible = true; } if ((state == "Assigned") || (state == "Rejected")) { // ... ... Principal Panels pnlAssignmentData.Visible = true; pnlAssignmentDataReadOnly.Visible = false; // ... ...Subpanels pnlAssignedTo.Visible = true; pnlAssignedToReadOnly.Visible = false; pnlAssignmentAccept.Visible = false; pnlAssignmentReject.Visible = false; pnlAssignmentAcceptReadOnly.Visible = false; pnlAssignmentRejectReadOnly.Visible = false; } else { if ((state == "Accepted") || (state == "In Progress") || (state == "Completed")) { // ... ... Principal Panels pnlAssignmentData.Visible = true; pnlAssignmentDataReadOnly.Visible = false; // ... ...Subpanels pnlAssignedTo.Visible = false; pnlAssignedToReadOnly.Visible = true; pnlAssignmentAccept.Visible = false; pnlAssignmentReject.Visible = false; pnlAssignmentAcceptReadOnly.Visible = false; pnlAssignmentRejectReadOnly.Visible = false; } } // ... Assignation result if ((state == "Accepted") || (state == "In Progress") || (state == "Completed")) { // ... ... Principal Panels pnlAssignmentData.Visible = true; pnlAssignmentDataReadOnly.Visible = false; // ... ...Subpanels pnlAssignedTo.Visible = false; pnlAssignedToReadOnly.Visible = true; pnlAssignmentAccept.Visible = true; pnlAssignmentReject.Visible = false; pnlAssignmentAcceptReadOnly.Visible = false; pnlAssignmentRejectReadOnly.Visible = false; } // StartWork tab if ((state == "Unassigned") || (state == "Assigned") || (state == "Rejected") || (state == "Accepted")) { pnlStartWorkDataReadOnly.Visible = true; pnlStartWorkData.Visible = false; } else { pnlStartWorkDataReadOnly.Visible = false; pnlStartWorkData.Visible = true; } // Complete Work tab if ((state == "Unassigned") || (state == "Assigned") || (state == "Rejected") || (state == "Accepted") || (state == "In Progress")) { pnlCompleteWorkDataReadOnly.Visible = true; pnlCompleteWorkData.Visible = false; } else { pnlCompleteWorkDataReadOnly.Visible = false; pnlCompleteWorkData.Visible = true; } // ... Validate for assignated person if (serviceInformationBasicInformationGatewayForId.GetToTeamMember(serviceId)) { pnlTeamMemberAssigned.Visible = true; pnlThirdPartyVendorAssigned.Visible = false; pnlTeamMemberAssignedReadOnly.Visible = true; pnlThirdPartyVendorAssignedReadOnly.Visible = false; } else { pnlTeamMemberAssigned.Visible = false; pnlThirdPartyVendorAssigned.Visible = true; pnlTeamMemberAssignedReadOnly.Visible = false; pnlThirdPartyVendorAssignedReadOnly.Visible = true; } }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP1 - BEGIN // // //////////////////////////////////////////////////////////////////////// // STEP1 - BEGIN - METHODS // private void StepBeginIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Please select a unit"; // Set initial unit id if (hdfInitialUnitId.Value != "none") { int unitId = Int32.Parse(hdfInitialUnitId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string state = unitsGateway.GetState(unitId) ; if (state != "Disposed") { try { ddlUnits.SelectedValue = hdfInitialUnitId.Value; } catch { } } if (hdfDashboard.Value == "True") { try { ddlUnits.Enabled = false; } catch { } } } }
private void TagPage() { hdfCompanyId.Value = Session["companyID"].ToString(); hdfServiceId.Value = Request.QueryString["service_id"]; hdfActiveTab.Value = Request.QueryString["active_tab"].ToString(); int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfServiceId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(); serviceInformationBasicInformationGatewayForId.LoadByServiceId(serviceId, companyId); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); hdfUnitType.Value = unitsGateway.GetType((int)unitId); hdfCompanyLevel.Value = unitsGateway.GetCompanyLevelId((int)unitId).ToString(); int companyLevel = Int32.Parse(hdfCompanyLevel.Value); CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevel, companyId); hdfMileageUnitOfMeasurement.Value = companyLevelGateway.GetUnitsUnitOfMeasurement(companyLevel); lblPnlStartWorkStartMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; lblPnlCompleteWorkCompleteMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; }
private void UpdateDatabase() { // Get ids int serviceId = Int32.Parse(hdfServiceId.Value); string serviceType = hdfFmType.Value; int companyId = Int32.Parse(hdfCompanyId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(serviceInformationTDS); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); // Delete DB.Open(); DB.BeginTransaction(); try { ServiceInformationBasicInformation serviceInformationBasicInformation = new ServiceInformationBasicInformation(serviceInformationTDS); serviceInformationBasicInformation.DeleteDirect(serviceId, unitType, (int)unitId, companyId); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
protected void btnEdit_Click(object sender, EventArgs e) { int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); PostPageChanges(); int unitId = GetUnitId(); if (unitId > 0) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); string unitState = unitsGateway.GetState(unitId); // Store active tab for postback Session["activeTabUnits"] = "0"; Session["dialogOpenedUnits"] = "0"; // Redirect string url = "./units_edit.aspx?source_page=units_navigator2.aspx&unit_id=" + unitId + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=0" + GetNavigatorState(); Response.Redirect(url); } else { RestoreNavigatorState(); cvSelection.IsValid = false; } }
protected string GetUnitCode(object unitId) { int companyId = Int32.Parse(hdfCompanyId.Value); if (unitId != DBNull.Value) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); if (unitsGateway.Table.Rows.Count > 0) { return unitsGateway.GetUnitCode((int)unitId); } else { return ""; } } else { return ""; } }
protected void cvStartWorkDataMileage_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = true; int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfServiceId.Value); ServiceInformationBasicInformationGateway serviceInformationBasicInformationGatewayForId = new ServiceInformationBasicInformationGateway(serviceInformationTDS); int? unitId = serviceInformationBasicInformationGatewayForId.GetUnitID(serviceId); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); if (unitType == "Vehicle") { if (tbxStartWorkDataWorkStartDateTime.Text != "") { if (tbxStartWorkDataStartMileage.Text == "") { args.IsValid = false; hdfErrorFieldList.Value = hdfErrorFieldList.Value + ", Mileage (Start Work)"; } } } }
// //////////////////////////////////////////////////////////////////////// // STEP2 - GENERAL INFORMATION - METHODS // private void StepGeneralInformationIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = ""; // Validate user - admin if (Convert.ToBoolean(Session["sgLFS_FLEETMANAGEMENT_SERVICES_ADMIN"])) { rbtnAssignToTeamMember.Visible = true; ddlAssignToTeamMember.Visible = true; } else { rbtnAssignToTeamMember.Visible = false; ddlAssignToTeamMember.Visible = false; } // Validate vehicle info int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); hdfUnitType.Value = unitType; int companyLevel = unitsGateway.GetCompanyLevelId(unitId); hdfCompanyLevel.Value = unitsGateway.GetCompanyLevelId(unitId).ToString(); CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevel, companyId); lblMileageUnitOfMeasurement.Text = companyLevelGateway.GetUnitsUnitOfMeasurement(companyLevel); hdfMileageUnitOfMeasurement.Value = lblMileageUnitOfMeasurement.Text; lblStartWorkStartMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; lblCompleteWorkCompleteMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; if (unitType == "Vehicle") { lblMileage.Visible = true; tbxMileage.Visible = true; lblStartWorkStartMileage.Visible = true; tbxStartWorkStartMileage.Visible = true; lblCompleteWorkCompleteMileage.Visible = true; tbxCompleteWorkCompleteMileage.Visible = true; lblMileageUnitOfMeasurement.Visible = true; lblStartWorkStartMileageUnitOfMeasurement.Visible = true; lblCompleteWorkCompleteMileageUnitOfMeasurement.Visible = true; } else { lblMileage.Visible = false; tbxMileage.Visible = false; lblMileageUnitOfMeasurement.Visible = false; lblStartWorkStartMileage.Visible = false; tbxStartWorkStartMileage.Visible = false; lblStartWorkStartMileageUnitOfMeasurement.Visible = false; lblCompleteWorkCompleteMileage.Visible = false; tbxCompleteWorkCompleteMileage.Visible = false; lblCompleteWorkCompleteMileageUnitOfMeasurement.Visible = false; } // Validate panels if (rbtnUnassigned.Checked) { pnlAcceptInformation.Visible = false; pnlStartWorkInformation.Visible = false; pnlCompleteWorkInformation.Visible = false; pnlAssignThirdPartyVendor.Visible = false; pnlAssignTeamMember.Visible = false; acceptInformationSeparator.Visible = false; startWorkSeparator.Visible = false; completeWorkSeparator.Visible = false; } else { if ((rbtnAssignToMyself.Checked) || (rbtnAssignToTeamMember.Checked)) { pnlAssignThirdPartyVendor.Visible = false; pnlAssignTeamMember.Visible = true; } if (rbtnAssignToThirdPartyVendor.Checked) { pnlAssignThirdPartyVendor.Visible = true; pnlAssignTeamMember.Visible = false; } } }
protected void cvMileage_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = true; if (ckbxMtoDto.Checked) { int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); int companyLevel = unitsGateway.GetCompanyLevelId(unitId); if (unitType == "Vehicle") { if (tbxMileage.Text == "") { args.IsValid = false; } } } }
// //////////////////////////////////////////////////////////////////////// // STEP2 - STEPS INFORMATION - METHODS // private void StepStepsInformationIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = ""; // Load data for selected service request int serviceId = Int32.Parse(hdfSelectedSRId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); ServiceRequestsManagerToolBasicInformation serviceRequestsManagerToolBasicInformation = new ServiceRequestsManagerToolBasicInformation(serviceRequestsManagerToolTDS); ServiceRequestsManagerToolCostInformation serviceRequestsManagerToolCostInformation = new ServiceRequestsManagerToolCostInformation(serviceRequestsManagerToolTDS); ServiceInformationServiceNote serviceInformationServiceNoteForEdit = new ServiceInformationServiceNote(serviceInformationTDS); if (Session["dialogOpenedServicesManagerTool"] == null) { // ... Load basic data serviceRequestsManagerToolBasicInformation.LoadByServiceId(serviceId, companyId); // ... Load costs serviceRequestsManagerToolCostInformation.LoadByServiceId(serviceId, companyId); //... Load notes serviceInformationServiceNoteForEdit.LoadByServiceId(serviceId, companyId); } else { ServiceRequestsManagerToolBasicInformationGateway serviceRequestsManagerToolBasicInformationGateway2 = new ServiceRequestsManagerToolBasicInformationGateway(serviceRequestsManagerToolBasicInformation.Data); Session.Remove("dialogOpenedServicesManagerTool"); if (serviceRequestsManagerToolBasicInformationGateway2.GetAcceptedDateTime(serviceId).HasValue) ckbxAcceptSR.Checked = true; if (serviceRequestsManagerToolBasicInformationGateway2.GetStartWorkDateTime(serviceId).HasValue) ckbxStartSR.Checked = true; if (serviceRequestsManagerToolBasicInformationGateway2.GetUnitOutOfServiceDate(serviceId).HasValue) tkrdpStartWorkUnitOutOfServiceDate.SelectedDate = serviceRequestsManagerToolBasicInformationGateway2.GetUnitOutOfServiceDate(serviceId); tbxStartWorkStartMileage.Text = serviceRequestsManagerToolBasicInformationGateway2.GetStartWorkMileage(serviceId); if (serviceRequestsManagerToolBasicInformationGateway2.GetCompleteWorkDateTime(serviceId).HasValue) ckbxCompleteSR.Checked = true; if (serviceRequestsManagerToolBasicInformationGateway2.GetUnitBackInServiceDate(serviceId).HasValue) tkrdpCompleteWorkUnitBackInServiceDate.SelectedDate = serviceRequestsManagerToolBasicInformationGateway2.GetUnitBackInServiceDate(serviceId); tbxCompleteWorkCompleteMileage.Text = serviceRequestsManagerToolBasicInformationGateway2.GetCompleteWorkMileage(serviceId); tbxCompleteWorkDataDescription.Text = serviceRequestsManagerToolBasicInformationGateway2.GetCompleteWorkDetailDescription(serviceId); ckbxPreventableTPV.Checked = serviceRequestsManagerToolBasicInformationGateway2.GetCompleteWorkDetailPreventable(serviceId); tbxCompleteWorkDataLabourHours.Text = serviceRequestsManagerToolBasicInformationGateway2.GetCompleteWorkDetailTMLabourHours(serviceId).ToString(); } ServiceRequestsManagerToolBasicInformationGateway serviceRequestsManagerToolBasicInformationGateway = new ServiceRequestsManagerToolBasicInformationGateway(serviceRequestsManagerToolBasicInformation.Data); // Validate panels and information string state = serviceRequestsManagerToolBasicInformationGateway.GetServiceStateOriginal(serviceId); hdfState.Value = state; hdfServiceNumber.Value = serviceRequestsManagerToolBasicInformationGateway.GetServiceNumberOriginal(serviceId); hdfServiceDescription.Value = serviceRequestsManagerToolBasicInformationGateway.GetServiceDescriptionOriginal(serviceId); string originalThirdsPartyVendor = serviceRequestsManagerToolBasicInformationGateway.GetAssignedThirdPartyVendor(serviceId); int? unitId = null; if (serviceRequestsManagerToolBasicInformationGateway.GetUnitId(serviceId).HasValue) { unitId = (int)serviceRequestsManagerToolBasicInformationGateway.GetUnitId(serviceId); hdfUnitId.Value = unitId.ToString(); } // ... Validate vehicle information if (unitId.HasValue) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); hdfUnitType.Value = unitType; int companyLevel = unitsGateway.GetCompanyLevelId((int)unitId); hdfCompanyLevel.Value = unitsGateway.GetCompanyLevelId((int)unitId).ToString(); CompanyLevelGateway companyLevelGateway = new CompanyLevelGateway(); companyLevelGateway.LoadByCompanyLevelId(companyLevel, companyId); hdfMileageUnitOfMeasurement.Value = companyLevelGateway.GetUnitsUnitOfMeasurement(companyLevel); lblStartWorkStartMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; lblCompleteWorkCompleteMileageUnitOfMeasurement.Text = hdfMileageUnitOfMeasurement.Value; if (unitType == "Vehicle") { lblStartWorkStartMileage.Visible = true; tbxStartWorkStartMileage.Visible = true; lblCompleteWorkCompleteMileage.Visible = true; tbxCompleteWorkCompleteMileage.Visible = true; lblStartWorkStartMileageUnitOfMeasurement.Visible = true; lblCompleteWorkCompleteMileageUnitOfMeasurement.Visible = true; } else { lblStartWorkStartMileage.Visible = false; tbxStartWorkStartMileage.Visible = false; lblStartWorkStartMileageUnitOfMeasurement.Visible = false; lblCompleteWorkCompleteMileage.Visible = false; tbxCompleteWorkCompleteMileage.Visible = false; lblCompleteWorkCompleteMileageUnitOfMeasurement.Visible = false; } } // ... Validate visible internal panels (complete work info) if (state == "Unassigned") { if (!rbtnAssignToThirdPartyVendor.Checked) { pnlAssignTeamMember.Visible = true; pnlAssignThirdPartyVendor.Visible = false; } else { pnlAssignThirdPartyVendor.Visible = true; pnlAssignTeamMember.Visible = false; } } else { bool teamMemberAssigned = serviceRequestsManagerToolBasicInformationGateway.GetAssignTeamMember(serviceId); if (teamMemberAssigned) { pnlAssignTeamMember.Visible = true; pnlAssignThirdPartyVendor.Visible = false; } else { pnlAssignThirdPartyVendor.Visible = true; pnlAssignTeamMember.Visible = false; } } // ... Validate panels switch (state) { case "Unassigned": pnlAssignmentInformation.Visible = true; acceptInformationSeparator.Visible = true; pnlAcceptInformation.Visible = true; startWorkSeparator.Visible = true; pnlStartWorkInformation.Visible = true; completeWorkSeparator.Visible = true; pnlCompleteWorkInformation.Visible = true; break; case "Assigned": pnlAssignmentInformation.Visible = false; acceptInformationSeparator.Visible = false; pnlAcceptInformation.Visible = true; startWorkSeparator.Visible = true; pnlStartWorkInformation.Visible = true; completeWorkSeparator.Visible = true; pnlCompleteWorkInformation.Visible = true; break; case "Rejected": pnlAssignmentInformation.Visible = true; acceptInformationSeparator.Visible = true; pnlAcceptInformation.Visible = true; startWorkSeparator.Visible = true; pnlStartWorkInformation.Visible = true; completeWorkSeparator.Visible = true; pnlCompleteWorkInformation.Visible = true; break; case "Accepted": pnlAssignmentInformation.Visible = false; acceptInformationSeparator.Visible = false; pnlAcceptInformation.Visible = false; startWorkSeparator.Visible = false; pnlStartWorkInformation.Visible = true; completeWorkSeparator.Visible = true; pnlCompleteWorkInformation.Visible = true; break; case "In Progress": pnlAssignmentInformation.Visible = false; acceptInformationSeparator.Visible = false; pnlAcceptInformation.Visible = false; startWorkSeparator.Visible = false; pnlStartWorkInformation.Visible = false; completeWorkSeparator.Visible = false; pnlCompleteWorkInformation.Visible = true; break; default: throw new Exception("The option for " + wzServices.ActiveStep.Name + " step in services_manager_tool.Wizard_ActiveStepChanged function does not exist"); } hdfPnlAcceptInformation.Value = pnlAcceptInformation.Visible.ToString(); hdfPnlAssignmentInformation.Value = pnlAssignmentInformation.Visible.ToString(); hdfPnlStartWorkInformation.Value = pnlStartWorkInformation.Visible.ToString(); hdfPnlCompleteWorkInformation.Value = pnlCompleteWorkInformation.Visible.ToString(); // ... Load resource library int? libraryCategoriesId = null; if (serviceRequestsManagerToolBasicInformationGateway.GetLibraryCategoriesId(serviceId).HasValue) libraryCategoriesId = (int)serviceRequestsManagerToolBasicInformationGateway.GetLibraryCategoriesId(serviceId); if (libraryCategoriesId.HasValue) { ViewState["libraryCategoriesId"] = (int)libraryCategoriesId; tbxCategoryAssocited.Text = GetFullCategoryName((int)libraryCategoriesId, companyId); btnAssociate.Visible = false; btnUnassociate.Visible = true; } else { tbxCategoryAssocited.Text = ""; btnAssociate.Visible = true; btnUnassociate.Visible = false; } // Store session Session["serviceRequestsManagerToolTDS"] = serviceRequestsManagerToolTDS; }
/// <summary> /// Update direct (direct a service to DB) /// </summary> /// <param name="serviceId">serviceId</param> /// <param name="originalNumber">originalNumber</param> /// <param name="originalDateTime">originalDateTime</param> /// <param name="originalMtoDto">originalMtoDto</param> /// <param name="originalDescription">originalDescription</param> /// <param name="originalUnitId">originalUnitId</param> /// <param name="originalType">originalType</param> /// <param name="originalState">originalState</param> /// <param name="originalOwnerId">originalOwnerId</param> /// <param name="originalAssignDateTime">originalAssignDateTime</param> /// <param name="originalAssignDeadlineDate">originalAssignDeadlineDate</param> /// <param name="originalAssignTeamMember">originalAssignTeamMember</param> /// <param name="originalAssignTeamMemberID">originalAssignTeamMemberID</param> /// <param name="originalAssignThirdPartyVendor">originalAssignThirdPartyVendor</param> /// <param name="originalAcceptDateTime">originalAcceptDateTime</param> /// <param name="originalRejectDateTime">originalRejectDateTime</param> /// <param name="originalRejectReason">originalRejectReason</param> /// <param name="originalStartWorkDateTime">originalStartWorkDateTime</param> /// <param name="originalStartWorkOutOfServiceDate">originalStartWorkOutOfServiceDate</param> /// <param name="originalStartWorkOutOfServiceTime">originalStartWorkOutOfServiceTime</param> /// <param name="originalCompleteWorkDateTime">originalCompleteWorkDateTime</param> /// <param name="originalCompleteWorkBackToServiceDate">originalCompleteWorkBackToServiceDate</param> /// <param name="originalCompleteWorkBackToServiceTime">originalCompleteWorkBackToServiceTime</param> /// <param name="originalCompleteWorkDetailDescription">originalCompleteWorkDetailDescription</param> /// <param name="originalCompleteWorkDetailPreventable">originalCompleteWorkDetailPreventable</param> /// <param name="originalCompleteWorkDetailTMLabourHours">originalCompleteWorkDetailTMLabourHours</param> /// <param name="originalCompleteWorkDetailTMCost">originalCompleteWorkDetailTMCost</param> /// <param name="originalCompleteWorkDetailTPVInvoiceNumber">originalCompleteWorkDetailTPVInvoiceNumber</param> /// <param name="originalCompleteWorkDetailTPVInvoiceAmout">originalCompleteWorkDetailTPVInvoiceAmout</param> /// <param name="originalDeleted">originalDeleted</param> /// <param name="originalCompanyId">originalCompanyId</param> /// <param name="originalNotes">originalNotes</param> /// <param name="originalRuleID">originalRuleID</param> /// <param name="originalMileage">originalMileage</param> /// <param name="originalStartWorkMileage">originalStartWorkMileage</param> /// <param name="originalCompleteWorkMileage">originalCompleteWorkMileage</param> /// <param name="originalLibraryCategoriesId">originalLibraryCategoriesId</param> /// /// <param name="newNumber">newNumber</param> /// <param name="newDateTime">newDateTime</param> /// <param name="newMtoDto">newMtoDto</param> /// <param name="newDescription">newDescription</param> /// <param name="newUnitId">newUnitId</param> /// <param name="newType">newType</param> /// <param name="newState">newState</param> /// <param name="newOwnerId">newOwnerId</param> /// <param name="newAssignDateTime">newAssignDateTime</param> /// <param name="newAssignDeadlineDate">newAssignDeadlineDate</param> /// <param name="newAssignTeamMember">newAssignTeamMember</param> /// <param name="newAssignTeamMemberID">newAssignTeamMemberID</param> /// <param name="newAssignThirdPartyVendor">newAssignThirdPartyVendor</param> /// <param name="newAcceptDateTime">newAcceptDateTime</param> /// <param name="newRejectDateTime">newRejectDateTime</param> /// <param name="newRejectReason">newRejectReason</param> /// <param name="newStartWorkDateTime">newStartWorkDateTime</param> /// <param name="newStartWorkOutOfServiceDate">newStartWorkOutOfServiceDate</param> /// <param name="newStartWorkOutOfServiceTime">newStartWorkOutOfServiceTime</param> /// <param name="newCompleteWorkDateTime">newCompleteWorkDateTime</param> /// <param name="newCompleteWorkBackToServiceDate">newCompleteWorkBackToServiceDate</param> /// <param name="newCompleteWorkBackToServiceTime">newCompleteWorkBackToServiceTime</param> /// <param name="newCompleteWorkDetailDescription">newCompleteWorkDetailDescription</param> /// <param name="newCompleteWorkDetailPreventable">newCompleteWorkDetailPreventable</param> /// <param name="newCompleteWorkDetailTMLabourHours">newCompleteWorkDetailTMLabourHours</param> /// <param name="newCompleteWorkDetailTMCost">newCompleteWorkDetailTMCost</param> /// <param name="newCompleteWorkDetailTPVInvoiceNumber">newCompleteWorkDetailTPVInvoiceNumber</param> /// <param name="newCompleteWorkDetailTPVInvoiceAmout">newCompleteWorkDetailTPVInvoiceAmout</param> /// <param name="newDeleted">newDeleted</param> /// <param name="newCompanyId">newCompanyId</param> /// <param name="newNotes">newNotes</param> /// <param name="newRuleID">newRuleID</param> /// <param name="newMileage">newMileage</param> /// <param name="newStartWorkMileage">newStartWorkMileage</param> /// <param name="newCompleteWorkMileage">newCompleteWorkMileage</param> /// <param name="newLibraryCategoriesId">newLibraryCategoriesId</param> public void UpdateDirect(int serviceId, string originalNumber, DateTime originalDateTime, bool originalMtoDto, string originalDescription, int? originalUnitId, string originalType, string originalState, int originalOwnerId, DateTime? originalAssignDateTime, DateTime? originalAssignDeadlineDate, bool originalAssignTeamMember, int? originalAssignTeamMemberID, string originalAssignThirdPartyVendor, DateTime? originalAcceptDateTime, DateTime? originalRejectDateTime, string originalRejectReason, DateTime? originalStartWorkDateTime, DateTime? originalStartWorkOutOfServiceDate, string originalStartWorkOutOfServiceTime, DateTime? originalCompleteWorkDateTime, DateTime? originalCompleteWorkBackToServiceDate, string originalCompleteWorkBackToServiceTime, string originalCompleteWorkDetailDescription, bool originalCompleteWorkDetailPreventable, decimal? originalCompleteWorkDetailTMLabourHours, decimal? originalCompleteWorkDetailTMCost, string originalCompleteWorkDetailTPVInvoiceNumber, decimal? originalCompleteWorkDetailTPVInvoiceAmout, bool originalDeleted, int originalCompanyId, string originalNotes, int? originalRuleID, string originalMileage, string originalStartWorkMileage, string originalCompleteWorkMileage, int? originalLibraryCategoriesId, string newNumber, DateTime? newDateTime, bool newMtoDto, string newDescription, int? newUnitId, string newType, string newState, int newOwnerId, DateTime? newAssignDateTime, DateTime? newAssignDeadlineDate, bool newAssignTeamMember, int? newAssignTeamMemberID, string newAssignThirdPartyVendor, DateTime? newAcceptDateTime, DateTime? newRejectDateTime, string newRejectReason, DateTime? newStartWorkDateTime, DateTime? newStartWorkOutOfServiceDate, string newStartWorkOutOfServiceTime, DateTime? newCompleteWorkDateTime, DateTime? newCompleteWorkBackToServiceDate, string newCompleteWorkBackToServiceTime, string newCompleteWorkDetailDescription, bool newCompleteWorkDetailPreventable, decimal? newCompleteWorkDetailTMLabourHours, decimal? newCompleteWorkDetailTMCost, string newCompleteWorkDetailTPVInvoiceNumber, decimal? newCompleteWorkDetailTPVInvoiceAmout, bool newDeleted, int newCompanyId, string newNotes, int? newRuleID, string newMileage, string newStartWorkMileage, string newCompleteWorkMileage, int? newLibraryCategoriesId) { ServicesGateway servicesGateway = new ServicesGateway(null); servicesGateway.Update(serviceId, originalNumber, originalDateTime, originalMtoDto, originalDescription, originalUnitId, originalType, originalState, originalOwnerId, originalAssignDateTime, originalAssignDeadlineDate, originalAssignTeamMember, originalAssignTeamMemberID, originalAssignThirdPartyVendor, originalAcceptDateTime, originalRejectDateTime, originalRejectReason, originalStartWorkDateTime, originalStartWorkOutOfServiceDate, originalStartWorkOutOfServiceTime, originalCompleteWorkDateTime, originalCompleteWorkBackToServiceDate, originalCompleteWorkBackToServiceTime, originalCompleteWorkDetailDescription, originalCompleteWorkDetailPreventable, originalCompleteWorkDetailTMLabourHours, originalCompleteWorkDetailTMCost, originalCompleteWorkDetailTPVInvoiceNumber, originalCompleteWorkDetailTPVInvoiceAmout, originalDeleted, originalCompanyId, originalNotes, originalRuleID, originalLibraryCategoriesId, newNumber, newDateTime, newMtoDto, newDescription, newUnitId, newType, newState, newOwnerId, newAssignDateTime, newAssignDeadlineDate, newAssignTeamMember, newAssignTeamMemberID, newAssignThirdPartyVendor, newAcceptDateTime, newRejectDateTime, newRejectReason, newStartWorkDateTime, newStartWorkOutOfServiceDate, newStartWorkOutOfServiceTime, newCompleteWorkDateTime, newCompleteWorkBackToServiceDate, newCompleteWorkBackToServiceTime, newCompleteWorkDetailDescription, newCompleteWorkDetailPreventable, newCompleteWorkDetailTMLabourHours, newCompleteWorkDetailTMCost, newCompleteWorkDetailTPVInvoiceNumber, newCompleteWorkDetailTPVInvoiceAmout, newDeleted, newCompanyId, newNotes, newRuleID, newLibraryCategoriesId); // Validate unit type if (originalUnitId.HasValue) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)originalUnitId, originalCompanyId); string unitType = unitsGateway.GetType((int)originalUnitId); // ... Insert vehicle info if (unitType == "Vehicle") { ServicesVehicle servicesVehicle = new ServicesVehicle(null); servicesVehicle.UpdateDirect(serviceId, originalMileage, originalStartWorkMileage, originalCompleteWorkMileage, originalDeleted, originalCompanyId, newMileage, newStartWorkMileage, newCompleteWorkMileage, newDeleted, newCompanyId); } } }
protected void cvStartMileage_ServerValidate(object source, ServerValidateEventArgs args) { args.IsValid = true; CustomValidator cvConditions = (CustomValidator)source; int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); string unitType = unitsGateway.GetType((int)unitId); if (unitType == "Vehicle") { if (ckbxStartSR.Checked) { if (tbxStartWorkStartMileage.Text == "") { cvConditions.ErrorMessage = "Please provide a mileage."; args.IsValid = false; } } else { if (tbxStartWorkStartMileage.Text != "") { cvConditions.ErrorMessage = "Please delete the mileage."; args.IsValid = false; } } } }
private void LoadData(int toDoId) { ToDoListInformationBasicInformationGateway toDoListInformationBasicInformationGateway = new ToDoListInformationBasicInformationGateway(toDoListInformationTDS); if (toDoListInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load to do Details int companyId = Int32.Parse(hdfCompanyId.Value); int createdById = toDoListInformationBasicInformationGateway.GetCreatedByID(toDoId); hdfCreatedById.Value = createdById.ToString(); EmployeeGateway employeeGateway = new EmployeeGateway(); employeeGateway.LoadByEmployeeId(createdById); tbxCreatedBy.Text = employeeGateway.GetFullName(createdById); tbxCreationDate.Text = toDoListInformationBasicInformationGateway.GetCreationDate(toDoId).ToString(); tbxState.Text = toDoListInformationBasicInformationGateway.GetState(toDoId); if (toDoListInformationBasicInformationGateway.GetDueDate(toDoId).HasValue) { DateTime dueDateValue = (DateTime)toDoListInformationBasicInformationGateway.GetDueDate(toDoId); tbxDueDate.Text = dueDateValue.Month.ToString() + "/" + dueDateValue.Day.ToString() + "/" + dueDateValue.Year.ToString(); } int? unitId = toDoListInformationBasicInformationGateway.GetUnitID(toDoId); tbxUnit.Text = ""; if (unitId.HasValue) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); tbxUnit.Text = unitsGateway.GetUnitCode((int)unitId) + " " + unitsGateway.GetDescription((int)unitId); } } }
private void Generate() { mReport1 master = (mReport1)this.Master; int companyId = Convert.ToInt32(Session["companyID"]); // Get Data LiquiForce.LFSLive.BL.FleetManagement.Units.UnitInformationReport unitInformationReport = new LiquiForce.LFSLive.BL.FleetManagement.Units.UnitInformationReport(); if (rbtnByUnit.Checked) { if (ddlUnits.SelectedValue == "-1") { unitInformationReport.Load(companyId); } else { int unitId = Int32.Parse(ddlUnits.SelectedValue); unitInformationReport.LoadByUnitId(unitId, companyId); } } if (rbtnByUnitType.Checked) { unitInformationReport.LoadByUnitType(ddlUnitType.SelectedValue, companyId); } // ... set properties to master page master.Data = unitInformationReport.Data; master.Table = unitInformationReport.TableName; // Get report if (unitInformationReport.Table.Rows.Count > 0) { if (master.Format == "pdf") { master.Report = new UnitsInformationReport(); int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); if (rbtnByUnit.Checked) { if (ddlUnits.SelectedValue != "-1") { // For unit code int unitId = Int32.Parse(ddlUnits.SelectedValue); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitCode = unitsGateway.GetUnitCode(unitId); master.SetParameter("Unit", unitCode); } else { master.SetParameter("Unit", "All"); } } else { master.SetParameter("Unit", "All"); } } else { master.Report = new UnitsInformationReportExport(); } } }
// //////////////////////////////////////////////////////////////////////// // NAVIGATION EVENTS // protected void tkrmTop_ItemClick(object sender, RadMenuEventArgs e) { // Store active tab for postback Session["activeTabUnits"] = "0"; Session["dialogOpenedUnits"] = "0"; string activeTab = hdfActiveTab.Value; string url = ""; switch (e.Item.Value) { case "mSave": this.Save(); break; case "mApply": this.Apply(); break; case "mCancel": Session.Remove("libraryTDSForUnits"); if (Request.QueryString["source_page"] == "units_navigator2.aspx" || Request.QueryString["source_page"] == "units_add.aspx") { url = "./units_navigator2.aspx?source_page=units_edit.aspx" + GetNavigatorState() + "&update=" + (string)ViewState["update"]; } if (Request.QueryString["source_page"] == "units_summary.aspx") { url = "./units_summary.aspx?source_page=units_edit.aspx&unit_id=" + hdfUnitId.Value + "&unit_type=" + hdfUnitType.Value + "&unit_state=" + hdfUnitState.Value + "&active_tab=" + hdfActiveTab.Value + GetNavigatorState() + "&update=" + (string)ViewState["update"]; } break; case "mPrevious": Session.Remove("libraryTDSForUnits"); // Get previous record int previousId = UnitsNavigator.GetPreviousId((UnitsNavigatorTDS)Session["unitsNavigatorTDS"], Int32.Parse(hdfUnitId.Value)); if (previousId != Int32.Parse(hdfUnitId.Value)) { this.Apply(); // ... Redirect int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); string unitState = unitsGateway.GetState(unitId); url = "./units_edit.aspx?source_page=" + Request.QueryString["source_page"] + "&unit_id=" + previousId + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=" + activeTab + GetNavigatorState() + "&update=yes"; } break; case "mNext": Session.Remove("libraryTDSForUnits"); // Get next record int nextId = UnitsNavigator.GetNextId((UnitsNavigatorTDS)Session["unitsNavigatorTDS"], Int32.Parse(hdfUnitId.Value)); if (nextId != Int32.Parse(hdfUnitId.Value)) { this.Apply(); // ... Redirect int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitType = unitsGateway.GetType(unitId); string unitState = unitsGateway.GetState(unitId); url = "./units_edit.aspx?source_page=" + Request.QueryString["source_page"] + "&unit_id=" + nextId + "&unit_type=" + unitType + "&unit_state=" + unitState + "&active_tab=" + activeTab + GetNavigatorState() + "&update=yes"; } break; } if (url != "") Response.Redirect(url); }
private void Generate() { mReport1 master = (mReport1)this.Master; int companyId = Convert.ToInt32(Session["companyID"]); string checklistState = ddlChecklistState.SelectedValue; string mtoDotRules = ddlMtoDotRule.SelectedValue; string frequency = ddlFrequency.SelectedValue; string workingLocation = ddlWorkingLocation.SelectedValue; // Get Data LiquiForce.LFSLive.BL.FleetManagement.Units.UnitChecklistsReportUnitDetails unitChecklistsReportUnitDetails = new LiquiForce.LFSLive.BL.FleetManagement.Units.UnitChecklistsReportUnitDetails(); // ... Load data by unit if (rbtnByUnit.Checked) { unitChecklistsReportUnitDetails.LoadByUnitId(Int32.Parse(ddlUnits.SelectedValue), mtoDotRules, frequency, checklistState, companyId); } // ... Load data by unit type bool allUnits = ckbxAllUnits.Checked; if (rbtnByUnitType.Checked) { if (ddlUnitType.SelectedValue == "All") { if (ddlWorkingLocation.SelectedValue == "All") { unitChecklistsReportUnitDetails.Load(mtoDotRules, frequency, checklistState, companyId, allUnits); } else { unitChecklistsReportUnitDetails.LoadByWorkingLocation(workingLocation, mtoDotRules, frequency, checklistState, companyId, allUnits); } } else { if (ddlWorkingLocation.SelectedValue == "All") { unitChecklistsReportUnitDetails.LoadByUnitType(ddlUnitType.SelectedValue, mtoDotRules, frequency, checklistState, companyId, allUnits); } else { unitChecklistsReportUnitDetails.LoadByUnitTypeWorkingLocation(ddlUnitType.SelectedValue, workingLocation, mtoDotRules, frequency, checklistState, companyId, allUnits); } } } // ... set properties to master page master.Data = unitChecklistsReportUnitDetails.Data; master.Table = unitChecklistsReportUnitDetails.TableName; // Get report if (unitChecklistsReportUnitDetails.Table.Rows.Count > 0) { if (master.Format == "pdf") { master.Report = new UnitsChecklistsReport(); int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); // For unit code if (rbtnByUnit.Checked) { int unitId = Int32.Parse(ddlUnits.SelectedValue); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitCode = unitsGateway.GetUnitCode(unitId); master.SetParameter("Unit", unitCode); } else { master.SetParameter("Unit", ""); } // For Unit Type if (rbtnByUnitType.Checked) { if (ddlUnitType.SelectedValue == "All") { master.SetParameter("UnitType", "All"); } else { master.SetParameter("UnitType", ddlUnitType.SelectedValue); } } else { master.SetParameter("UnitType", ""); } // For Working Location if (ddlWorkingLocation.SelectedValue == "All") { master.SetParameter("WorkingLocation", "All"); } else { if (ddlWorkingLocation.SelectedValue == "3") { master.SetParameter("WorkingLocation", "LFS USA"); } else { master.SetParameter("WorkingLocation", "LFS Canada"); } } // For MTO/DOT Rules if (ddlMtoDotRule.SelectedValue == "All") { master.SetParameter("MTO", "All"); } else { master.SetParameter("MTO", ddlMtoDotRule.SelectedValue); } // For Frequency if (ddlFrequency.SelectedValue == "(All)") { master.SetParameter("Frequency", "All"); } else { master.SetParameter("Frequency", ddlFrequency.SelectedValue); } // For Checklist State if (ddlChecklistState.SelectedValue == "All") { master.SetParameter("State", "All"); } else { master.SetParameter("State", ddlChecklistState.SelectedValue); } } else { master.Report = new UnitsChecklistsReportExport(); } } }