private void Load_Image() { string photoFilePath = Server.MapPath("../Image_Data/"); LWImage.DataBind(); MapPage.Visible = false; for (int i = 0; i < LWImage.Rows.Count; i++) { if (!File.Exists(photoFilePath + LWImage.DataKeys[i].Values[2].ToString() + "_" + LWImage.DataKeys[i].Values[1].ToString() + "." + LWImage.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", LWImage.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } MapPage.Visible = true; FileCoordimateDataSource.SelectParameters.Clear(); FileCoordimateDataSource.SelectParameters.Add("ID_files", LWImage.DataKeys[0].Values[1].ToString()); MapPage.ImageUrl = "~/Image_Data/" + LWImage.DataKeys[0].Values[2].ToString() + "_" + LWImage.DataKeys[0].Values[1].ToString() + "." + LWImage.DataKeys[0].Values[3].ToString(); } MapPage.HotSpots.Clear(); ImageChildren.DataBind(); ImgMapOne.HotSpots.Clear(); for (int i = 0; i < ImageChildren.Rows.Count; i++) { PolygonHotSpot Ph = new PolygonHotSpot(); Ph.AlternateText = ImageChildren.DataKeys[i].Values[3].ToString(); Ph.Coordinates = ImageChildren.DataKeys[i].Values[2].ToString(); MapPage.HotSpots.Add(Ph); } }
protected void DelCoordinate_Click(Object sender, EventArgs e) { ChangeMap.Visible = false; ImageFilesObjectDataSource.InsertMethod = "AddFileCoordinate"; ImageFilesObjectDataSource.InsertParameters.Clear(); ImageFilesObjectDataSource.InsertParameters.Add("Coordinate", Coordin.Text); ImageFilesObjectDataSource.InsertParameters.Add("ID_Files", TempGrid.DataKeys[0].Values[1].ToString()); ImageFilesObjectDataSource.InsertParameters.Add("AlternateText", MapText.Text.ToString()); ImageFilesObjectDataSource.InsertParameters.Add("ID_UrlTable", GridDevice.SelectedValue.ToString()); ImageFilesObjectDataSource.InsertParameters.Add("NameUrlTable", "Device"); ImageFilesObjectDataSource.Insert(); ImageChildren.DataBind(); ImgMapOne.HotSpots.Clear(); for (int i = 0; i < ImageChildren.Rows.Count; i++) { PolygonHotSpot Ph = new PolygonHotSpot(); Ph.AlternateText = ImageChildren.DataKeys[i].Values[3].ToString(); Ph.Coordinates = ImageChildren.DataKeys[i].Values[2].ToString(); ImgMapOne.HotSpots.Add(Ph); } Coordin.Text = ""; ChangeMap.Checked = false; ImgButOne.Visible = false; ImgMapOne.Visible = true; UnitMap.Visible = false; ModalImageMaping.Show(); }
protected void MapRelation_Click(object sender, EventArgs e) { string photoFilePath = Server.MapPath("../Image_Data/"); ObjectDataTempGrig.SelectParameters.Clear(); ObjectDataTempGrig.SelectParameters.Add("NameTable", "Building"); ObjectDataTempGrig.SelectParameters.Add("ID_Table", OtdelenGridView.DataKeys[OtdelenGridView.SelectedIndex].Values[1].ToString()); MapText.Text = OtdelenGridView.Rows[OtdelenGridView.SelectedIndex].Cells[2].Text; TempGrid.DataSourceID = "ObjectDataTempGrig"; TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType" }; TempGrid.Visible = false; TempGrid.DataBind(); for (int i = 0; i < TempGrid.Rows.Count; i++) { if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } ImgButOne.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); ImgMapOne.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); break; } ChangeMap.Visible = true; ModalImageMaping.Show(); }
protected void Page_Load(object sender, EventArgs e) { MapPage.Visible = true; TempGrid.DataSourceID = "ObjectDataTempGrig"; TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType", "MapMain" }; TempGrid.DataBind(); for (int i = 0; i < TempGrid.Rows.Count; i++) { FileCoordimateDataSource.SelectParameters.Clear(); FileCoordimateDataSource.SelectParameters.Add("ID_files", TempGrid.DataKeys[i].Values[1].ToString()); } string photoFilePath = Server.MapPath("../Image_Data/"); for (int i = 0; i < TempGrid.Rows.Count; i++) { if (TempGrid.DataKeys[i].Values[4].ToString() == "True") { if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } MapPage.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); break; } } //поле для HotSpotsGrid BoundField PageImageGrid = new BoundField(); PageImageGrid.HeaderText = "Связанные элементы"; PageImageGrid.DataField = "AlternateText"; PageImageGrid.Visible = true; // для заполения ссылок и их названий GridView HotSpotsGrid = new GridView(); HotSpotsGrid.DataSourceID = "FileCoordimateDataSource"; HotSpotsGrid.AutoGenerateColumns = false; HotSpotsGrid.DataKeyNames = new string[] { "ID", "ID_files", "Coordinate", "AlternateText", "ID_UrlTable" }; HotSpotsGrid.Columns.Add(PageImageGrid); HotSpotsGrid.Visible = false; HotSpotsGrid.Width = 40; DivRightPage.Controls.Add(HotSpotsGrid); HotSpotsGrid.DataBind(); for (int i = 0; i < HotSpotsGrid.Rows.Count; i++) { PolygonHotSpot Ph = new PolygonHotSpot(); Ph.AlternateText = HotSpotsGrid.DataKeys[i].Values[3].ToString(); Ph.Coordinates = HotSpotsGrid.DataKeys[i].Values[2].ToString(); Ph.PostBackValue = HotSpotsGrid.DataKeys[i].Values[4].ToString(); MapPage.HotSpots.Add(Ph); } }
protected void GridView_OnSelectedIndexChanged(object sender, EventArgs e) { RoomObjectDataSourceOneRow.SelectParameters["ID_Room"].DefaultValue = RoomGridView.SelectedValue.ToString(); UpdatePan.DataBind(); TextBox2.Text = UpdatePan.Rows[1].Cells[1].Text; TextBoxNum.Text = UpdatePan.Rows[2].Cells[1].Text; OtdelenList.SelectedValue = UpdatePan.Rows[3].Cells[1].Text; BuildingList.SelectedValue = UpdatePan.Rows[4].Cells[1].Text; RoomDeviceListDataSource.SelectMethod = "GetOneRecordTest"; RoomDeviceListDataSource.SelectParameters.Clear(); RoomDeviceListDataSource.SelectParameters.Add("ID_Room", RoomGridView.SelectedValue.ToString()); RoomDeviceListDataSource.SelectParameters.Add("ID_Unit", "0"); Load_Image(); ImageChecked.DataBind(); string photoFilePath = Server.MapPath("../Image_Data/"); for (int i = 0; i < CheckBoxImage.Items.Count; i++) { if (!File.Exists(photoFilePath + CheckBoxImage.DataKeys[i].Values[2].ToString() + "_" + CheckBoxImage.DataKeys[i].Values[1].ToString() + "." + CheckBoxImage.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", CheckBoxImage.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } } // начало рисунков к чекбоксу /* * try * { * foreach (ListItem item in CheckBoxImage1.Items) * { * item.Text = string.Format("<img width=20px src = \"{0}\" /> {1} , {2}", this.GetImageUrl(), item.Text, item.Value); * } * } * catch (Exception ex) * { * this.Msg.Text = ex.ToString(); * } */ // конец рисунков к чекбоксу ModalPopupExtender1.Show(); UpdateButton.Visible = true; InsertButton.Visible = false; DeleteButton.Visible = true; AddImge.Visible = true; }
protected void MapRelation_Click(object sender, EventArgs e) { string photoFilePath = Server.MapPath("../Image_Data/"); ObjectDataTempGrig.SelectParameters.Clear(); ObjectDataTempGrig.SelectParameters.Add("NameTable", "Device"); ObjectDataTempGrig.SelectParameters.Add("ID_Table", GridDevice.DataKeys[GridDevice.SelectedIndex].Values[1].ToString()); MapText.Text = GridDevice.Rows[GridDevice.SelectedIndex].Cells[2].Text; // GridView TempGrid = new GridView(); TempGrid.DataSourceID = "ObjectDataTempGrig"; TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType" }; // ImageMapingPanel.Controls.Add(TempGrid); TempGrid.Visible = false; TempGrid.DataBind(); for (int i = 0; i < TempGrid.Rows.Count; i++) { if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } ImgButOne.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); ImgMapOne.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); break; } ChangeMap.Visible = true; /* Image img = * Image.FromFile(Server.MapPath(ImgMapOne.ImageUrl)); * if (img.Height > img.Width) * { * ImageBM.Style.Add("height", "500px"); * } * else { ImageBM.Style.Add("height", "auto"); } */ ModalImageMaping.Show(); }
protected void Page_Load(object sender, EventArgs e) { Msg.Text = ""; Coordinats = new TextBox(); UpdateButton.Visible = false; InsertButton.Visible = true; DeleteButton.Visible = false; MapPage.Visible = true; if (!Page.IsPostBack) { string photoFilePath = Server.MapPath("../Image_Data/"); for (int j = 0; j < BuildingGridView.Rows.Count; j++) { if (BuildingGridView.DataKeys[j].Values[1].ToString() == "True") { ObjectDataTempGrig.SelectParameters.Clear(); ObjectDataTempGrig.SelectParameters.Add("NameTable", "Building"); ObjectDataTempGrig.SelectParameters.Add("ID_Table", BuildingGridView.DataKeys[j].Values[0].ToString()); break; } } TempGrid.DataSourceID = "ObjectDataTempGrig"; TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType", "MapMain" }; TempGrid.DataBind(); BoundField PageImageGrid = new BoundField(); PageImageGrid.HeaderText = "Связанные элементы"; PageImageGrid.DataField = "AlternateText"; PageImageGrid.Visible = false; GridView HotSpotsGrid = new GridView(); HotSpotsGrid.DataSourceID = "FileCoordimateDataSource"; HotSpotsGrid.AutoGenerateColumns = false; HotSpotsGrid.DataKeyNames = new string[] { "ID", "ID_files", "Coordinate", "AlternateText" }; HotSpotsGrid.Columns.Add(PageImageGrid); HotSpotsGrid.Width = 40; DivRightPage.Controls.Add(HotSpotsGrid); HotSpotsGrid.DataBind(); for (int i = 0; i < HotSpotsGrid.Rows.Count; i++) { PolygonHotSpot Ph = new PolygonHotSpot(); Ph.AlternateText = HotSpotsGrid.DataKeys[i].Values[3].ToString(); Ph.Coordinates = HotSpotsGrid.DataKeys[i].Values[2].ToString(); MapPage.HotSpots.Add(Ph); } for (int i = 0; i < TempGrid.Rows.Count; i++) { if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString())) { ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes"; ImageFilesObjectDataSource.SelectParameters.Clear(); ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString()); ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath); ImageFilesObjectDataSource.Select(); } MapPage.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString(); break; } } }