示例#1
0
        private bool Modify()
        {
            if (selectionFeature == null ||
                          selectionFeature.Count < 1)
            {
                MessageBox.Show("��ѡ��һ������", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            MapInfo.Data.Table maptable = Session.Current.Catalog.GetTable(strTempMapPointTable);
            Feature f = selectionFeature[0];

            string strPointCode = f["ID"].ToString().Trim();

            //ʹ���еĻ�վ����ɾ��
            //DataRow dr = this.ds.Tables["ʹ�û�վ�ı�"].Rows.Find(strPointCode);
            //if (dr != null)
            //{
            //    MessageBox.Show(string.Format("Point[{0}] is in use,please delete records by[PlanGoods],then delete point.", strPointCode), this.Text);
            //    return false;
            //}

            using (AddPoint ad = new AddPoint(this.ds.Tables["E_Area"], false))
            {
                if (!SetPointDataFromDataBase(ad, strPointCode))
                    return false;
                DataRow dr = this.ds.Tables["E_Points"].Rows.Find(strPointCode);
                ad.cbxAreaCode.SelectedIndex = Int32.Parse(dr["AreaCode"].ToString());
                ad.cbxPointType.SelectedIndex = Int32.Parse(dr["FromTo"].ToString());
                ad.Text = "�޸Ŀͻ���Ϣ";
                ad.cbIsBusy.Checked = Convert.IsDBNull(dr[18]) ? false : Convert.ToBoolean(dr[18]);
                ad.tbxPointCode.Enabled = false;
                if (ad.ShowDialog() == DialogResult.OK)
                {
                    /*
            ����n��
            ����
            ����ҵ
                     */
                    int iType = 0;
                    iType = ad.cbxPointType.SelectedIndex;
                    //if (ad.cbxPointType.SelectedIndex == "����n��")
                    //{
                    //    iType = 0;
                    //}
                    //else if (ad.cbxPointType.Text == "����")
                    //{
                    //    iType = 1;
                    //}
                    //else if (ad.cbxPointType.Text == "����ҵ")
                    //{
                    //    iType = 2;
                    //}

                    ModifyPointDataToDataBase(ad, iType, strPointCode);
                    ModifyPoint(f, ad.tbxPointCode.Text.Trim(), iType, Convert.ToDouble(ad.tbxLongitude.Text.Trim()), Convert.ToDouble(ad.tbxLatitude.Text.Trim()), ad.tbxPointName.Text.Trim(), ad.cbIsBusy.Checked);
                    // ModifyPointGrid(ad, iType, strPointCode);

                    if (!this.toolStripButton8.Enabled)
                    {
                        this.toolStripButton8.Enabled = true;
                    }
                }
            }

            return true;
        }
示例#2
0
 private void AddPointDataToDataBase(AddPoint ad, int iType)
 {
     DataRow dr = FindDeletedRow(ad.tbxPointCode.Text.Trim());
     bool bNew = false;
     if (dr == null)
     {
         dr = this.ds.Tables["E_Points"].NewRow();
         bNew = true;
     }
     SetPointDataRow(dr, ad, iType);
     if (bNew)
     {
         this.ds.Tables["E_Points"].Rows.Add(dr);
     }
 }
示例#3
0
        private void button3_Click(object sender, EventArgs e)
        {
            //this.mapControl1.Tools.LeftButtonTool = "AddPoint";

            //�����ť�Զ�������ӻ���   //Ĭ��43.884387  125.318248(����㳡����)
            using (AddPoint ad = new AddPoint(ds.Tables["E_Area"], true))//this.ds.Tables["E_Area"], true))
            {
                // ad.dt_Points = this.ds.Tables["E_Points"];
                ad.tbxLongitude.Text = "125.318248"; //("")).ToString();
                ad.tbxLatitude.Text = "43.884387";//(Math.Round(e.Feature.Centroid.y, 6)).ToString(); //e.Feature.Centroid.y.ToString();
                ad.cbxPointType.SelectedIndex = 0;
                if (ad.ShowDialog() == DialogResult.OK)
                {
                    if (!toolStripButton8.Enabled)
                    {
                        toolStripButton8.Enabled = true;
                    }
                    int iType = 0;
                    if (ad.cbxPointType.SelectedIndex == 0)
                    {
                        iType = 0;
                    }
                    else if (ad.cbxPointType.SelectedIndex == 1)
                    {
                        iType = 1;
                    }
                    else if (ad.cbxPointType.SelectedIndex == 2)
                    {
                        iType = 2;
                    }
                    else if (ad.cbxPointType.SelectedIndex == 3)
                    {
                        iType = 3;
                    }

                    AddPointDataToDataBase(ad, iType);
                    AddPoint(ad.tbxPointCode.Text.Trim(), iType, Convert.ToDouble(ad.tbxLongitude.Text), Convert.ToDouble(ad.tbxLatitude.Text), ad.tbxPointName.Text.Trim(), false);
                }
            }
        }
示例#4
0
 /// <summary>
 /// �޸Ļ�վ��Ϣ����ʱ���ݿ�
 /// </summary>
 /// <param name="ad"></param>
 /// <param name="iType"></param>
 /// <param name="strPointCode"></param>
 private void ModifyPointDataToDataBase(AddPoint ad, int iType, string strPointCode)
 {
     DataRow dr = FindModifyRow(strPointCode);
     SetPointDataRow(dr, ad, iType);
 }