コード例 #1
0
        protected void SaveSelectedAssetId()
        {
            int assetIdForUpdate = 0;
            bool selected = false;
            hdfSelectedAssetId.Value = "0";

            ProjectSectionsNavigator projectSectionsNavigatorForUpdate = new ProjectSectionsNavigator(projectSectionsNavigatorTDS);

            foreach (GridViewRow row in grdSectionsNavigator.Rows)
            {
                // ... Update all rows
                selected = ((CheckBox)row.FindControl("cbxSelected")).Checked;
                assetIdForUpdate = Int32.Parse(((Label)row.FindControl("lblAssetID")).Text.Trim());
                projectSectionsNavigatorForUpdate.Update(assetIdForUpdate, selected);

                // ... Save selected project
                if (selected)
                {
                    hdfSelectedAssetId.Value = assetIdForUpdate.ToString();
                }
            }
            projectSectionsNavigatorForUpdate.Data.AcceptChanges();

            // ... Store datasets
            Session["projectSectionsNavigator"] = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;
        }
コード例 #2
0
        private ProjectSectionsNavigatorTDS SubmitSearch()
        {
            // Retrive parameters
            string sectionID = tbxID.Text.Trim();
            string street = tbxStreet.Text.Trim();
            string usmh = tbxUSMH.Text.Trim();
            string dsmh = tbxDSMH.Text.Trim();

            // Load data
            ProjectSectionsNavigator projectSectionsNavigator = new ProjectSectionsNavigator();
            projectSectionsNavigator.LoadBySectionIDStreetUsmhDsmhCompanyIdProjectId(sectionID, street, usmh, dsmh, int.Parse(hdfCompanyId.Value), int.Parse(hdfProjectId.Value));

            return (ProjectSectionsNavigatorTDS)projectSectionsNavigator.Data;
        }
コード例 #3
0
        protected void DeleteSection()
        {
            SaveSelectedAssetId();
            int assetId = Int32.Parse(hdfSelectedAssetId.Value);
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int projectId = Int32.Parse(hdfProjectId.Value);

            DB.Open();
            DB.BeginTransaction();
            try
            {
                ProjectSectionsNavigator projectSectionsNavigator = new ProjectSectionsNavigator(projectSectionsNavigatorTDS);
                projectSectionsNavigator.Delete(projectId, assetId, companyId);

                DB.CommitTransaction();

                projectSectionsNavigatorTDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }

            // Redirect
            Response.Redirect("./project_sections_navigator2.aspx?source_page=project_sections_navigator2.aspx&project_id=" + hdfProjectId.Value + GetNavigatorState() + "&origin=" + (string)ViewState["origin"] + "&update=" + (string)ViewState["update"] + "&data_changed=" + hdfDataChanged.Value + "&state=" + (string)ViewState["state"] + "&update_section=yes&active_tab=" + (string)ViewState["active_tab"]);
        }