// // GetNewLfsJunctionLinerDetailId // // Gets a new DetailID to insert a new lfs juntion liner record // public static string GetNewLfsJunctionLinerDetailId(TDSLFSRecord tdsLfsRecord) { string detailIDs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string newDetailID; int lastDetailIDIndex = -1; foreach (TDSLFSRecord.LFS_JUNCTION_LINERRow row in tdsLfsRecord.LFS_JUNCTION_LINER) { if (row.Deleted == false) { int rowIndex = detailIDs.IndexOf(row.DetailID); if (lastDetailIDIndex < rowIndex) { lastDetailIDIndex = rowIndex; } } } if (lastDetailIDIndex < 25 ) { lastDetailIDIndex ++; newDetailID = detailIDs[lastDetailIDIndex].ToString(); } else { newDetailID = "-1"; } return newDetailID; }
// // GetNewM2TablesRefId GetNewLfsPointRepairsRefId // public static int GetNewLfsM2TablesRefId(TDSLFSRecord tdsLfsRecord) { int newRefId = 0; foreach (TDSLFSRecord.LFS_M2_TABLESRow row in tdsLfsRecord.LFS_M2_TABLES) { if (newRefId < row.RefID) { newRefId = row.RefID; } } newRefId ++; return newRefId; }
// // GetNewLfsJunctionLinerRefId // public static int GetNewLfsJunctionLinerRefId(TDSLFSRecord tdsLfsRecord) { int newRefId = 0; foreach (TDSLFSRecord.LFS_JUNCTION_LINERRow row in tdsLfsRecord.LFS_JUNCTION_LINER) { if (newRefId < row.RefID) { newRefId = row.RefID; } } newRefId ++; return newRefId; }
// // GetNewLfsPointRepairsDetailId // // Gets a new DetailID to insert a new lfs point repairs record // public static string GetNewLfsPointRepairsDetailId(TDSLFSRecord tdsLfsRecord) { string detailIDs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string newDetailID; int lastDetailIDIndex = -1; foreach (TDSLFSRecord.LFS_POINT_REPAIRSRow row in tdsLfsRecord.LFS_POINT_REPAIRS) { if (row.Deleted == false) { int rowIndex = detailIDs.IndexOf(row.DetailID); if (lastDetailIDIndex < rowIndex) { lastDetailIDIndex = rowIndex; } } } if (lastDetailIDIndex < 25 ) { lastDetailIDIndex ++; newDetailID = detailIDs[lastDetailIDIndex].ToString(); } else { newDetailID = "-1"; } return newDetailID; }
/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new TDSLFSRecord(); }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx"); } // Prepare initial values Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); // If coming from navigator2.aspx or view_scopesheet.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_scopesheet.aspx")) { int companyId = Convert.ToInt32(Session["companyID"]); Guid id = (Guid)Session["lfsMasterAreaId"]; //... Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId); AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS); addRecordPointRepairsGateway.LoadById(id, companyId); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } // Prepare initial data // ... for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // ... for traffic control LFSTrafficControlGateway lfsTrafficControlGateway = new LFSTrafficControlGateway(); DataSet dsLfsTrafficControl = lfsTrafficControlGateway.GetLFSTrafficControlForDropDownList(""); ddlDegreeOfTrafficControl.DataSource = dsLfsTrafficControl; ddlDegreeOfTrafficControl.DataTextField = "TrafficControl"; // Databind Page.DataBind(); TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"])); ddlDegreeOfTrafficControl.SelectedValue = (lfsMasterAreaRow.IsDegreeOfTrafficControlNull()) ? "" : lfsMasterAreaRow.DegreeOfTrafficControl; } else { // Restore datasets tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tdsLfsRecord = new TDSLFSRecord(); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).BeginInit(); this.cvM2Date.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); // // tdsLfsRecord // this.tdsLfsRecord.DataSetName = "TDSLFSRecord"; this.tdsLfsRecord.Locale = new System.Globalization.CultureInfo("en-US"); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).EndInit(); }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Prepare initial Session.Remove("lfsM2TablesDummy"); //... Restore data set lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; // ... for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // ... for measurement type LFSMeasurementTypeGateway lfsMeasurementTypeGateway = new LFSMeasurementTypeGateway(); DataSet dsLfsMeasurementType = lfsMeasurementTypeGateway.GetLFSMeasurementTypeForDropDownList(""); ddlMeasurementType.DataSource = dsLfsMeasurementType; ddlMeasurementType.DataTextField = "MeasurementType"; // Load LfsM2Tables data int companyId = Convert.ToInt32(Session["companyID"]); Guid id = new Guid(Request.QueryString["id"].ToString()); hdfId.Value = Request.QueryString["id"].ToString(); viewFullLengthLiningTDS = new ViewFullLengthLiningTDS(); ViewFullLengthLiningLfsM2TablesGateway viewFullLengthLiningLfsM2TablesGateway = new ViewFullLengthLiningLfsM2TablesGateway(viewFullLengthLiningTDS); viewFullLengthLiningLfsM2TablesGateway.LoadById(id, companyId); Session["viewFullLengthLiningTDS"] = viewFullLengthLiningTDS; lfsM2Tables = viewFullLengthLiningTDS.LfsM2Tables; Session["lfsM2Tables"] = lfsM2Tables; // Databind Page.DataBind(); TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"])); ddlMeasurementType.SelectedValue = (lfsMasterAreaRow.IsMeasurementTypeNull()) ? "" : lfsMasterAreaRow.MeasurementType; } else { // Restore data set lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; viewFullLengthLiningTDS = (ViewFullLengthLiningTDS)Session["viewFullLengthLiningTDS"]; } }
/////////////////////////////////////////////////////////////////////////// /// METHODS /// // // GetChanges // public static TDSLFSRecord GetChanges(TDSLFSRecord originalData, TDSLFSRecord currentData, int currentUser) { TDSLFSRecord result = new TDSLFSRecord(); string changes; string currentValue; string originalValue; DateTime changed = DateTime.Now; //--- Get changes from master area //--- ... Calculate changes TDSLFSRecord.LFS_MASTER_AREARow originalLfsMasterAreaRow = originalData.LFS_MASTER_AREA.FindByIDCOMPANY_ID(currentData.LFS_MASTER_AREA[0].ID, currentData.LFS_MASTER_AREA[0].COMPANY_ID); changes = ""; if (originalLfsMasterAreaRow == null) { for (int i = 0; i < currentData.LFS_MASTER_AREA.Columns.Count; i++) { if (!currentData.LFS_MASTER_AREA[0].IsNull(i)) { changes += originalData.LFS_MASTER_AREA.Columns[i].ColumnName + columnValueSeparator + currentData.LFS_MASTER_AREA[0][i].ToString() + columnSeparator; } } } else { for (int i = 0; i < currentData.LFS_MASTER_AREA.Columns.Count; i++) { currentValue = (currentData.LFS_MASTER_AREA[0].IsNull(i)) ? "" : currentData.LFS_MASTER_AREA[0][i].ToString(); originalValue = (originalLfsMasterAreaRow.IsNull(i)) ? "" : originalLfsMasterAreaRow[i].ToString(); if (currentValue != originalValue) { changes += originalData.LFS_MASTER_AREA.Columns[i].ColumnName + columnValueSeparator + currentValue + columnSeparator; } } } changes = (changes != "") ? changes.Remove(changes.LastIndexOf(columnSeparator), columnSeparator.Length) : ""; //--- ... Add rct record to result if (changes != "") { TDSLFSRecord.LFS_MASTER_AREA_RCTRow lfsMasterAreaRctRow = result.LFS_MASTER_AREA_RCT.NewLFS_MASTER_AREA_RCTRow(); lfsMasterAreaRctRow.ID = currentData.LFS_MASTER_AREA[0].ID; lfsMasterAreaRctRow.COMPANY_ID = currentData.LFS_MASTER_AREA[0].COMPANY_ID; lfsMasterAreaRctRow.Changes = changes; lfsMasterAreaRctRow.Operation = (originalLfsMasterAreaRow == null) ? "Add" : ((currentData.LFS_MASTER_AREA[0].Deleted == true) ? "Delete" : "Update"); lfsMasterAreaRctRow.ChangedBy = currentUser; lfsMasterAreaRctRow.Changed = changed; result.LFS_MASTER_AREA_RCT.AddLFS_MASTER_AREA_RCTRow(lfsMasterAreaRctRow); } //--- Get changes from point repairs TDSLFSRecord.LFS_POINT_REPAIRSRow originalLfsPointRepairsRow; foreach (TDSLFSRecord.LFS_POINT_REPAIRSRow currentLfsPointRepairsRow in currentData.LFS_POINT_REPAIRS) { //--- ... Calculate changes originalLfsPointRepairsRow = originalData.LFS_POINT_REPAIRS.FindByIDRefIDCOMPANY_ID(currentLfsPointRepairsRow.ID, currentLfsPointRepairsRow.RefID, currentLfsPointRepairsRow.COMPANY_ID); changes = ""; if (originalLfsPointRepairsRow == null) { for (int i = 0; i < currentData.LFS_POINT_REPAIRS.Columns.Count; i++) { if (!currentLfsPointRepairsRow.IsNull(i)) { changes += currentData.LFS_POINT_REPAIRS.Columns[i].ColumnName + columnValueSeparator + currentLfsPointRepairsRow[i].ToString() + columnSeparator; } } } else { for (int i = 0; i < currentData.LFS_POINT_REPAIRS.Columns.Count; i++) { currentValue = (currentLfsPointRepairsRow.IsNull(i)) ? "" : currentLfsPointRepairsRow[i].ToString(); originalValue = (originalLfsPointRepairsRow.IsNull(i)) ? "" : originalLfsPointRepairsRow[i].ToString(); if (currentValue != originalValue) { changes += currentData.LFS_POINT_REPAIRS.Columns[i].ColumnName + columnValueSeparator + currentValue + columnSeparator; } } } changes = (changes != "") ? changes.Remove(changes.LastIndexOf(columnSeparator), columnSeparator.Length) : ""; //--- ... Add rct record to result if (changes != "") { TDSLFSRecord.LFS_POINT_REPAIRS_RCTRow lfsPointRepairsRctRow = result.LFS_POINT_REPAIRS_RCT.NewLFS_POINT_REPAIRS_RCTRow(); lfsPointRepairsRctRow.ID = currentLfsPointRepairsRow.ID; lfsPointRepairsRctRow.RefID = currentLfsPointRepairsRow.RefID; lfsPointRepairsRctRow.COMPANY_ID = currentLfsPointRepairsRow.COMPANY_ID; lfsPointRepairsRctRow.Changes = changes; lfsPointRepairsRctRow.Operation = (originalLfsPointRepairsRow == null) ? "Add" : ((currentLfsPointRepairsRow.Deleted == true) ? "Delete" : "Update"); lfsPointRepairsRctRow.ChangedBy = currentUser; lfsPointRepairsRctRow.Changed = changed; result.LFS_POINT_REPAIRS_RCT.AddLFS_POINT_REPAIRS_RCTRow(lfsPointRepairsRctRow); } } //--- Get changes from m2 tables TDSLFSRecord.LFS_M2_TABLESRow originalLfsM2TablesRow; foreach (TDSLFSRecord.LFS_M2_TABLESRow currentLfsM2TablesRow in currentData.LFS_M2_TABLES) { //--- ... Calculate changes originalLfsM2TablesRow = originalData.LFS_M2_TABLES.FindByIDRefIDCOMPANY_ID(currentLfsM2TablesRow.ID, currentLfsM2TablesRow.RefID, currentLfsM2TablesRow.COMPANY_ID); changes = ""; if (originalLfsM2TablesRow == null) { for (int i = 0; i < currentData.LFS_M2_TABLES.Columns.Count; i++) { if (!currentLfsM2TablesRow.IsNull(i)) { changes += currentData.LFS_M2_TABLES.Columns[i].ColumnName + columnValueSeparator + currentLfsM2TablesRow[i].ToString() + columnSeparator; } } } else { for (int i = 0; i < currentData.LFS_M2_TABLES.Columns.Count; i++) { currentValue = (currentLfsM2TablesRow.IsNull(i)) ? "" : currentLfsM2TablesRow[i].ToString(); originalValue = (originalLfsM2TablesRow.IsNull(i)) ? "" : originalLfsM2TablesRow[i].ToString(); if (currentValue != originalValue) { changes += currentData.LFS_M2_TABLES.Columns[i].ColumnName + columnValueSeparator + currentValue + columnSeparator; } } } changes = (changes != "") ? changes.Remove(changes.LastIndexOf(columnSeparator), columnSeparator.Length) : ""; //--- ... Add rct record to result if (changes != "") { TDSLFSRecord.LFS_M2_TABLES_RCTRow lfsM2TablesRctRow = result.LFS_M2_TABLES_RCT.NewLFS_M2_TABLES_RCTRow(); lfsM2TablesRctRow.ID = currentLfsM2TablesRow.ID; lfsM2TablesRctRow.RefID = currentLfsM2TablesRow.RefID; lfsM2TablesRctRow.COMPANY_ID = currentLfsM2TablesRow.COMPANY_ID; lfsM2TablesRctRow.Changes = changes; lfsM2TablesRctRow.Operation = (originalLfsM2TablesRow == null) ? "Add" : ((currentLfsM2TablesRow.Deleted == true) ? "Delete" : "Update"); lfsM2TablesRctRow.ChangedBy = currentUser; lfsM2TablesRctRow.Changed = changed; result.LFS_M2_TABLES_RCT.AddLFS_M2_TABLES_RCTRow(lfsM2TablesRctRow); } } //--- Get changes from junction liner TDSLFSRecord.LFS_JUNCTION_LINERRow originalLfsJunctionLinerRow; foreach (TDSLFSRecord.LFS_JUNCTION_LINERRow currentLfsJunctionLinerRow in currentData.LFS_JUNCTION_LINER) { //--- ... Calculate changes originalLfsJunctionLinerRow = originalData.LFS_JUNCTION_LINER.FindByIDRefIDCOMPANY_ID(currentLfsJunctionLinerRow.ID, currentLfsJunctionLinerRow.RefID, currentLfsJunctionLinerRow.COMPANY_ID); changes = ""; if (originalLfsJunctionLinerRow == null) { for (int i = 0; i < currentData.LFS_JUNCTION_LINER.Columns.Count; i++) { if (!currentLfsJunctionLinerRow.IsNull(i)) { changes += currentData.LFS_JUNCTION_LINER.Columns[i].ColumnName + columnValueSeparator + currentLfsJunctionLinerRow[i].ToString() + columnSeparator; } } } else { for (int i = 0; i < currentData.LFS_JUNCTION_LINER.Columns.Count; i++) { currentValue = (currentLfsJunctionLinerRow.IsNull(i)) ? "" : currentLfsJunctionLinerRow[i].ToString(); originalValue = (originalLfsJunctionLinerRow.IsNull(i)) ? "" : originalLfsJunctionLinerRow[i].ToString(); if (currentValue != originalValue) { changes += currentData.LFS_JUNCTION_LINER.Columns[i].ColumnName + columnValueSeparator + currentValue + columnSeparator; } } } changes = (changes != "") ? changes.Remove(changes.LastIndexOf(columnSeparator), columnSeparator.Length) : ""; //--- ... Add rct record to result if (changes != "") { TDSLFSRecord.LFS_JUNCTION_LINER_RCTRow lfsJunctionLinerRctRow = result.LFS_JUNCTION_LINER_RCT.NewLFS_JUNCTION_LINER_RCTRow(); lfsJunctionLinerRctRow.ID = currentLfsJunctionLinerRow.ID; lfsJunctionLinerRctRow.RefID = currentLfsJunctionLinerRow.RefID; lfsJunctionLinerRctRow.COMPANY_ID = currentLfsJunctionLinerRow.COMPANY_ID; lfsJunctionLinerRctRow.Changes = changes; lfsJunctionLinerRctRow.Operation = (originalLfsJunctionLinerRow == null) ? "Add" : ((currentLfsJunctionLinerRow.Deleted == true) ? "Delete" : "Update"); lfsJunctionLinerRctRow.ChangedBy = currentUser; lfsJunctionLinerRctRow.Changed = changed; result.LFS_JUNCTION_LINER_RCT.AddLFS_JUNCTION_LINER_RCTRow(lfsJunctionLinerRctRow); } } //--- Return changes return result; }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_jlinersheet.aspx"); } // Prepare initial data Session.Remove("jlinerDummy"); lblMaxNumber.Visible = false; // If coming from navigator2.aspx or view_jlinersheet.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_jlinersheet.aspx")) { //... Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); viewJLinersheetTDS = new ViewJLinersheetTDS(); ViewJLinersheetJunctionLinerGateway viewJLinersheetJunctionLinerGateway = new ViewJLinersheetJunctionLinerGateway(viewJLinersheetTDS); viewJLinersheetJunctionLinerGateway.LoadById((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["viewJLinersheetTDS"] = viewJLinersheetTDS; jliner = viewJLinersheetTDS.JunctionLiner; Session["jliner"] = jliner; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; viewJLinersheetTDS = (ViewJLinersheetTDS)Session["viewJLinersheetTDS"]; } // ... for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // Databind Page.DataBind(); ddlMainLined.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsMainLinedNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].MainLined == "Yes") ? 0 : 1); ddlBenchingIssue.SelectedIndex = (tdsLfsRecord.LFS_MASTER_AREA[0].IsBenchingIssueNull()) ? 2 : ((tdsLfsRecord.LFS_MASTER_AREA[0].BenchingIssue == "Yes") ? 0 : 1); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; viewJLinersheetTDS = (ViewJLinersheetTDS)Session["viewJLinersheetTDS"]; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tdsLfsRecord = new TDSLFSRecord(); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).BeginInit(); // // tdsLfsRecord // this.tdsLfsRecord.DataSetName = "TDSLFSRecord"; this.tdsLfsRecord.Locale = new System.Globalization.CultureInfo("en-US"); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).EndInit(); }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx"); } //... Prepare initial Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); // If coming from navigator2.aspx or view_pointliner.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_pointliner.aspx")) { int companyId = Convert.ToInt32(Session["companyID"]); Guid id = (Guid)Session["lfsMasterAreaId"]; // Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(id, companyId); AddRecordPointRepairsGateway addRecordPointRepairsGateway = new AddRecordPointRepairsGateway(addRecordTDS); addRecordPointRepairsGateway.LoadById(id, companyId); //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; } // If coming from delete_record.aspx if ((string)Request.QueryString["record_deleted"] == "false") { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } // Prepare initial data for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); // Databind Page.DataBind(); } else { // Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// // // Page_Load // protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!(Convert.ToBoolean(Session["sgLFS_APP_VIEW"]) && Convert.ToBoolean(Session["sgLFS_APP_DELETE"]))) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } //--- Validate query string if ((Request.QueryString["source_page"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in delete_record.aspx"); } //--- If coming from navigator2.aspx if ((string)Request.QueryString["source_page"] == "navigator2.aspx") { //--- Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } //--- Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; //--- Databind Page.DataBind(); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } }
// // AutofillLinerOrdered // private void AutofillLinerOrdered() { //--- Initialize TDSLFSRecord currentTdsLfsRecord = new TDSLFSRecord(); // holds the current record being autofilled TDSLFSRecord allTdsLfsRecord = new TDSLFSRecord(); // holds all the records autofilled so far string currentId; // holds the current id being autofilled string lastId = ""; // holds the last id autofilled so far LFSRecordForReportsGateway lfsRecordForReportsGateway = new LFSRecordForReportsGateway(); LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); //--- Autofill LinerOrdered //--- ... Get the jliners to be autofilled TDSJLinersToBuild tdsJLinersToBuild = lfsRecordForReportsGateway.GetJLinersToBuildByCompanyId(Convert.ToInt32(Session["companyID"])); foreach (TDSJLinersToBuild.JLinersToBuildRow jLinersToBuildRow in tdsJLinersToBuild.JLinersToBuild) { currentId = jLinersToBuildRow.ID; if (currentId != lastId) { //--- ... Get the lfs record corresponding to the jliner to be autofilled currentTdsLfsRecord.Clear(); currentTdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId(new Guid(currentId), Convert.ToInt32(Session["companyID"])); //--- ... Autofill the jliners DataView dataView = new DataView(tdsJLinersToBuild.JLinersToBuild, "ID='" + currentId + "'", "", DataViewRowState.CurrentRows); foreach (DataRowView row in dataView) { TDSLFSRecord.LFS_JUNCTION_LINERRow currentLfsJunctionLinerRow = currentTdsLfsRecord.LFS_JUNCTION_LINER.FindByIDRefIDCOMPANY_ID(new Guid((string)row["ID"]), (int)row["RefID"], (int)row["COMPANY_ID"]); currentLfsJunctionLinerRow.LinerOrdered = true; } allTdsLfsRecord.Merge(currentTdsLfsRecord); lastId = currentId; } } //--- Update database try { lfsRecordGateway.UpdateRecord(allTdsLfsRecord); } catch(Exception ex) { Response.Redirect("./../error_page.aspx?error=" + ex.Message); } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// // // Page_Load // protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; //--- Prepare initial data hdfId.Value = Request.QueryString["id"].ToString(); //--- ... for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); //--- ... for traffic control LFSTrafficControlGateway lfsTrafficControlGateway = new LFSTrafficControlGateway(); DataSet dsLfsTrafficControl = lfsTrafficControlGateway.GetLFSTrafficControlForDropDownList(""); ddlDegreeOfTrafficControl.DataSource = dsLfsTrafficControl; ddlDegreeOfTrafficControl.DataTextField = "TrafficControl"; //--- Databind Page.DataBind(); TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.FindByIDCOMPANY_ID(new Guid(tbxID.Text), Convert.ToInt32(Session["companyID"])); ddlDegreeOfTrafficControl.SelectedValue = (lfsMasterAreaRow.IsDegreeOfTrafficControlNull()) ? "" : lfsMasterAreaRow.DegreeOfTrafficControl; } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } }
/////////////////////////////////////////////////////////////////////////// /// METHODS /// // // GetNewLfsPointRepairsRefId // public static int GetNewLfsPointRepairsRefId(TDSLFSRecord tdsLfsRecord) { int newRefId = 0; foreach (TDSLFSRecord.LFS_POINT_REPAIRSRow row in tdsLfsRecord.LFS_POINT_REPAIRS) { if (newRefId < row.RefID) { newRefId = row.RefID; } } newRefId ++; return newRefId; }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// // // Page_Load // protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"])) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } //--- Validate query string if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["record_deleted"] == null)) { Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in view_fulllength.aspx"); } //--- If coming from navigator2.aspx or view_fulllength.aspx if (((string)Request.QueryString["source_page"] == "navigator2.aspx") || ((string)Request.QueryString["source_page"] == "view_fulllength.aspx")) { //--- Get lfs master area record LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); tdsLfsRecord = lfsRecordGateway.GetRecordByIdCompanyId((Guid)Session["lfsMasterAreaId"], Convert.ToInt32(Session["companyID"])); hdfId.Value = ((Guid)Session["lfsMasterAreaId"]).ToString(); //--- Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; } //--- If coming from view_fulllength_m1.aspx, view_fulllength_m2.aspx, or delete_record.aspx if (((string)Request.QueryString["source_page"] == "view_fulllength_m1.aspx") || ((string)Request.QueryString["source_page"] == "view_fulllength_m2.aspx") || ((string)Request.QueryString["record_deleted"] == "false")) { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } //--- Prepare initial data for client CompaniesGateway companiesGateway = new CompaniesGateway(); tbxCOMPANIES_ID.Text = companiesGateway.GetName((int)tdsLfsRecord.LFS_MASTER_AREA.Rows[0]["COMPANIES_ID"], Convert.ToInt32(Session["companyID"])); //--- Databind Page.DataBind(); } else { //--- Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; } }
// // UpdateRecord // // Updates the database from a typed dataset containing a row for LFS_MASTER_AREA, // zero or more rows for LFS_POINT_REPAIRS, and zero or more rows for LFS_M2_TABLES. // public void UpdateRecord(TDSLFSRecord dataSet) { //--- Prepare transaction //--- ... Open connection and start transaction dcConnection.Open(); SqlTransaction transaction = dcConnection.BeginTransaction(); //--- ... Assign transaction to data adapters this.daLFSMasterArea.InsertCommand.Transaction = transaction; this.daLFSMasterArea.UpdateCommand.Transaction = transaction; this.daLFSMasterArea.DeleteCommand.Transaction = transaction; this.daLFSPointRepairs.InsertCommand.Transaction = transaction; this.daLFSPointRepairs.UpdateCommand.Transaction = transaction; this.daLFSPointRepairs.DeleteCommand.Transaction = transaction; this.daLFSM2Tables.InsertCommand.Transaction = transaction; this.daLFSM2Tables.UpdateCommand.Transaction = transaction; this.daLFSM2Tables.DeleteCommand.Transaction = transaction; this.daLFSJunctionLiner.InsertCommand.Transaction = transaction; this.daLFSJunctionLiner.UpdateCommand.Transaction = transaction; this.daLFSJunctionLiner.DeleteCommand.Transaction = transaction; this.daLFSJunctionLiner2.InsertCommand.Transaction = transaction; this.daLFSJunctionLiner2.UpdateCommand.Transaction = transaction; this.daLFSJunctionLiner2.DeleteCommand.Transaction = transaction; this.daLfsMasterAreaRct.InsertCommand.Transaction = transaction; this.daLfsMasterAreaRct.UpdateCommand.Transaction = transaction; this.daLfsMasterAreaRct.DeleteCommand.Transaction = transaction; this.daLfsPointRepairsRct.InsertCommand.Transaction = transaction; this.daLfsPointRepairsRct.UpdateCommand.Transaction = transaction; this.daLfsPointRepairsRct.DeleteCommand.Transaction = transaction; this.daLfsM2TablesRct.InsertCommand.Transaction = transaction; this.daLfsM2TablesRct.UpdateCommand.Transaction = transaction; this.daLfsM2TablesRct.DeleteCommand.Transaction = transaction; this.daLfsJunctionLinerRct.InsertCommand.Transaction = transaction; this.daLfsJunctionLinerRct.UpdateCommand.Transaction = transaction; this.daLfsJunctionLinerRct.DeleteCommand.Transaction = transaction; try { //--- Update database //--- ... deletes daLFSJunctionLiner.Update(dataSet.LFS_JUNCTION_LINER.Select("", "", DataViewRowState.Deleted)); daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.Deleted)); daLFSM2Tables.Update(dataSet.LFS_M2_TABLES.Select("", "", DataViewRowState.Deleted)); daLFSPointRepairs.Update(dataSet.LFS_POINT_REPAIRS.Select("", "", DataViewRowState.Deleted)); daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.Deleted)); //--- ... updates daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.ModifiedCurrent)); daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.ModifiedCurrent)); daLFSPointRepairs.Update(dataSet.LFS_POINT_REPAIRS.Select("", "", DataViewRowState.ModifiedCurrent)); daLFSM2Tables.Update(dataSet.LFS_M2_TABLES.Select("", "", DataViewRowState.ModifiedCurrent)); daLFSJunctionLiner.Update(dataSet.LFS_JUNCTION_LINER.Select("", "", DataViewRowState.ModifiedCurrent)); //--- ... inserts daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.Added)); daLFSPointRepairs.Update(dataSet.LFS_POINT_REPAIRS.Select("", "", DataViewRowState.Added)); daLFSM2Tables.Update(dataSet.LFS_M2_TABLES.Select("", "", DataViewRowState.Added)); daLFSJunctionLiner.Update(dataSet.LFS_JUNCTION_LINER.Select("", "", DataViewRowState.Added)); daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.Added)); //--- ... record change tracking records daLfsMasterAreaRct.Update(dataSet); daLfsPointRepairsRct.Update(dataSet); daLfsM2TablesRct.Update(dataSet); daLfsJunctionLinerRct.Update(dataSet); //--- Commit transaction transaction.Commit(); } catch(DBConcurrencyException dBConcurrencyException) { //--- Rollback transaction transaction.Rollback(); //--- Throw exception throw new Exception("Concurrency error: Another user already updated the data you are working on. Your operation has been cancelled.", dBConcurrencyException); } catch(SqlException sqlException) { //--- Rollback transaction transaction.Rollback(); //--- Throw exception byte severityLevel = sqlException.Class; if (severityLevel <= 16) { throw new Exception("Low severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } if ((severityLevel >= 17) && (severityLevel <= 19)) { throw new Exception("Mid severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } if (severityLevel >= 20) { throw new Exception("High severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } } catch(Exception e) { //--- Rollback transaction transaction.Rollback(); //--- Throw exception throw new Exception("Unknow error. Your operation has been cancelled.", e); } finally { //--- Close connection if (dcConnection.State == System.Data.ConnectionState.Open) { dcConnection.Close(); } } }
/// //////////////////////////////////////////////////////////////////////// /// EVENTS /// protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //--- Security check if (!(Convert.ToBoolean(Session["sgLFS_APP_VIEW"]) && Convert.ToBoolean(Session["sgLFS_APP_ADD"]))) { Response.Redirect("./../error_page.aspx?error=" + "You are not authorized to add new records. Contact your system administrator."); } //... Add lfs master area record TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.NewLFS_MASTER_AREARow(); lfsMasterAreaRow.ID = newId; lfsMasterAreaRow.COMPANY_ID = Convert.ToInt32(Session["companyID"]); lfsMasterAreaRow.RecordID = ""; tdsLfsRecord.LFS_MASTER_AREA.AddLFS_MASTER_AREARow(lfsMasterAreaRow); //... Prepare initial Session.Remove("pointRepairDummy"); addRecordTDS = new AddRecordTDS(); lblMaxNumber.Visible = false; //... Store datasets Session["tdsLfsRecord"] = tdsLfsRecord; Session["addRecordTDS"] = addRecordTDS; pointRepairs = addRecordTDS.PointRepairs; Session["pointRepairs"] = pointRepairs; // ... For clients CompaniesGateway companiesGateway = new CompaniesGateway(); DataSet dsCompanies = companiesGateway.GetCompaniesForDropDownList("-1", "", Convert.ToInt32(Session["companyID"])); ddlCOMPANIES_ID.DataSource = dsCompanies; ddlCOMPANIES_ID.DataValueField = "COMPANIES_ID"; ddlCOMPANIES_ID.DataTextField = "NAME"; ddlCOMPANIES_ID.SelectedValue = "-1"; //... Databind ddlCOMPANIES_ID.DataBind(); } else { //... Restore dataset lfs record tdsLfsRecord = (TDSLFSRecord)Session["tdsLfsRecord"]; addRecordTDS = (AddRecordTDS)Session["addRecordTDS"]; } }
// // UpdateRecord2 // // Updates the database from a typed dataset containing a row for LFS_MASTER_AREA, // and zero or more rows for LFS_M2_TABLES. // public void UpdateRecord2(TDSLFSRecord dataSet, int companyId, AddRecordTDS addRecordTDS, ViewFullLengthLiningTDS viewFullLengthLiningTDS, ViewJLinersheetTDS viewJLinersheetTDS, string tdsToWork) { //--- Prepare transaction //--- ... Open connection and start transaction dcConnection.Open(); SqlTransaction transaction2 = dcConnection.BeginTransaction(); //... Assign transaction to data adapters this.daLFSMasterArea.InsertCommand.Transaction = transaction2; this.daLFSMasterArea.UpdateCommand.Transaction = transaction2; this.daLFSMasterArea.DeleteCommand.Transaction = transaction2; this.daLFSJunctionLiner2.InsertCommand.Transaction = transaction2; this.daLFSJunctionLiner2.UpdateCommand.Transaction = transaction2; this.daLFSJunctionLiner2.DeleteCommand.Transaction = transaction2; this.daLfsMasterAreaRct.InsertCommand.Transaction = transaction2; this.daLfsMasterAreaRct.UpdateCommand.Transaction = transaction2; this.daLfsMasterAreaRct.DeleteCommand.Transaction = transaction2; this.daLfsJunctionLinerRct.InsertCommand.Transaction = transaction2; this.daLfsJunctionLinerRct.UpdateCommand.Transaction = transaction2; this.daLfsJunctionLinerRct.DeleteCommand.Transaction = transaction2; try { //Update database //... deletes daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.Deleted)); daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.Deleted)); //... updates daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.ModifiedCurrent)); daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.ModifiedCurrent)); //... inserts // Point Repairs daLFSMasterArea.Update(dataSet.LFS_MASTER_AREA.Select("", "", DataViewRowState.Added)); daLFSJunctionLiner2.Update(dataSet.LFS_JUNCTION_LINER2.Select("", "", DataViewRowState.Added)); //... record change tracking records daLfsMasterAreaRct.Update(dataSet); //--- Commit transaction transaction2.Commit(); } catch (DBConcurrencyException dBConcurrencyException) { //--- Rollback transaction transaction2.Rollback(); //--- Throw exception throw new Exception("Concurrency error: Another user already updated the data you are working on. Your operation has been cancelled.", dBConcurrencyException); } catch (SqlException sqlException) { //--- Rollback transaction transaction2.Rollback(); //--- Throw exception byte severityLevel = sqlException.Class; if (severityLevel <= 16) { throw new Exception("Low severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } if ((severityLevel >= 17) && (severityLevel <= 19)) { throw new Exception("Mid severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } if (severityLevel >= 20) { throw new Exception("High severity error. Your operation has been cancelled. SQL Error " + severityLevel + "."); } } catch (Exception e) { //--- Rollback transaction transaction2.Rollback(); //--- Throw exception throw new Exception("Unknow error. Your operation has been cancelled.", e); } finally { //--- Close connection if (dcConnection.State == System.Data.ConnectionState.Open) { dcConnection.Close(); } object[] array = dataSet.LFS_MASTER_AREA.Rows[0].ItemArray; Guid newId = (Guid)array.GetValue(0); if (tdsToWork == "addRecord") { AddRecordPointRepairs addRecordPointRepairs = new AddRecordPointRepairs(addRecordTDS); addRecordPointRepairs.Save(companyId, newId); } if (tdsToWork == "viewFullLengthLining") { ViewFullLengthLiningLfsM2Tables viewFullLengthLiningLfsM2Tables = new ViewFullLengthLiningLfsM2Tables(viewFullLengthLiningTDS); viewFullLengthLiningLfsM2Tables.Save(companyId, newId); } if (tdsToWork == "viewJLinersheet") { ViewJLinersheetJunctionLiner viewJLinersheetJunctionLiner = new ViewJLinersheetJunctionLiner(viewJLinersheetTDS); viewJLinersheetJunctionLiner.Save(companyId, newId); } } }
/////////////////////////////////////////////////////////////////////////// /// METHODS /// // // GetRecordByIdCompanyId // // Returns a typed dataset containing a record. The dataset contains // one row for LFS_MASTER_AREA, zero or more rows for LFS_POINT_REPAIRS, // zero or more rows for LFS_M2_TABLES, and zero or more rows for // LFS_JUNCTION_LINER. // public TDSLFSRecord GetRecordByIdCompanyId(Guid id, int companyId) { TDSLFSRecord dataSet = new TDSLFSRecord(); //--- Get LFS_MASTER_AREA row daLFSMasterArea.SelectCommand.CommandText = @"SELECT ID, COMPANY_ID, RecordID, ClientID, COMPANIES_ID, SubArea, Street, USMH, DSMH, Size_, ScaledLength, P1Date, ActualLength, LiveLats, CXIsRemoved, M1Date, M2Date, InstallDate, FinalVideo, Comments, IssueIdentified, IssueResolved, FullLengthLining, SubcontractorLining, OutOfScopeInArea, IssueGivenToBayCity, ConfirmedSize, InstallRate, DeadlineDate, ProposedLiningDate, SalesIssue, LFSIssue, ClientIssue, InvestigationIssue, PointLining, Grouting, LateralLining, VacExDate, PusherDate, LinerOrdered, Restoration, GroutDate, JLiner, RehabAssessment, EstimatedJoints, JointsTestSealed, PreFlushDate, PreVideoDate, USMHMN, DSMHMN, USMHDepth, DSMHDepth, MeasurementsTakenBy, SteelTapeThruPipe, USMHAtMouth1200, USMHAtMouth100, USMHAtMouth200, USMHAtMouth300, USMHAtMouth400, USMHAtMouth500, DSMHAtMouth1200, DSMHAtMouth100, DSMHAtMouth200, DSMHAtMouth300, DSMHAtMouth400, DSMHAtMouth500, HydrantAddress, DistanceToInversionMH, RampsRequired, DegreeOfTrafficControl, StandarBypass, HydroWireDetails, PipeMaterialType, CappedLaterals, RoboticPrepRequired, PipeSizeChange, M1Comments, VideoDoneFrom, ToManhole, CutterDescriptionDuringMeasuring, FullLengthPointLiner, BypassRequired, RoboticDistances, TrafficControlDetails, LineWithID, SchoolZone, RestaurantArea, CarwashLaundromat, HydroPulley, FridgeCart, TwoInchPump, SixInchBypass, Scaffolding, WinchExtension, ExtraGenerator, GreyCableExtension, EasementMats, MeasurementType, DropPipe, DropPipeInvertDepth, Deleted, MeasuredFromManhole, MainLined, BenchingIssue, Archived, ScaledLength1, History, NumLats, NotLinedYet, AllMeasured, City, ProvState FROM LFS_MASTER_AREA WHERE (ID = @id) AND (COMPANY_ID = @companyId)"; daLFSMasterArea.SelectCommand.Parameters.Clear(); daLFSMasterArea.SelectCommand.Parameters.Add(new SqlParameter("@id", id)); daLFSMasterArea.SelectCommand.Parameters.Add(new SqlParameter("@companyId", companyId)); daLFSMasterArea.Fill(dataSet, "LFS_MASTER_AREA"); //--- Get LFS_POINT_REPAIRS rows daLFSPointRepairs.SelectCommand.CommandText = @"SELECT LFS_POINT_REPAIRS.ID, LFS_POINT_REPAIRS.RefID, LFS_POINT_REPAIRS.COMPANY_ID, LFS_POINT_REPAIRS.DetailID, LFS_POINT_REPAIRS.RepairSize, LFS_POINT_REPAIRS.InstallDate, LFS_POINT_REPAIRS.Distance, LFS_POINT_REPAIRS.Cost, LFS_POINT_REPAIRS.Reinstates, LFS_POINT_REPAIRS.LTAtMH, LFS_POINT_REPAIRS.VTAtMH, LFS_POINT_REPAIRS.LinerDistance, LFS_POINT_REPAIRS.Direction, LFS_POINT_REPAIRS.MHShot, LFS_POINT_REPAIRS.Comments, LFS_POINT_REPAIRS.Deleted, LFS_POINT_REPAIRS.ExtraRepair, LFS_POINT_REPAIRS.Cancelled, LFS_POINT_REPAIRS.Approved, LFS_POINT_REPAIRS.NotApproved, LFS_POINT_REPAIRS.Archived FROM LFS_MASTER_AREA INNER JOIN LFS_POINT_REPAIRS ON (LFS_MASTER_AREA.ID = LFS_POINT_REPAIRS.ID) AND (LFS_MASTER_AREA.COMPANY_ID = LFS_POINT_REPAIRS.COMPANY_ID) WHERE (LFS_MASTER_AREA.ID = @id) AND (LFS_MASTER_AREA.COMPANY_ID = @companyId)"; daLFSPointRepairs.SelectCommand.Parameters.Clear(); daLFSPointRepairs.SelectCommand.Parameters.Add(new SqlParameter("@id", id)); daLFSPointRepairs.SelectCommand.Parameters.Add(new SqlParameter("@companyId", companyId)); daLFSPointRepairs.Fill(dataSet, "LFS_POINT_REPAIRS"); //--- Get LFS_M2_TABLES rows daLFSM2Tables.SelectCommand.CommandText = @"SELECT LFS_M2_TABLES.ID, LFS_M2_TABLES.RefID, LFS_M2_TABLES.COMPANY_ID, LFS_M2_TABLES.VideoDistance, LFS_M2_TABLES.ClockPosition, LFS_M2_TABLES.LiveOrAbandoned, LFS_M2_TABLES.DistanceToCentreOfLateral, LFS_M2_TABLES.LateralDiameter, LFS_M2_TABLES.LateralType, LFS_M2_TABLES.DateTimeOpened, LFS_M2_TABLES.Comments, LFS_M2_TABLES.ReverseSetup, LFS_M2_TABLES.Deleted, LFS_M2_TABLES.Archived FROM LFS_MASTER_AREA INNER JOIN LFS_M2_TABLES ON (LFS_MASTER_AREA.ID = LFS_M2_TABLES.ID) AND (LFS_MASTER_AREA.COMPANY_ID = LFS_M2_TABLES.COMPANY_ID) WHERE (LFS_MASTER_AREA.ID = @id) AND (LFS_MASTER_AREA.COMPANY_ID = @companyId)"; daLFSM2Tables.SelectCommand.Parameters.Clear(); daLFSM2Tables.SelectCommand.Parameters.Add(new SqlParameter("@id", id)); daLFSM2Tables.SelectCommand.Parameters.Add(new SqlParameter("@companyId", companyId)); daLFSM2Tables.Fill(dataSet, "LFS_M2_TABLES"); //--- Get LFS_JUNCTION_LINER rows daLFSJunctionLiner.SelectCommand.CommandText = @"SELECT LFS_JUNCTION_LINER.ID, LFS_JUNCTION_LINER.RefID, LFS_JUNCTION_LINER.COMPANY_ID, LFS_JUNCTION_LINER.DetailID, LFS_JUNCTION_LINER.MN, LFS_JUNCTION_LINER.DistanceFromUSMH, LFS_JUNCTION_LINER.ConfirmedLatSize, LFS_JUNCTION_LINER.LateralMaterial, LFS_JUNCTION_LINER.SharedLateral, LFS_JUNCTION_LINER.CleanoutRequired, LFS_JUNCTION_LINER.PitRequired, LFS_JUNCTION_LINER.MHShot, LFS_JUNCTION_LINER.MainConnection, LFS_JUNCTION_LINER.Transition, LFS_JUNCTION_LINER.CleanoutInstalled, LFS_JUNCTION_LINER.PitInstalled, LFS_JUNCTION_LINER.CleanoutGrouted, LFS_JUNCTION_LINER.CleanoutCored, LFS_JUNCTION_LINER.PrepCompleted, LFS_JUNCTION_LINER.MeasuredLatLength, LFS_JUNCTION_LINER.MeasurementsTakenBy, LFS_JUNCTION_LINER.LinerInstalled, LFS_JUNCTION_LINER.FinalVideo, LFS_JUNCTION_LINER.RestorationComplete, LFS_JUNCTION_LINER.LinerOrdered, LFS_JUNCTION_LINER.LinerInStock, LFS_JUNCTION_LINER.LinerPrice, LFS_JUNCTION_LINER.Comments, LFS_JUNCTION_LINER.Deleted, LFS_JUNCTION_LINER.Archived FROM LFS_MASTER_AREA INNER JOIN LFS_JUNCTION_LINER ON (LFS_MASTER_AREA.ID = LFS_JUNCTION_LINER.ID) AND (LFS_MASTER_AREA.COMPANY_ID = LFS_JUNCTION_LINER.COMPANY_ID) WHERE (LFS_MASTER_AREA.ID = @id) AND (LFS_MASTER_AREA.COMPANY_ID = @companyId)"; daLFSJunctionLiner.SelectCommand.Parameters.Clear(); daLFSJunctionLiner.SelectCommand.Parameters.Add(new SqlParameter("@id", id)); daLFSJunctionLiner.SelectCommand.Parameters.Add(new SqlParameter("@companyId", companyId)); daLFSJunctionLiner.Fill(dataSet, "LFS_JUNCTION_LINER"); //--- Get LFS_JUNCTION_LINER2 rows daLFSJunctionLiner2.SelectCommand.CommandText = @"SELECT LFS_JUNCTION_LINER2.ID, LFS_JUNCTION_LINER2.RefID, LFS_JUNCTION_LINER2.COMPANY_ID, LFS_JUNCTION_LINER2.DetailID, LFS_JUNCTION_LINER2.Address, LFS_JUNCTION_LINER2.DistanceFromUSMH, LFS_JUNCTION_LINER2.DistanceFromDSMH, LFS_JUNCTION_LINER2.PipeLocated, LFS_JUNCTION_LINER2.ServicesLocated, LFS_JUNCTION_LINER2.CoInstalled, LFS_JUNCTION_LINER2.BackfilledConcrete, LFS_JUNCTION_LINER2.BackfilledSoil, LFS_JUNCTION_LINER2.Grouted, LFS_JUNCTION_LINER2.Cored, LFS_JUNCTION_LINER2.Prepped, LFS_JUNCTION_LINER2.Measured, LFS_JUNCTION_LINER2.LinerSize, LFS_JUNCTION_LINER2.PreVideo, LFS_JUNCTION_LINER2.FinalVideo, LFS_JUNCTION_LINER2.LinerInstalled, LFS_JUNCTION_LINER2.Map, LFS_JUNCTION_LINER2.Deleted FROM LFS_MASTER_AREA INNER JOIN LFS_JUNCTION_LINER2 ON (LFS_MASTER_AREA.ID = LFS_JUNCTION_LINER2.ID) AND (LFS_MASTER_AREA.COMPANY_ID = LFS_JUNCTION_LINER2.COMPANY_ID) WHERE (LFS_MASTER_AREA.ID = @id) AND (LFS_MASTER_AREA.COMPANY_ID = @companyId) AND (LFS_JUNCTION_LINER2.Deleted = 0)"; daLFSJunctionLiner2.SelectCommand.Parameters.Clear(); daLFSJunctionLiner2.SelectCommand.Parameters.Add(new SqlParameter("@id", id)); daLFSJunctionLiner2.SelectCommand.Parameters.Add(new SqlParameter("@companyId", companyId)); daLFSJunctionLiner2.Fill(dataSet, "LFS_JUNCTION_LINER2"); //--- Return TDSLFSRecord return dataSet; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tdsLfsRecord = new TDSLFSRecord(); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).BeginInit(); this.cvActualLength.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.cvActualLength_ServerValidate); this.cvProposedLiningDate.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvDeadlineDate.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvP1Date.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvM1Date.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvM2Date.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvInstallDate.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); this.cvFinalVideo.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.Date_ServerValidate); // // tdsLfsRecord // this.tdsLfsRecord.DataSetName = "TDSLFSRecord"; this.tdsLfsRecord.Locale = new System.Globalization.CultureInfo("en-US"); this.cvScaledLength.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(this.cvScaledLength_ServerValidate); ((System.ComponentModel.ISupportInitialize)(this.tdsLfsRecord)).EndInit(); }
/////////////////////////////////////////////////////////////////////////// /// METHODS /// // // ProcessBulkUpload // private bool ProcessBulkUpload(string fName, out string bulkUploadResultMessage) { //--- Initialize bool bulkUploadProccessed = true; bulkUploadResultMessage = ""; TDSLFSRecord tdsLfsRecord = new TDSLFSRecord(); // holds the current record being uploaded TDSLFSRecord tdsLfsRecord2 = new TDSLFSRecord(); // holds all the records uploaded so far CompaniesGateway companiesGateway = new CompaniesGateway(); LFSMasterAreaGateway lfsMasterAreaGateway = new LFSMasterAreaGateway(); AppSettingsReader appSettingReader = new AppSettingsReader(); string excelConnectionString = appSettingReader.GetValue("ExcelConnectionString", typeof(System.String)).ToString() + fName + ";"; OleDbConnection connection = new OleDbConnection(excelConnectionString); OleDbConnection connection2 = new OleDbConnection(excelConnectionString); OleDbCommand command = null; OleDbCommand command2 = null; OleDbDataReader dataReader = null; OleDbDataReader dataReader2 = null; try { //--- Preliminar validation of lfs_master_area data range #region Preliminar validation of lfs_master_area data range ArrayList validatedRecordIds = new ArrayList(); try { connection.Open(); command = new OleDbCommand("select * from [lfs_master_area]", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { if (!IsEmptyRow(dataReader)) { string recordId = dataReader.GetValue(dataReader.GetOrdinal("ID")).ToString().ToUpper().Trim(); if ( (recordId != "NULL") && (recordId != "") ) { //--- ... validate whether the ID is unique foreach (string tempRecordId in validatedRecordIds) { if (tempRecordId == recordId) { bulkUploadResultMessage = "The ID '" + recordId + "' is not unique within the lfs_master_area data range. Bulk upload ABORTED."; bulkUploadProccessed = false; break; } } //--- ... validate whether the ID is not already in use in the database if (bulkUploadProccessed) { if (lfsMasterAreaGateway.IsRecordIdInUse(recordId, Convert.ToInt32(Session["companyID"]))) { bulkUploadResultMessage = "'" + recordId + "' is already in the database. Bulk upload ABORTED."; bulkUploadProccessed = false; } else { validatedRecordIds.Add(recordId); } } } else { bulkUploadResultMessage = "Do not enter NULL in 'ID' column (lfs_master_area data range). Bulk upload ABORTED."; bulkUploadProccessed = false; } if (!bulkUploadProccessed) { break; } } } dataReader.Close(); connection.Close(); } catch(Exception ex) { bulkUploadResultMessage = "You did not define the 'lfs_master_area' data range. Bulk upload ABORTED. Original message: " + ex.Message; bulkUploadProccessed = false; if (connection.State == ConnectionState.Open) { connection.Close(); } } #endregion //--- Preliminar validation of lfs_point_repairs data range #region Preliminar validation of lfs_point_repairs data range if (bulkUploadProccessed && cbxUploadLfsPointRepairs.Checked) { try { connection.Open(); command = new OleDbCommand("select * from [lfs_point_repairs]", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { if (!IsEmptyRow(dataReader)) { string recordId = dataReader.GetValue(dataReader.GetOrdinal("ID")).ToString().ToUpper().Trim(); if ( (recordId != "NULL") && (recordId != "") ) { //--- ... validate whether the ID is defined in the lfs_master_area data range bool found = false; foreach (string tempRecordId in validatedRecordIds) { if (tempRecordId == recordId) { found = true; break; } } if (!found) { bulkUploadResultMessage = "The ID '" + recordId + "' defined in lfs_point_repairs data range does not have a corresponding ID defined in lfs_master_area data range. Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { bulkUploadResultMessage = "Do not enter NULL in 'ID' column (lfs_point_repairs data range). Bulk upload ABORTED."; bulkUploadProccessed = false; } if (!bulkUploadProccessed) { break; } } } dataReader.Close(); connection.Close(); } catch(Exception ex) { bulkUploadResultMessage = "You did not define the 'lfs_point_repairs' data range. Bulk upload ABORTED. Original message: " + ex.Message; bulkUploadProccessed = false; if (connection.State == ConnectionState.Open) { connection.Close(); } } } #endregion //--- Preliminar validation of lfs_junction_liner data range #region Preliminar validation of lfs_junction_liner data range if (bulkUploadProccessed && cbxUploadLfsJunctionLiner.Checked) { try { connection.Open(); command = new OleDbCommand("select * from [lfs_junction_liner]", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { if (!IsEmptyRow(dataReader)) { string recordId = dataReader.GetValue(dataReader.GetOrdinal("ID")).ToString().ToUpper().Trim(); if ( (recordId != "NULL") && (recordId != "") ) { //--- ... validate whether the ID is defined in the lfs_master_area data range bool found = false; foreach (string tempRecordId in validatedRecordIds) { if (tempRecordId == recordId) { found = true; break; } } if (!found) { bulkUploadResultMessage = "The ID '" + recordId + "' defined in lfs_junction_liner data range does not have a corresponding ID defined in lfs_master_area data range. Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { bulkUploadResultMessage = "Do not enter NULL in 'ID' column (lfs_junction_liner data range). Bulk upload ABORTED."; bulkUploadProccessed = false; } if (!bulkUploadProccessed) { break; } } } dataReader.Close(); connection.Close(); } catch(Exception ex) { bulkUploadResultMessage = "You did not define the 'lfs_junction_liner' data range. Bulk upload ABORTED. Original message: " + ex.Message; bulkUploadProccessed = false; if (connection.State == ConnectionState.Open) { connection.Close(); } } } #endregion //--- Process bulk upload if (bulkUploadProccessed) { connection.Open(); command = new OleDbCommand("select * from [lfs_master_area]", connection); dataReader = command.ExecuteReader(); while (dataReader.Read()) { if (!IsEmptyRow(dataReader)) { //--- ... fill lfs master area row string recordId = dataReader.GetValue(dataReader.GetOrdinal("ID")).ToString().Trim(); TDSLFSRecord.LFS_MASTER_AREARow lfsMasterAreaRow = tdsLfsRecord.LFS_MASTER_AREA.NewLFS_MASTER_AREARow(); #region fill lfsMasterAreaRow lfsMasterAreaRow.ID = lfsMasterAreaGateway.GetNewId(); lfsMasterAreaRow.COMPANY_ID = Convert.ToInt32(Session["companyID"]); lfsMasterAreaRow.RecordID = recordId; lfsMasterAreaRow.IssueIdentified = false; lfsMasterAreaRow.IssueResolved = false; lfsMasterAreaRow.FullLengthLining = false; lfsMasterAreaRow.SubcontractorLining = false; lfsMasterAreaRow.OutOfScopeInArea = false; lfsMasterAreaRow.IssueGivenToBayCity = false; lfsMasterAreaRow.SalesIssue = false; lfsMasterAreaRow.LFSIssue = false; lfsMasterAreaRow.ClientIssue = false; lfsMasterAreaRow.InvestigationIssue = false; lfsMasterAreaRow.PointLining = false; lfsMasterAreaRow.Grouting = false; lfsMasterAreaRow.LateralLining = false; lfsMasterAreaRow.JLiner = false; lfsMasterAreaRow.RehabAssessment = false; lfsMasterAreaRow.RampsRequired = false; lfsMasterAreaRow.StandarBypass = false; lfsMasterAreaRow.RoboticPrepRequired = false; lfsMasterAreaRow.PipeSizeChange = false; lfsMasterAreaRow.FullLengthPointLiner = false; lfsMasterAreaRow.BypassRequired = false; /// lfsMasterAreaRow.SchoolZone = false; lfsMasterAreaRow.RestaurantArea = false; lfsMasterAreaRow.CarwashLaundromat = false; lfsMasterAreaRow.HydroPulley = false; lfsMasterAreaRow.FridgeCart = false; lfsMasterAreaRow.TwoInchPump = false; lfsMasterAreaRow.SixInchBypass = false; lfsMasterAreaRow.Scaffolding = false; lfsMasterAreaRow.WinchExtension = false; lfsMasterAreaRow.ExtraGenerator = false; lfsMasterAreaRow.GreyCableExtension = false; lfsMasterAreaRow.EasementMats = false; lfsMasterAreaRow.DropPipe = false; lfsMasterAreaRow.AllMeasured = false; lfsMasterAreaRow.Deleted = false; lfsMasterAreaRow.Archived = false; string dataCell = null; string dataCellToUpper = null; string actualLength = null; string steelTapeThruPipe = null; for (int i=0; i < dataReader.FieldCount; i++) { dataCell = dataReader.GetValue(i).ToString().Trim(); dataCellToUpper = dataReader.GetValue(i).ToString().Trim().ToUpper(); switch (dataReader.GetName(i).Trim()) { case "ID": break; case "ClientID": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.ClientID = dataCell; } else { lfsMasterAreaRow.SetClientIDNull(); } break; case "Client": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.COMPANIES_ID = companiesGateway.GetCOMPANIES_ID(Convert.ToInt32(Session["companyID"]), dataCell); if (lfsMasterAreaRow.COMPANIES_ID == Int32.MinValue) { bulkUploadResultMessage = "Client '" + dataReader.GetValue(i).ToString() + "' was not found in the database (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { bulkUploadResultMessage = "Do not enter NULL in 'Client' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "SubArea": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.SubArea = dataCell; } else { lfsMasterAreaRow.SetSubAreaNull(); } break; case "Street": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.Street = dataCell; } else { lfsMasterAreaRow.SetStreetNull(); } break; case "USMH": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.USMH = dataCell; } else { lfsMasterAreaRow.SetUSMHNull(); } break; case "DSMH": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DSMH = dataCell; } else { lfsMasterAreaRow.SetDSMHNull(); } break; case "Size": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.Size_ = dataCell; } else { lfsMasterAreaRow.SetSize_Null(); } break; case "ScaledLength": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.ScaledLength = dataCell; lfsMasterAreaRow.ScaledLength1 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'ScaledLength' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetScaledLengthNull(); lfsMasterAreaRow.SetScaledLength1Null(); } break; case "P1Date": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.P1Date = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'P1Date' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetP1DateNull(); } break; case "ActualLength": if (dataCellToUpper != "NULL") { if (Distance.IsValidDistance(dataCell)) { if (steelTapeThruPipe == null || steelTapeThruPipe == dataCell) { lfsMasterAreaRow.ActualLength = dataCell; lfsMasterAreaRow.SteelTapeThruPipe = dataCell; actualLength = dataCell; } else { bulkUploadResultMessage = "'ActualLength' value is not equal to 'SteelTapeThruPipe' value (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { bulkUploadResultMessage = "Invalid value in 'ActualLength' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { if (steelTapeThruPipe == null || steelTapeThruPipe == "") { lfsMasterAreaRow.SetActualLengthNull(); lfsMasterAreaRow.SetSteelTapeThruPipeNull(); actualLength = ""; } else { bulkUploadResultMessage = "'ActualLength' value is not equal to 'SteelTapeThruPipe' value (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } break; case "LiveLats": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.LiveLats = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'LiveLats' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetLiveLatsNull(); } break; case "CXIsRemoved": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.CXIsRemoved = dataCell; } else { lfsMasterAreaRow.SetCXIsRemovedNull(); } break; case "M1Date": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.M1Date = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'M1Date' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetM1DateNull(); } break; case "M2Date": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.M2Date = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'M2Date' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetM2DateNull(); } break; case "InstallDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.InstallDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'InstallDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetInstallDateNull(); } break; case "FinalVideo": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.FinalVideo = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'FinalVideo' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetFinalVideoNull(); } break; case "Comments": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.Comments = dataCell; } else { lfsMasterAreaRow.SetCommentsNull(); } break; case "IssueIdentified": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.IssueIdentified = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'IssueIdentified' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "IssueResolved": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.IssueResolved = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'IssueResolved' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "FullLengthLining": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.FullLengthLining = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'FullLengthLining' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "SubcontractorLining": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.SubcontractorLining = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'SubcontractorLining' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "OutOfScopeInArea": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.OutOfScopeInArea = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'OutOfScopeInArea' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "IssueGivenToBayCity": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.IssueGivenToBayCity = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'IssueGivenToBayCity' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "ConfirmedSize": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.ConfirmedSize = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'ConfirmedSize' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetConfirmedSizeNull(); } break; case "InstallRate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDecimal(dataCell)) { lfsMasterAreaRow.InstallRate = Decimal.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'InstallRate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetInstallRateNull(); } break; case "DeadlineDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.DeadlineDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DeadlineDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDeadlineDateNull(); } break; case "ProposedLiningDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.ProposedLiningDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'ProposedLiningDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetProposedLiningDateNull(); } break; case "SalesIssue": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.SalesIssue = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'SalesIssue' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "LFSIssue": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.LFSIssue = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'LFSIssue' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "ClientIssue": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.ClientIssue = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'ClientIssue' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "InvestigationIssue": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.InvestigationIssue = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'InvestigationIssue' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "PointLining": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.PointLining = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'PointLining' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "Grouting": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.Grouting = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'Grouting' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "LateralLining": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.LateralLining = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'LateralLining' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "VacExDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.VacExDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'VacExDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetVacExDateNull(); } break; case "PusherDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.PusherDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'PusherDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetPusherDateNull(); } break; case "LinerOrdered": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.LinerOrdered = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'LinerOrdered' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetLinerOrderedNull(); } break; case "Restoration": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.Restoration = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'Restoration' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetRestorationNull(); } break; case "GroutDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.GroutDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'GroutDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetGroutDateNull(); } break; case "JLiner": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.JLiner = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'JLiner' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "RehabAssessment": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.RehabAssessment = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'RehabAssessment' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "EstimatedJoints": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.EstimatedJoints = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'EstimatedJoints' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetEstimatedJointsNull(); } break; case "JointsTestSealed": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.JointsTestSealed = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'JointsTestSealed' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetJointsTestSealedNull(); } break; case "PreFlushDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.PreFlushDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'PreFlushDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetPreFlushDateNull(); } break; case "PreVideoDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsMasterAreaRow.PreVideoDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'PreVideoDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetPreVideoDateNull(); } break; case "USMHMN": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.USMHMN = dataCell; } else { lfsMasterAreaRow.SetUSMHMNNull(); } break; case "DSMHMN": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DSMHMN = dataCell; } else { lfsMasterAreaRow.SetDSMHMNNull(); } break; case "USMHDepth": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.USMHDepth = dataCell; } else { lfsMasterAreaRow.SetUSMHDepthNull(); } break; case "DSMHDepth": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DSMHDepth = dataCell; } else { lfsMasterAreaRow.SetDSMHDepthNull(); } break; case "MeasurementsTakenBy": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.MeasurementsTakenBy = dataCell; } else { lfsMasterAreaRow.SetMeasurementsTakenByNull(); } break; case "SteelTapeThruPipe": if (dataCellToUpper != "NULL") { if (Distance.IsValidDistance(dataCell)) { if (actualLength == null || actualLength == dataCell) { lfsMasterAreaRow.SteelTapeThruPipe = dataCell; lfsMasterAreaRow.ActualLength = dataCell; // SYNCHRONIZED steelTapeThruPipe = dataCell; } else { bulkUploadResultMessage = "'SteelTapeThruPipe' value is not equal to 'ActualLength' value (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { bulkUploadResultMessage = "Invalid value in 'SteelTapeThruPipe' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { if (actualLength == null || actualLength == "") { lfsMasterAreaRow.SetSteelTapeThruPipeNull(); lfsMasterAreaRow.SetActualLengthNull(); // SYNCHRONIZED steelTapeThruPipe = ""; } else { bulkUploadResultMessage = "'SteelTapeThruPipe' value is not equal to 'ActualLength' value (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } break; case "USMHAtMouth1200": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth1200 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth1200' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth1200Null(); } break; case "USMHAtMouth100": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth100 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth100' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth100Null(); } break; case "USMHAtMouth200": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth200 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth200' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth200Null(); } break; case "USMHAtMouth300": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth300 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth300' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth300Null(); } break; case "USMHAtMouth400": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth400 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth400' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth400Null(); } break; case "USMHAtMouth500": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.USMHAtMouth500 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'USMHAtMouth500' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetUSMHAtMouth500Null(); } break; case "DSMHAtMouth1200": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth1200 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth1200' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth1200Null(); } break; case "DSMHAtMouth100": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth100 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth100' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth100Null(); } break; case "DSMHAtMouth200": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth200 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth200' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth200Null(); } break; case "DSMHAtMouth300": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth300 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth300' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth300Null(); } break; case "DSMHAtMouth400": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth400 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth400' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth400Null(); } break; case "DSMHAtMouth500": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsMasterAreaRow.DSMHAtMouth500 = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DSMHAtMouth500' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDSMHAtMouth500Null(); } break; case "HydrantAddress": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.HydrantAddress = dataCell; } else { lfsMasterAreaRow.SetHydrantAddressNull(); } break; case "DistanceToInversionMH": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DistanceToInversionMH = dataCell; } else { lfsMasterAreaRow.SetDistanceToInversionMHNull(); } break; case "RampsRequired": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.RampsRequired = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'RampsRequired' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "DegreeOfTrafficControl": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DegreeOfTrafficControl = dataCell; if ( (dataCell != "FLAGMEN REQUIRED") && (dataCell != "MAJOR ROAD") && (dataCell != "PERMIT REQUIRED") && (dataCell != "RESIDENTIAL")) { bulkUploadResultMessage = "Invalid value in 'DegreeOfTrafficControl' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetDegreeOfTrafficControlNull(); } break; case "StandarBypass": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.StandarBypass = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'StandarBypass' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "HydroWireDetails": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.HydroWireDetails = dataCell; } else { lfsMasterAreaRow.SetHydroWireDetailsNull(); } break; case "PipeMaterialType": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.PipeMaterialType = dataCell; } else { lfsMasterAreaRow.SetPipeMaterialTypeNull(); } break; case "CappedLaterals": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.CappedLaterals = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'CappedLaterals' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetCappedLateralsNull(); } break; case "RoboticPrepRequired": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.RoboticPrepRequired = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'RoboticPrepRequired' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "PipeSizeChange": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.PipeSizeChange = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'PipeSizeChange' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "M1Comments": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.M1Comments = dataCell; } else { lfsMasterAreaRow.SetM1CommentsNull(); } break; case "VideoDoneFrom": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.VideoDoneFrom = dataCell; } else { lfsMasterAreaRow.SetVideoDoneFromNull(); } break; case "ToManhole": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.ToManhole = dataCell; } else { lfsMasterAreaRow.SetToManholeNull(); } break; case "CutterDescriptionDuringMeasuring": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.CutterDescriptionDuringMeasuring = dataCell; } else { lfsMasterAreaRow.SetCutterDescriptionDuringMeasuringNull(); } break; case "FullLengthPointLiner": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.FullLengthPointLiner = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'FullLengthPointLiner' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "BypassRequired": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.BypassRequired = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'BypassRequired' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "RoboticDistances": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.RoboticDistances = dataCell; } else { lfsMasterAreaRow.SetRoboticDistancesNull(); } break; /// case "TrafficControlDetails": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.TrafficControlDetails = dataCell; } else { lfsMasterAreaRow.SetTrafficControlDetailsNull(); } break; case "LineWithID": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.LineWithID = dataCell; } else { lfsMasterAreaRow.SetLineWithIDNull(); } break; case "SchoolZone": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.SchoolZone = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'SchoolZone' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "RestaurantArea": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.RestaurantArea = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'RestaurantArea' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "CarwashLaundromat": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.CarwashLaundromat = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'CarwashLaundromat' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "HydroPulley": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.HydroPulley = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'HydroPulley' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "FridgeCart": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.FridgeCart = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'FridgeCart' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "TwoInchPump": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.TwoInchPump = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'TwoInchPump' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "SixInchBypass": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.SixInchBypass = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'SixInchBypass' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "Scaffolding": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.Scaffolding = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'Scaffolding' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "WinchExtension": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.WinchExtension = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'WinchExtension' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "ExtraGenerator": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.ExtraGenerator = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'ExtraGenerator' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "GreyCableExtension": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.GreyCableExtension = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'GreyCableExtension' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "EasementMats": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.EasementMats = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'EasementMats' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "MeasurementType": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.MeasurementType = dataCell; if ( (dataCell != "CAMERA") && (dataCell != "SIMULATOR")) { bulkUploadResultMessage = "Invalid value in 'MeasurementType' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetMeasurementTypeNull(); } break; case "DropPipe": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsMasterAreaRow.DropPipe = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'DropPipe' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "DropPipeInvertDepth": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.DropPipeInvertDepth = dataCell; } else { lfsMasterAreaRow.SetDropPipeInvertDepthNull(); } break; case "MeasuredFromManhole": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.MeasuredFromManhole = dataCell; } else { lfsMasterAreaRow.SetMeasuredFromManholeNull(); } break; case "MainLined": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.MainLined = dataCell; if ( (dataCellToUpper != "YES") && (dataCellToUpper != "NO")) { bulkUploadResultMessage = "Invalid value in 'MainLined' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetMainLinedNull(); } break; case "BenchingIssue": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.BenchingIssue = dataCell; if ( (dataCellToUpper != "YES") && (dataCellToUpper != "NO")) { bulkUploadResultMessage = "Invalid value in 'BenchingIssue' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.SetBenchingIssueNull(); } break; case "History": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.History = dataCell; } else { lfsMasterAreaRow.SetHistoryNull(); } break; case "NumLats": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.NumLats = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'NumLats' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.NumLats = 0; } break; case "NotLinedYet": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsMasterAreaRow.NotLinedYet = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'NotLinedYet' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsMasterAreaRow.NotLinedYet = 0; } break; case "AllMeasured": if ((dataCellToUpper == "YES") || (dataCellToUpper == "NO")) { lfsMasterAreaRow.AllMeasured = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'AllMeasured' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "City": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.City = dataCell; } else { lfsMasterAreaRow.SetCityNull(); } break; case "ProvState": if (dataCellToUpper != "NULL") { lfsMasterAreaRow.ProvState = dataCell; } else { lfsMasterAreaRow.SetProvStateNull(); } break; default: bulkUploadResultMessage = "Invalid column name '" + dataReader.GetName(i) + "' in lfs_master_area data range."; bulkUploadProccessed = false; break; } if (!bulkUploadProccessed) { break; } } #endregion tdsLfsRecord.LFS_MASTER_AREA.AddLFS_MASTER_AREARow(lfsMasterAreaRow); //--- ... fill lfs point repairs rows if (cbxUploadLfsPointRepairs.Checked) { connection2.Open(); command2 = new OleDbCommand("select * from [lfs_point_repairs] where ID = '" + recordId + "'", connection2); dataReader2 = command2.ExecuteReader(); while (dataReader2.Read()) { if (!IsEmptyRow(dataReader)) { TDSLFSRecord.LFS_POINT_REPAIRSRow lfsPointRepairsRow = tdsLfsRecord.LFS_POINT_REPAIRS.NewLFS_POINT_REPAIRSRow(); #region fill lfsPointRepairsRow lfsPointRepairsRow.ID = lfsMasterAreaRow.ID; lfsPointRepairsRow.RefID = Generator.GetNewLfsPointRepairsRefId(tdsLfsRecord); lfsPointRepairsRow.COMPANY_ID = Convert.ToInt32(Session["companyID"]); lfsPointRepairsRow.DetailID = Generator.GetNewLfsPointRepairsDetailId(tdsLfsRecord); lfsPointRepairsRow.Deleted = false; lfsPointRepairsRow.ExtraRepair = false; lfsPointRepairsRow.Cancelled = false; lfsPointRepairsRow.Approved = false; lfsPointRepairsRow.NotApproved = false; lfsPointRepairsRow.Archived = false; for (int i=0; i < dataReader2.FieldCount; i++) { dataCell = dataReader2.GetValue(i).ToString().Trim(); dataCellToUpper = dataReader2.GetValue(i).ToString().Trim().ToUpper(); switch (dataReader2.GetName(i).Trim()) { case "ID": break; case "RepairSize": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.RepairSize = dataCell; } else { lfsPointRepairsRow.SetRepairSizeNull(); } break; case "InstallDate": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsPointRepairsRow.InstallDate = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'InstallDate' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsPointRepairsRow.SetInstallDateNull(); } break; case "Distance": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.Distance = dataCell; } else { lfsPointRepairsRow.SetDistanceNull(); } break; case "Cost": if (dataCellToUpper != "NULL") { if (Validator.IsValidDecimal(dataCell)) { lfsPointRepairsRow.Cost = Decimal.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'Cost' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsPointRepairsRow.SetCostNull(); } break; case "Reinstates": if (dataCellToUpper != "NULL") { if (Validator.IsValidInt32(dataCell)) { lfsPointRepairsRow.Reinstates = Int32.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'Reinstates' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsPointRepairsRow.SetReinstatesNull(); } break; case "LTAtMH": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.LTAtMH = dataCell; } else { lfsPointRepairsRow.SetLTAtMHNull(); } break; case "VTAtMH": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.VTAtMH = dataCell; } else { lfsPointRepairsRow.SetVTAtMHNull(); } break; case "LinerDistance": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.LinerDistance = dataCell; } else { lfsPointRepairsRow.SetLinerDistanceNull(); } break; case "Direction": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.Direction = dataCell; if ( (dataCell != "DS PULL IN") && (dataCell != "DS PUSH IN") && (dataCell != "US PULL IN") && (dataCell != "US PUSH IN")) { bulkUploadResultMessage = "Invalid value in 'Direction' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsPointRepairsRow.SetDirectionNull(); } break; case "MHShot": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.MHShot = dataCell; if ( (dataCell != "DS MH SHOT") && (dataCell != "US MH SHOT")) { bulkUploadResultMessage = "Invalid value in 'MHShot' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsPointRepairsRow.SetMHShotNull(); } break; case "Comments": if (dataCellToUpper != "NULL") { lfsPointRepairsRow.Comments = dataCell; } else { lfsPointRepairsRow.SetCommentsNull(); } break; case "ExtraRepair": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsPointRepairsRow.ExtraRepair = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'ExtraRepair' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "Cancelled": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsPointRepairsRow.Cancelled = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'Cancelled' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "Approved": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsPointRepairsRow.Approved = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'Approved' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "NotApproved": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsPointRepairsRow.NotApproved = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'NotApproved' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; default: bulkUploadResultMessage = "Invalid column name '" + dataReader2.GetName(i) + "' in lfs_point_repairs data range."; bulkUploadProccessed = false; break; } if (!bulkUploadProccessed) { break; } } #endregion tdsLfsRecord.LFS_POINT_REPAIRS.AddLFS_POINT_REPAIRSRow(lfsPointRepairsRow); if (!bulkUploadProccessed) { break; } } } dataReader2.Close(); connection2.Close(); } //--- ... fill lfs junction liner rows if (cbxUploadLfsJunctionLiner.Checked) { connection2.Open(); command2 = new OleDbCommand("select * from [lfs_junction_liner] where ID = '" + recordId + "'", connection2); dataReader2 = command2.ExecuteReader(); while (dataReader2.Read()) { if (!IsEmptyRow(dataReader)) { TDSLFSRecord.LFS_JUNCTION_LINERRow lfsJunctionLinerRow = tdsLfsRecord.LFS_JUNCTION_LINER.NewLFS_JUNCTION_LINERRow(); #region fill lfsJunctionLinerRow lfsJunctionLinerRow.ID = lfsMasterAreaRow.ID; lfsJunctionLinerRow.RefID = Generator.GetNewLfsJunctionLinerRefId(tdsLfsRecord); lfsJunctionLinerRow.COMPANY_ID = Convert.ToInt32(Session["companyID"]); lfsJunctionLinerRow.DetailID = Generator.GetNewLfsJunctionLinerDetailId(tdsLfsRecord); lfsJunctionLinerRow.CleanoutRequired = false; lfsJunctionLinerRow.PitRequired = false; lfsJunctionLinerRow.MHShot = false; lfsJunctionLinerRow.CleanoutInstalled = false; lfsJunctionLinerRow.PitInstalled = false; lfsJunctionLinerRow.CleanoutGrouted = false; lfsJunctionLinerRow.CleanoutCored = false; lfsJunctionLinerRow.RestorationComplete = false; lfsJunctionLinerRow.LinerOrdered = false; lfsJunctionLinerRow.LinerInStock = false; lfsJunctionLinerRow.Deleted = false; lfsJunctionLinerRow.Archived = false; for (int i=0; i < dataReader2.FieldCount; i++) { dataCell = dataReader2.GetValue(i).ToString().Trim(); dataCellToUpper = dataReader2.GetValue(i).ToString().Trim().ToUpper(); switch (dataReader2.GetName(i).Trim()) { case "ID": break; case "MN": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.MN = dataCell; } else { lfsJunctionLinerRow.SetMNNull(); } break; case "DistanceFromUSMH": if (dataCellToUpper != "NULL") { if (Validator.IsValidDouble(dataCell)) { lfsJunctionLinerRow.DistanceFromUSMH = Double.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'DistanceFromUSMH' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetDistanceFromUSMHNull(); } break; case "ConfirmedLatSize": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.ConfirmedLatSize = dataCell; } else { lfsJunctionLinerRow.SetConfirmedLatSizeNull(); } break; case "LateralMaterial": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.LateralMaterial = dataCell; } else { lfsJunctionLinerRow.SetLateralMaterialNull(); } break; case "SharedLateral": if (dataCellToUpper != "NULL") { if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.SharedLateral = (dataCellToUpper == "YES") ? "Yes" : "No"; } else { bulkUploadResultMessage = "Invalid value in 'SharedLateral' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetSharedLateralNull(); } break; case "CleanoutRequired": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.CleanoutRequired = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'CleanoutRequired' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "PitRequired": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.PitRequired = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'PitRequired' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "MHShot": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.MHShot = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'MHShot' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "MainConnection": if (dataCellToUpper != "NULL") { if ( (dataCellToUpper == "TEE") || (dataCellToUpper == "WEE") ) { lfsJunctionLinerRow.MainConnection = (dataCellToUpper == "TEE") ? "Tee" : "Wee"; } else { bulkUploadResultMessage = "Invalid value in 'MainConnection' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetMainConnectionNull(); } break; case "Transition": if (dataCellToUpper != "NULL") { if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.Transition = (dataCellToUpper == "YES") ? "Yes" : "No"; } else { bulkUploadResultMessage = "Invalid value in 'Transition' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetTransitionNull(); } break; case "CleanoutInstalled": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.CleanoutInstalled = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'CleanoutInstalled' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "PitInstalled": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.PitInstalled = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'PitInstalled' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "CleanoutGrouted": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.CleanoutGrouted = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'CleanoutGrouted' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "CleanoutCored": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.CleanoutCored = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'CleanoutCored' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "PrepCompleted": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsJunctionLinerRow.PrepCompleted = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'PrepCompleted' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetPrepCompletedNull(); } break; case "MeasuredLatLength": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.MeasuredLatLength = dataCell; } else { lfsJunctionLinerRow.SetMeasuredLatLengthNull(); } break; case "MeasurementsTakenBy": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.MeasurementsTakenBy = dataCell; } else { lfsJunctionLinerRow.SetMeasurementsTakenByNull(); } break; case "LinerInstalled": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsJunctionLinerRow.LinerInstalled = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'LinerInstalled' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetLinerInstalledNull(); } break; case "FinalVideo": if (dataCellToUpper != "NULL") { if (Validator.IsValidDate(dataCell)) { lfsJunctionLinerRow.FinalVideo = DateTime.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'FinalVideo' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetFinalVideoNull(); } break; case "RestorationComplete": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.RestorationComplete = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'RestorationComplete' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "LinerOrdered": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.LinerOrdered = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'LinerOrdered' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "LinerInStock": if ( (dataCellToUpper == "YES") || (dataCellToUpper == "NO") ) { lfsJunctionLinerRow.LinerInStock = (dataCellToUpper == "YES") ? true : false; } else { bulkUploadResultMessage = "Invalid value in 'LinerInStock' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } break; case "LinerPrice": if (dataCellToUpper != "NULL") { if (Validator.IsValidDecimal(dataCell)) { lfsJunctionLinerRow.LinerPrice = Decimal.Parse(dataCell); } else { bulkUploadResultMessage = "Invalid value in 'LinerPrice' column (" + recordId + "). Bulk upload ABORTED."; bulkUploadProccessed = false; } } else { lfsJunctionLinerRow.SetLinerPriceNull(); } break; case "Comments": if (dataCellToUpper != "NULL") { lfsJunctionLinerRow.Comments = dataCell; } else { lfsJunctionLinerRow.SetCommentsNull(); } break; default: bulkUploadResultMessage = "Invalid column name '" + dataReader2.GetName(i) + "' in lfs_junction_liner data range."; bulkUploadProccessed = false; break; } if (!bulkUploadProccessed) { break; } } #endregion tdsLfsRecord.LFS_JUNCTION_LINER.AddLFS_JUNCTION_LINERRow(lfsJunctionLinerRow); if (!bulkUploadProccessed) { break; } } } dataReader2.Close(); connection2.Close(); } //--- ... caculate data for record change tracking tdsLfsRecord2.Merge(tdsLfsRecord); tdsLfsRecord.Clear(); if (!bulkUploadProccessed) { break; } } } dataReader.Close(); connection.Close(); //--- Insert bulk uploaded data in database if (bulkUploadProccessed) { //--- Update database LFSRecordGateway lfsRecordGateway = new LFSRecordGateway(); lfsRecordGateway.UpdateRecord(tdsLfsRecord2); } } } catch(Exception ex) { if (!dataReader2.IsClosed) { dataReader2.Close(); } if (connection2.State == ConnectionState.Open) { connection2.Close(); } if (!dataReader.IsClosed) { dataReader.Close(); } if (connection.State == ConnectionState.Open) { connection.Close(); } throw ex; } return (bulkUploadProccessed) ? true : false; }