コード例 #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (row == null)
            {
                MessageBox.Show("请选择分类。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            TypeUID = row["UID"].ToString();
            UseRelating _userel = new UseRelating();

            _userel.UseID = UseID;

            IList <UseRelating> UseRelList = Services.BaseService.GetList <UseRelating>("SelectUseRelatingByUseID", _userel);

            if (UseRelList.Count > 0)
            {
                _userel = (UseRelating)UseRelList[0];
                if (!string.IsNullOrEmpty(_userel.UsePropertyUID))
                {
                    if (MessageBox.Show("选择的地块已经设置了分类,确定要更换分类么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        property _pro = new property();
                        _pro.TypeUID = _userel.UsePropertyUID;
                        _pro.UseUID  = _userel.UseID;
                        Services.BaseService.Update("DeletepropertyByTypeAndUseUID", _pro);
                        _userel.UsePropertyUID = TypeUID;
                        Services.BaseService.Update <UseRelating>(_userel);
                    }
                }
                else
                {
                    _userel.UsePropertyUID = TypeUID;
                    Services.BaseService.Update <UseRelating>(_userel);
                }
            }
            else
            {
                _userel.UID            = Guid.NewGuid().ToString();
                _userel.UseID          = UseID;
                _userel.SvgUid         = SvgDataUID;
                _userel.UsePropertyUID = TypeUID;
                Services.BaseService.Create <UseRelating>(_userel);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #2
0
 public void InitData(UseRelating UseRel)
 {
     _prop.UseUID  = UseRel.UseID;
     _prop.TypeUID = UseRel.UsePropertyUID;
     dt            = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectpropertyByTypeAndUseUID", _prop), typeof(property));
     if (dt.Rows.Count > 0)
     {
         gridControl1.DataSource = dt;
         IsCreate = false;
     }
     else
     {
         dt       = Itop.Common.DataConverter.ToDataTable(Services.BaseService.GetList("SelectpropertyByTypeUID", _prop), typeof(property));
         IsCreate = true;
     }
     gridControl1.DataSource = dt;
 }
コード例 #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            SelSvgUid = ctrlFileManager1.SvgUid;
            if (isLink)
            {
                if (string.IsNullOrEmpty(SelSvgUid))
                {
                    MessageBox.Show("请选择要关联的地图。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                UseRelating _userel = new UseRelating();
                _userel.UseID  = UseUid;
                _userel.SvgUid = svgDataUid;
                IList <UseRelating> UseRelList = Services.BaseService.GetList <UseRelating>("SelectUseRelatingByUseID", _userel);
                if (UseRelList.Count > 0)
                {
                    _userel = (UseRelating)UseRelList[0];
                    if (!string.IsNullOrEmpty(_userel.LinkUID))
                    {
                        if (MessageBox.Show("选择的地块已经关联了其他地图,确定要更换关联么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            _userel.LinkUID = SelSvgUid;
                            Services.BaseService.Update <UseRelating>(_userel);
                        }
                    }
                    else
                    {
                        _userel.LinkUID = SelSvgUid;
                        Services.BaseService.Update <UseRelating>(_userel);
                    }
                }
                else
                {
                    _userel.UID     = Guid.NewGuid().ToString();
                    _userel.UseID   = UseUid;
                    _userel.SvgUid  = svgDataUid;
                    _userel.LinkUID = SelSvgUid;
                    Services.BaseService.Create <UseRelating>(_userel);
                }
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }