Esempio n. 1
0
        private void buttonZoom_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(t_gush_num.Text) &&
                !String.IsNullOrEmpty(t_parcel_num.Text))
            {
                IMapDocument  mxd    = CancelParcelEditor10_5.ArcMap.Application.Document as IMapDocument;
                IMap          map    = mxd.get_Map(0);
                IFeatureLayer flayer = AO.getLayerFromMxd(map, "חלקות להכנסה");

                string query = "GUSHNUM = " + Convert.ToInt32(t_gush_num.Text).ToString() +
                               " AND PARCEL_FINAL = " + Convert.ToInt32(t_parcel_num.Text).ToString();

                AO.ZoomToSelection(mxd, flayer, query);
            }
        }
Esempio n. 2
0
        private void insert_Click(object sender, EventArgs e)
        {
            IMapDocument mxd = CancelParcelEditor10_5.ArcMap.Application.Document as IMapDocument;
            IMap         map = mxd.get_Map(0);
            string       gdb = AO.getLayerPathFromMxd(map, "חלקות לעריכה");

            if (String.IsNullOrEmpty(gdb))
            {
                MessageBox.Show("שכבת חלקות לעריכה אינה קיימת במפה");
            }
            else
            {
                ITable table = AO.open_table(gdb, "CANCEL_PARCEL_EDIT");
                if (table != null)
                {
                    if (!String.IsNullOrEmpty(f_gush_num.Text) &&
                        !String.IsNullOrEmpty(f_parcel_num.Text) &&
                        !String.IsNullOrEmpty(t_gush_num.Text) &&
                        !String.IsNullOrEmpty(t_parcel_num.Text) &&
                        !String.IsNullOrEmpty(f_gush_suffix.Text) &&
                        !String.IsNullOrEmpty(t_gush_suffix.Text)
                        )
                    {
                        if (String.IsNullOrEmpty(f_parcel_num_e.Text) && String.IsNullOrEmpty(t_parcel_num_e.Text))
                        {
                            IRow row = table.CreateRow();
                            row.Value[row.Fields.FindField("F_GUSH_NUM")]    = Convert.ToInt32(f_gush_num.Text);
                            row.Value[row.Fields.FindField("F_PARCEL_NUM")]  = Convert.ToInt32(f_parcel_num.Text);
                            row.Value[row.Fields.FindField("T_GUSH_NUM")]    = Convert.ToInt32(t_gush_num.Text);
                            row.Value[row.Fields.FindField("T_PARCEL_NUM")]  = Convert.ToInt32(t_parcel_num.Text);
                            row.Value[row.Fields.FindField("F_GUSH_SUFFIX")] = Convert.ToInt32(f_gush_suffix.Text);
                            row.Value[row.Fields.FindField("T_GUSH_SUFFIX")] = Convert.ToInt32(t_gush_suffix.Text);
                            row.Store();
                            MessageBox.Show("רשומה נוספה");
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(f_parcel_num_e.Text) && String.IsNullOrEmpty(t_parcel_num_e.Text))
                            {
                                int f_parcel_end   = Convert.ToInt32(f_parcel_num_e.Text);
                                int f_parcel_start = Convert.ToInt32(f_parcel_num.Text);
                                while (f_parcel_start <= f_parcel_end)
                                {
                                    IRow row = table.CreateRow();
                                    row.Value[row.Fields.FindField("F_GUSH_NUM")]    = Convert.ToInt32(f_gush_num.Text);
                                    row.Value[row.Fields.FindField("F_PARCEL_NUM")]  = f_parcel_start;
                                    row.Value[row.Fields.FindField("T_GUSH_NUM")]    = Convert.ToInt32(t_gush_num.Text);
                                    row.Value[row.Fields.FindField("T_PARCEL_NUM")]  = Convert.ToInt32(t_parcel_num.Text);
                                    row.Value[row.Fields.FindField("F_GUSH_SUFFIX")] = Convert.ToInt32(f_gush_suffix.Text);
                                    row.Value[row.Fields.FindField("T_GUSH_SUFFIX")] = Convert.ToInt32(t_gush_suffix.Text);
                                    row.Store();
                                    f_parcel_start++;
                                }
                                MessageBox.Show("רשומות נוספו (איחוד)");
                            }
                            if (String.IsNullOrEmpty(f_parcel_num_e.Text) && !String.IsNullOrEmpty(t_parcel_num_e.Text))
                            {
                                int t_parcel_end   = Convert.ToInt32(t_parcel_num_e.Text);
                                int t_parcel_start = Convert.ToInt32(t_parcel_num.Text);
                                while (t_parcel_start <= t_parcel_end)
                                {
                                    IRow row = table.CreateRow();
                                    row.Value[row.Fields.FindField("F_GUSH_NUM")]    = Convert.ToInt32(f_gush_num.Text);
                                    row.Value[row.Fields.FindField("F_PARCEL_NUM")]  = Convert.ToInt32(f_parcel_num.Text);
                                    row.Value[row.Fields.FindField("T_GUSH_NUM")]    = Convert.ToInt32(t_gush_num.Text);
                                    row.Value[row.Fields.FindField("T_PARCEL_NUM")]  = t_parcel_start;
                                    row.Value[row.Fields.FindField("F_GUSH_SUFFIX")] = Convert.ToInt32(f_gush_suffix.Text);
                                    row.Value[row.Fields.FindField("T_GUSH_SUFFIX")] = Convert.ToInt32(t_gush_suffix.Text);
                                    row.Store();
                                    t_parcel_start++;
                                }
                                MessageBox.Show("רשומות נוספו (חלוקה)");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("נא למלא את כל השדות");
                    }
                }
                else
                {
                    MessageBox.Show("טבלת CANCEL_PARCEL_EDIT אינה קיימת ב gdb");
                }
            }
        }
Esempio n. 3
0
        private void cancel_Click(object sender, EventArgs e)
        {
            IMapDocument mxd = CancelParcelEditor10_5.ArcMap.Application.Document as IMapDocument;
            IMap         map = mxd.get_Map(0);
            string       gdb = AO.getLayerPathFromMxd(map, "חלקות לעריכה");

            if (String.IsNullOrEmpty(gdb))
            {
                MessageBox.Show("שכבת חלקות לעריכה אינה קיימת במפה");
            }
            else
            {
                ITable table = AO.open_table(gdb, "CANCEL_PARCEL_EDIT");
                if (table != null)
                {
                    if (!String.IsNullOrEmpty(f_gush_num.Text) &&
                        !String.IsNullOrEmpty(f_parcel_num.Text) &&
                        !String.IsNullOrEmpty(t_gush_num.Text) &&
                        !String.IsNullOrEmpty(t_parcel_num.Text) &&
                        !String.IsNullOrEmpty(f_gush_suffix.Text) &&
                        !String.IsNullOrEmpty(t_gush_suffix.Text))
                    {
                        if (String.IsNullOrEmpty(f_parcel_num_e.Text) && String.IsNullOrEmpty(t_parcel_num_e.Text))
                        {
                            ICursor cursor  = AO.create_table_cursor(table);
                            IRow    row     = cursor.NextRow();
                            bool    deleted = false;
                            while (row != null)
                            {
                                if (!(row.Value[row.Fields.FindField("F_GUSH_NUM")] == null) &&
                                    !(row.Value[row.Fields.FindField("F_PARCEL_NUM")] == null) &&
                                    !(row.Value[row.Fields.FindField("T_GUSH_NUM")] == null) &&
                                    !(row.Value[row.Fields.FindField("T_PARCEL_NUM")] == null))
                                {
                                    if (
                                        row.Value[row.Fields.FindField("F_GUSH_NUM")] == Convert.ToInt32(f_gush_num.Text) &&
                                        row.Value[row.Fields.FindField("F_PARCEL_NUM")] == Convert.ToInt32(f_parcel_num.Text) &&
                                        row.Value[row.Fields.FindField("T_GUSH_NUM")] == Convert.ToInt32(t_gush_num.Text) &&
                                        row.Value[row.Fields.FindField("T_PARCEL_NUM")] == Convert.ToInt32(t_parcel_num.Text)
                                        )
                                    {
                                        row.Delete();
                                        MessageBox.Show("רשומה נמחקה");
                                        deleted = true;
                                    }
                                    row = cursor.NextRow();
                                }
                            }
                            if (deleted == false)
                            {
                                MessageBox.Show("לא נמצאה רשומה למחיקה");
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrEmpty(f_parcel_num_e.Text) && String.IsNullOrEmpty(t_parcel_num_e.Text))
                            {
                                int           f_parcel_end   = Convert.ToInt32(f_parcel_num_e.Text);
                                int           f_parcel_start = Convert.ToInt32(f_parcel_num.Text);
                                List <object> parcel_num_in  = new List <object>();
                                while (f_parcel_start <= f_parcel_end)
                                {
                                    parcel_num_in.Add(f_parcel_start.ToString());
                                    f_parcel_start++;
                                }
                                string  query   = "T_PARCEL_NUM =" + t_parcel_num.Text + " AND F_PARCEL_NUM IN (" + AO.ListToString(parcel_num_in) + ")";
                                ICursor cursor  = AO.create_table_cursor_with_query(table, query);
                                IRow    row     = cursor.NextRow();
                                bool    deleted = false;
                                while (row != null)
                                {
                                    row.Delete();
                                    row     = cursor.NextRow();
                                    deleted = true;
                                }
                                if (deleted == false)
                                {
                                    MessageBox.Show("לא נמצאה רשומה למחיקה");
                                }
                            }
                            if (String.IsNullOrEmpty(f_parcel_num_e.Text) && !String.IsNullOrEmpty(t_parcel_num_e.Text))
                            {
                                int           t_parcel_end   = Convert.ToInt32(t_parcel_num_e.Text);
                                int           t_parcel_start = Convert.ToInt32(t_parcel_num.Text);
                                List <object> parcel_num_in  = new List <object>();
                                while (t_parcel_start <= t_parcel_end)
                                {
                                    parcel_num_in.Add(t_parcel_start.ToString());
                                    t_parcel_start++;
                                }
                                string  query   = "F_PARCEL_NUM =" + f_parcel_num.Text + " AND T_PARCEL_NUM IN (" + AO.ListToString(parcel_num_in) + ")";
                                ICursor cursor  = AO.create_table_cursor_with_query(table, query);
                                IRow    row     = cursor.NextRow();
                                bool    deleted = false;
                                while (row != null)
                                {
                                    row.Delete();
                                    row     = cursor.NextRow();
                                    deleted = true;
                                }
                                if (deleted == false)
                                {
                                    MessageBox.Show("לא נמצאה רשומה למחיקה");
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("נא למלא את כל השדות");
                    }
                }
                else
                {
                    MessageBox.Show("טבלת CANCEL_PARCEL_EDIT אינה קיימת ב gdb");
                }
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            IMapDocument mxd = ZoomNextError.ArcMap.Application.Document as IMapDocument;
            IMap         map = mxd.get_Map(0);
            string       gdb = AO.getLayerPathFromMxd(map, "חלקות לעריכה");



            if (String.IsNullOrEmpty(gdb))
            {
                MessageBox.Show("שכבת חלקות לעריכה אינה קיימת במפה");
            }
            if (String.IsNullOrEmpty(gdb))
            {
                MessageBox.Show("שכבת חלקות לעריכה אינה קיימת במפה");
            }
            else
            {
                ITable table     = AO.open_table(gdb, "Errors");
                int    sum_items = table.RowCount(null);
                if (table != null)
                {
                    counter_items++;
                    int     counter = 0;
                    ICursor cursor  = AO.create_table_cursor_with_query(table, "\"OBJECTID\" > " + current_OID.ToString());
                    IRow    row     = cursor.NextRow();
                    while (counter < 1 && row != null)
                    {
                        if (counter_items < sum_items)
                        {
                            counter++;
                            current_OID = row.OID;
                            //MessageBox.Show(current_OID.ToString());
                            string GushNum        = row.Value[row.Fields.FindField("GushNum")];
                            string ParcelNum      = row.Value[row.Fields.FindField("ParcelNum")];
                            string GushSfx        = row.Value[row.Fields.FindField("GushSfx")];
                            object ErrDescription = row.Value[row.Fields.FindField("ErrDescription")];

                            string query = "OBJECTID < 0";
                            if (GushNum == "0" && ParcelNum == "0" && ErrDescription != null)
                            {
                                if (ErrDescription.ToString().Contains("OID:"))
                                {
                                    //MessageBox.Show(System.Text.RegularExpressions.Regex.Match(ErrDescription.ToString(), @"\d+").Value);
                                    string oid = System.Text.RegularExpressions.Regex.Match(ErrDescription.ToString(), @"\d+").Value;
                                    query = "OBJECTID = " + oid;
                                }
                            }
                            else
                            {
                                query = "GUSH_NUM = " + GushNum +
                                        " AND PARCEL = " + ParcelNum +
                                        " AND GUSH_SUFFIX = " + GushSfx;
                            }


                            IFeatureLayer flayer = AO.getLayerFromMxd(map, "חלקות לעריכה");

                            AO.ZoomToSelection(mxd, flayer, query);
                            List_acc.Add(row.OID);
                            //MessageBox.Show(get(List_acc));
                            row = cursor.NextRow();

                            if (ErrDescription != null)
                            {
                                label3.Text = ErrDescription.ToString();
                                label5.Text = sum_items.ToString() + " / " + List_acc.Count.ToString();
                            }
                            else
                            {
                                label3.Text = "ללא תיאור";
                                label5.Text = "";
                            }
                        }
                        else
                        {
                            current_OID   = -1;
                            counter_items = 0;
                        }
                    }
                }
            }
        }