Example #1
0
        private void delete_btn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.gridView1.IsFocusedView)
            {
                DataRow dr = this.gridView1.GetDataRow(this.gridView1.FocusedRowHandle);
                string  id = dr["id"].ToString();
                if (MessageBox.Show("先选中才能删除,确认删除该行吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ArrayList arr_where = new ArrayList();
                    arr_where.Add("id:" + id);
                    int result = OperateDatabase.Delete("data", arr_where);
                    if (result == 1)
                    {
                        MessageBox.Show("删除成功");
                        return;
                    }
                    gridView1.DeleteSelectedRows();
                    ArrayList arr = new ArrayList();
                    DataTable dt  = OperateDatabase.select("data", arr);
                    this.gridControl1.DataSource   = dt;
                    this.tabControl2.SelectedIndex = 1;
                    this.gridControl1.Update();
                    this.gridControl1.RefreshDataSource();
                    this.gridControl1.Refresh();
                    this.gridView1.RefreshData();

                    gridView1.RefreshData();
                    this.tabControl2.Update();
                }
            }
            else
            {
                MessageBox.Show("请先选择一行");
            }
        }
Example #2
0
        //加载属性数据
        private void Form1_Load(object sender, EventArgs e)
        {
            ArrayList arr = new ArrayList();
            DataTable dt  = OperateDatabase.select("data", arr);

            this.gridControl1.DataSource = dt;
        }
        private void statics_btn_Click(object sender, EventArgs e)
        {
            //查询起始日期的数字
            if (this.dateEdit_start.Text == "" || this.dateEdit_target.Text == "")
            {
                MessageBox.Show("请填写起止日期");
                return;
            }
            DateTime s = new DateTime(2020, 1, 24, 0, 0, 0);

            if (this.dateEdit_start.DateTime < s)
            {
                this.dateEdit_start.DateTime = s;
            }
            ArrayList arr1 = new ArrayList();

            arr1.Add("YMD:'" + this.dateEdit_start.Text + "'");
            DataTable dt1  = OperateDatabase.select("data", arr1);
            ArrayList arr2 = new ArrayList();

            arr2.Add("YMD:'" + this.dateEdit_target.Text + "'");
            DataTable dt2 = OperateDatabase.select("data", arr2);
            Series    s1  = this.chartControl1.Series[0];

            s1.DataSource          = dt1;
            s1.ArgumentDataMember  = "name";
            s1.ValueDataMembers[0] = "CurConfirmeed";
            Series s2 = this.chartControl1.Series[1];

            s2.DataSource          = dt2;
            s2.ArgumentDataMember  = "name";
            s2.ValueDataMembers[0] = "CurConfirmeed";
        }
Example #4
0
        private void query_btn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ArrayList arr = new ArrayList();
            DataTable dt  = OperateDatabase.select("data", arr);

            this.gridControl1.DataSource   = dt;
            this.tabControl2.SelectedIndex = 1;
        }
Example #5
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            //获取修改的单元格
            string CellValue = this.gridView1.GetFocusedValue().ToString();
            //获取单元格的列名
            string ColumnName = this.gridView1.FocusedColumn.FieldName;
            //获取所在列的id
            DataRow dr = this.gridView1.GetDataRow(e.RowHandle);
            string  id = dr["id"].ToString();
            //修改
            ArrayList arr = new ArrayList();

            if (ColumnName == "name" || ColumnName == "YMD")
            {
                arr.Add(ColumnName + ":'" + CellValue + "'");
            }
            else
            {
                arr.Add(ColumnName + ":" + CellValue);
            }
            ArrayList arr_where = new ArrayList();

            arr_where.Add("id:" + id);
            int result = OperateDatabase.Update("data", arr, arr_where);

            if (result == 0)
            {
                MessageBox.Show("该值修改失败");
            }
            arr = new ArrayList();
            DataTable dt = OperateDatabase.select("data", arr);

            this.gridControl1.DataSource   = dt;
            this.tabControl2.SelectedIndex = 1;
            this.gridControl1.Update();
            this.gridControl1.RefreshDataSource();
            this.gridControl1.Refresh();
            gridView1.RefreshData();
            this.tabControl2.Update();
        }
Example #6
0
        /// <summary>
        /// 显示每日疫情
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //查询每日疫情
            ArrayList arr = new ArrayList();

            //获取日期
            if (this.selectedDate.EditValue == null)
            {
                MessageBox.Show("请选择日期");
                return;
            }
            arr.Add("YMD:'" + this.selectedDate.EditValue + "'");
            DataTable dt = OperateDatabase.select("data", arr);

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("当日无数据");
                return;
            }
            //为当前图层添加字段
            IFeatureLayer layer = null;

            //遍历,寻找市域图层
            for (int i = 0; i < this.axMapControl1.Map.LayerCount; i++)
            {
                ILayer layer1 = this.axMapControl1.Map.get_Layer(i);
                if (layer1.Name == "市域")
                {
                    layer = layer1 as IFeatureLayer;
                    break;
                }
            }
            if (layer == null)
            {
                MessageBox.Show("请打开市域图层");
                return;
            }
            //获取图层字段,没有则添加一个num字段
            IFeatureClass featureClass = layer.FeatureClass;
            int           isExist      = featureClass.FindField("num");

            if (isExist == -1)
            {
                //添加一个字段
                IFields     pFields     = featureClass.Fields;
                IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;
                IField      fld         = new FieldClass();
                IFieldEdit2 fldE        = fld as IFieldEdit2;
                fldE.Name_2      = "num";
                fldE.AliasName_2 = "数量";
                fldE.Type_2      = esriFieldType.esriFieldTypeSingle;
                featureClass.AddField(fld);
            }
            //给字段赋值
            IFeatureCursor pFtCursor     = featureClass.Search(null, false);
            IFeature       pFt           = pFtCursor.NextFeature();
            int            index1        = pFt.Fields.FindField("num");
            IDataset       dataset       = (IDataset)featureClass;
            IWorkspace     workspace     = dataset.Workspace;
            IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;

            workspaceEdit.StartEditing(true);
            workspaceEdit.StartEditOperation();
            while (pFt != null)
            {
                int    index = pFt.Fields.FindField("code");
                String code  = pFt.get_Value(index).ToString();

                DataRow[] drs   = dt.Select("CODE=" + code);
                DataTable dtNew = dt.Clone();
                for (int i = 0; i < drs.Length; i++)
                {
                    dtNew.ImportRow(drs[i]);
                }
                String num = dtNew.Rows[0]["AllConfiemed"].ToString();
                if (num == "")
                {
                    num = "0";
                }

                pFt.set_Value(index1, Convert.ToInt32(num));
                pFt.Store();
                pFt = pFtCursor.NextFeature();
            }
            GisClass.ClassRender(this.axMapControl1.ActiveView, layer, 6, "num");
            //GisClass.UniqueValueRender(this.axMapControl1.ActiveView,layer,10,"num");
        }