Exemplo n.º 1
0
        public void UpdateObject(string type)
        {
            //获取焦点对象



            Line_Info obj = FocusedObject;

            if (obj == null)
            {
                return;
            }
            if (obj.S4 == "no")
            {
                MessageBox.Show("不能修改此行!"); return;
            }
            //创建对象的一个副本
            Line_Info objCopy = new Line_Info();

            DataConverter.CopyTo <Line_Info>(obj, objCopy);

            //执行修改操作
            using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog())
            {
                if (gridControl.DataSource != null)
                {
                    dlg.LIST = (IList <Line_Info>)gridControl.DataSource;
                }

                dlg.IsSelect      = isselect;
                dlg.ctrlLint_Info = this;
                dlg.Type          = types1;
                //dlg.Type = flagstype;
                dlg.Flag      = flags1;
                dlg.Type2     = types2;
                dlg.ProjectID = projectid;
                if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "廊坊")
                {
                    dlg.rowAreaName.Properties.Caption = "地线型号";
                    dlg.rowL2.Visible = false;
                    dlg.rowL3.Visible = false;
                }

                dlg.Object = objCopy;   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象
            DataConverter.CopyTo <Line_Info>(objCopy, obj);
            RefreshData(type);
            gridControl.RefreshDataSource();
        }
Exemplo n.º 2
0
        public void AddObject(string type)
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }

            //新建对象
            Line_Info obj = new Line_Info();

            //obj.L6 = DateTime.Now;
            obj.CreateDate = DateTime.Now;
            //执行添加操作
            using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog())
            {
                if (gridControl.DataSource != null)
                {
                    dlg.LIST = (IList <Line_Info>)gridControl.DataSource;
                }
                dlg.ProjectID = projectid;
                //dlg.Type = types1;
                dlg.Type          = types1;
                dlg.Flag          = flags1;
                dlg.Type2         = types2;
                dlg.ctrlLint_Info = this;

                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;

                if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "廊坊")
                {
                    dlg.rowAreaName.Properties.Caption = "地线型号";
                    dlg.rowL2.Visible = false;
                    dlg.rowL3.Visible = false;
                }
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            RefreshData(type);
            //将新对象加入到链表中
            //ObjectList.Add(obj);

            ////刷新表格,并将焦点行定位到新对象上。
            //gridControl.RefreshDataSource();
            //GridHelper.FocuseRow(this.bandedGridView2, obj);
        }
Exemplo n.º 3
0
        public void UpdateObject(string type)
        {
            //��ȡ�������

            Line_Info obj = FocusedObject;
            if (obj == null)
            {
                return;
            }
            if (obj.S4 == "no")
            { MessageBox.Show("�����޸Ĵ��У�"); return; }
            //���������һ������
            Line_Info objCopy = new Line_Info();
            DataConverter.CopyTo<Line_Info>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog())
            {
                if (gridControl.DataSource != null)
                    dlg.LIST = (IList<Line_Info>)gridControl.DataSource;

                dlg.IsSelect = isselect;
                dlg.ctrlLint_Info = this;
                dlg.Type = types1;
                //dlg.Type = flagstype;
                dlg.Flag = flags1;
                dlg.Type2 = types2;
                dlg.ProjectID = projectid;
                if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "�ȷ�")
                {
                    dlg.rowAreaName.Properties.Caption = "�����ͺ�";
                    dlg.rowL2.Visible = false;
                    dlg.rowL3.Visible = false;
                }

                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<Line_Info>(objCopy, obj);
            RefreshData(type);
            gridControl.RefreshDataSource();
        }
Exemplo n.º 4
0
        public void AddObject(string type)
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }

            //�½�����
            Line_Info obj = new Line_Info();
            //obj.L6 = DateTime.Now;
            obj.CreateDate = DateTime.Now;
            //ִ����Ӳ���
            using (FrmLine_InfoDialog dlg = new FrmLine_InfoDialog())
            {
                if(gridControl.DataSource!=null)
                    dlg.LIST = (IList<Line_Info>)gridControl.DataSource;
                dlg.ProjectID = projectid;
                //dlg.Type = types1;
                dlg.Type = types1;
                dlg.Flag = flags1;
                dlg.Type2 = types2;
                dlg.ctrlLint_Info = this;

                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;

            if (System.Configuration.ConfigurationSettings.AppSettings["LangFang"].ToString() == "�ȷ�")
            {
                dlg.rowAreaName.Properties.Caption = "�����ͺ�";
                dlg.rowL2.Visible = false;
                dlg.rowL3.Visible = false;
            }
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            RefreshData(type);
            //���¶�����뵽������
            //ObjectList.Add(obj);

            ////ˢ�±�񣬲��������ж�λ���¶����ϡ�
            //gridControl.RefreshDataSource();
            //GridHelper.FocuseRow(this.bandedGridView2, obj);
        }