Exemplo n.º 1
0
        public FeatPropertyCollection(SiteUtilities siteUtilities, string layerName, string Filter)
        {
            mSiteUtilities = siteUtilities;
            mLayer = mSiteUtilities.Map.GetLayers().GetItem(layerName) as MgLayer;
            mPropertiesCollection = new Dictionary<string, FeatProperty>();
            GetPropertiesFields();
            GetAdditionalValues();
            FillValues(Filter);

            var sorted = from p in PropertiesCollection
                         orderby p.Value.Alias
                         select p;
            Dictionary<string, FeatProperty> SortedProperties = new Dictionary<string, FeatProperty>();
            foreach (var item in sorted)
            {
                SortedProperties.Add(item.Key, item.Value);
            }
            mPropertiesCollection = SortedProperties;
            mDataSet = GenerateDataSet();
        }
Exemplo n.º 2
0
        private void getSdfFile(SiteUtilities siteUtilities)
        {
            string featureSourceId = siteUtilities.Map.GetLayers().GetItem(ViewState["LayerName"].ToString()).FeatureSourceId;
            string fileName = string.Empty;
            XmlDocument doc = new XmlDocument();
            doc.Load(Server.MapPath("~/XML/SDF_Files.xml"));
            XmlNode node = doc.SelectSingleNode(string.Format("/root/FeatureSource[@ID=\"{0}\"]", featureSourceId));
            if (node != null)
            {
                fileName = node.Attributes["file"].InnerText;
                SdfEditorPanel.Visible = true;
            }

            ViewState.Add("SdfFile", fileName);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int mgProjectId;

                if (!IsPostBack)
                {

                    if (GetRequestParameters()["isedit"] == "1")
                    {
                        iseditmode = true;
                        ViewState.Add("isedit", GetRequestParameters()["isedit"]);

                    }
                    else
                    {
                        iseditmode = false;
                       // ViewState.Add("isedit", GetRequestParameters()["isedit"]);

                    }
                    // if (!int.TryParse(Request["mgProjectId"], out mgProjectId)) return;
                    //    ViewState.Add("mgProjectId", mgProjectId);
                    //    Session["mgSessionId"] = Request["SESSION"];
                    //    ViewState.Add("mgSessionId", Request["SESSION"]);
                   ;
                   if (!int.TryParse(GetRequestParameters()["mgProjectId"], out mgProjectId)) return;
                    ViewState.Add("mgProjectId", mgProjectId);
                    Session["mgSessionId"] = GetRequestParameters()["SESSION"];
                    ViewState.Add("mgSessionId", GetRequestParameters()["SESSION"]);
                }
                else
                {
                    if (Session["mgSessionId"] == null)
                    {
                        Session["mgSessionId"] = ViewState["mgSessionId"];
                    }
                    mgProjectId = (int)ViewState["mgProjectId"];
                }
                SiteUtilities siteUtilities = new SiteUtilities(new MapSettings(mgProjectId));
                if (!IsPostBack)
                {
                    MgLayer layer = (MgLayer)siteUtilities.Selection.GetLayers()[0];
                    string Filter = siteUtilities.Selection.GenerateFilter(layer, layer.FeatureClassName);
                    if (Filter == "")
                    {
                        Response.Write("האופציה הזו לא קיימת לפרית הזה.");
                        Response.End();
                    }
                    ViewState.Add("LayerName", layer.Name);
                    ViewState.Add("Filter", Filter);
                    getSdfFile(siteUtilities);
                }

                fpCollection = new FeatPropertyCollection(siteUtilities, ViewState["LayerName"].ToString(), ViewState["Filter"].ToString());
                if (ViewState["SdfFile"] != null)
                {
                    SdfFileName.Value = ViewState["SdfFile"].ToString();
                    fpCollection.FillLookUpValues(ViewState["SdfFile"].ToString());
                }

                _HeaderText.Text = fpCollection.LegendLabel;
                _FeatureCard.Fields.Clear();

                foreach (var p in fpCollection.PropertiesCollection)
                {
                    TemplateField myTemplate = new TemplateField();
                    editPropertyFieldTemplate f = new editPropertyFieldTemplate(p.Value, ViewState["SdfFile"].ToString());
                    viewPropertyFieldTemplate viewTmpl = new viewPropertyFieldTemplate(p.Value);
                    myTemplate.EditItemTemplate = f;
                    myTemplate.ItemTemplate = viewTmpl;
                    myTemplate.HeaderText = p.Value.Alias;
                    _FeatureCard.Fields.Add(myTemplate);
                }
                if (ViewState["isedit"] !=null)
                {

                TemplateField myFooterTemplate = new TemplateField();

                viewFooterTemplate viewFooter = new viewFooterTemplate();
                editFooterTemplate editFooter = new editFooterTemplate();
                myFooterTemplate.ItemTemplate = viewFooter;
                myFooterTemplate.EditItemTemplate = editFooter;
                myFooterTemplate.ShowHeader = false;
              //  myFooterTemplate.ItemStyle.BackColor = Color.FromArgb(255, 255, 192);
                _FeatureCard.Fields.Add(myFooterTemplate);
            }
                _FeatureCard.AutoGenerateRows = false;
                _FeatureCard.DataSource = fpCollection.FeatureDataSet;
                _FeatureCard.DataBind();
            }
            catch (InvalidOperationException ex)
            {
                ErrorLog log = new ErrorLog(ConfigurationManager.ConnectionStrings["ErrorLogConnectionString"].ConnectionString);
                log.AddError(ex);

            }
        }