Exemple #1
0
 private void btnAddLayers_Click(object sender, EventArgs e)
 {
     if (this.lvRoles.SelectedItems.Count != 0)
     {
         frmAddLayer _frmAddLayer = new frmAddLayer(this.lvRoles.SelectedItems[0].Tag);
         if (_frmAddLayer.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             this.lvLayers.Items.Clear();
             string[] layerName = new string[2];
             for (int i = 0; i < _frmAddLayer.Layers.Count; i++)
             {
                 LayerClass item = _frmAddLayer.Layers[i];
                 if (item.Privilege != 0)
                 {
                     layerName[0] = item.LayerName;
                     layerName[1] = this.PrivilegeDes[item.Privilege];
                     ListViewItem listViewItem = new ListViewItem(layerName)
                     {
                         Tag = item.OID
                     };
                     this.lvLayers.Items.Add(listViewItem);
                 }
             }
         }
     }
 }
Exemple #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int       oID;
            string    str;
            string    str1;
            string    str2;
            SysGrants sysGrant = new SysGrants();

            for (int i = 0; i < this._layers.Count; i++)
            {
                LayerClass item = this._layers[i];
                string     str3 = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
                if (str3 == "无")
                {
                    item.Privilege = 0;
                }
                else if (str3 == "可见")
                {
                    item.Privilege = 1;
                }
                else if (str3 == "可编辑")
                {
                    item.Privilege = 2;
                }
                if (item.Privilege == 0)
                {
                    if (item.Change)
                    {
                        SysGrants sysGrant1 = sysGrant;
                        string    str4      = this._id.ToString();
                        str = (this._type == 0 ? "Roles" : "Staff");
                        oID = item.OID;
                        sysGrant1.DeleteGrant(str4, str, oID.ToString(), item.DataType);
                    }
                }
                else if (!item.Exist)
                {
                    SysGrants sysGrant2 = sysGrant;
                    string    str5      = this._id.ToString();
                    str2 = (this._type == 0 ? "Roles" : "Staff");
                    string str6     = item.OID.ToString();
                    string dataType = item.DataType;
                    oID = item.Privilege;
                    sysGrant2.AddGrant(str5, str2, "admin", str6, dataType, oID.ToString());
                }
                else if (item.Change)
                {
                    SysGrants sysGrant3 = sysGrant;
                    string    str7      = this._id.ToString();
                    str1 = (this._type == 0 ? "Roles" : "Staff");
                    string str8      = item.OID.ToString();
                    string dataType1 = item.DataType;
                    oID = item.Privilege;
                    sysGrant3.UpdateGrant(str7, str1, str8, dataType1, oID.ToString());
                }
            }
        }
Exemple #3
0
    private void _RemoveMarkers(ObservableCollection <LayerClass> layers, int count, int removeAt)
    {
        int removeMarkersAt = _MarkerCountForLayerIndex(layers, removeAt);

        while (count > 0)
        {
            LayerClass layer = layers[removeAt++];
            layer.Markers.CollectionChanged -= _LayerMarkersCollectionChanged;
            Markers.RemoveRange(removeMarkersAt, layer.Markers.Count);
        }
    }
Exemple #4
0
 public ViewModel()
 {
     Markers = new ObservableCollection <MarkerClass>();
     Layers  = new ObservableCollection <LayerClass>();
     Layers.CollectionChanged += _LayerCollectionChanged;
     for (int j = 0; j < 10; j++)
     {
         var Layer = new LayerClass();
         for (int i = 0; i < 10; i++)
         {
             Layer.Markers.Add(new MarkerClass(i * 20, 10 * j));
         }
         Layers.Add(Layer);
     }
 }
Exemple #5
0
 private void btnDeleteLayers_Click(object sender, EventArgs e)
 {
     if (this.lvLayers.SelectedItems.Count > 0)
     {
         SysGrants sysGrant = new SysGrants();
         for (int i = this.lvLayers.SelectedItems.Count - 1; i >= 0; i--)
         {
             ListViewItem item   = this.lvLayers.SelectedItems[i];
             LayerClass   tag    = item.Tag as LayerClass;
             string       roleID = (this.lvRoles.SelectedItems[0].Tag as ORGRole).RoleID;
             int          oID    = tag.OID;
             sysGrant.DeleteGrant(roleID, "Roles", oID.ToString(), tag.DataType);
             this.lvLayers.Items.Remove(item);
         }
     }
 }
Exemple #6
0
 private void btnDeleteLayers_Click(object sender, EventArgs e)
 {
     if (this.lvLayers.SelectedItems.Count > 0)
     {
         SysGrants sysGrant = new SysGrants();
         for (int i = this.lvLayers.SelectedItems.Count - 1; i >= 0; i--)
         {
             ListViewItem item = this.lvLayers.SelectedItems[i];
             if (item.Group == this.lvLayers.Groups[0])
             {
                 LayerClass tag     = item.Tag as LayerClass;
                 string     staffID = (this.lvStaff.SelectedItems[0].Tag as Staff).StaffID;
                 int        oID     = tag.OID;
                 sysGrant.DeleteGrant(staffID, "Staff", oID.ToString(), tag.DataType);
                 this.lvLayers.Items.Remove(item);
             }
         }
     }
 }
        public static void ConvertToMIDI(string outputFile, Stream inputStream, byte chunk, bool restrict)
        {
            Settings.LimitChunks = chunk;
            Settings.Restrict    = restrict;

            // Dim fileStream1 As New FileStream(file, FileMode.Open, FileAccess.Read)
            var fileStream2 = new FileStream(outputFile, FileMode.Create, FileAccess.ReadWrite);
            var br          = new BinaryReader(inputStream);
            var bw          = new BinaryWriter(fileStream2);

            ReadHeader(br);
            if (!HeaderData.Valid)
            {
                throw new FormatException("Header of .m64 file is invalid!");
            }
            else
            {
                StartMIDIHeader(bw);
                StartMIDISettings(bw);
                long position = bw.BaseStream.Position;
                byte track    = 0;
                while (Conversions.ToInteger(track) < 16)
                {
                    byte layer = 0;
                    while (Conversions.ToInteger(layer) < 16)
                    {
                        HeaderData.TotalTimestamp = 0;
                        br.BaseStream.Position    = 0L;
                        StartMIDITrack(bw, track);
                        ConvertHeader(br, bw, track, layer);
                        FinishMIDITrack(bw, track);
                        TrackData = new TrackClass();
                        LayerData = new LayerClass();
                        NoteData  = new NoteClass();
                        layer    += 1;
                    }

                    track += 1;
                }

                if (position == bw.BaseStream.Position)
                {
                    br.Close();
                    bw.Flush();
                    bw.Close();
                    // fileStream1.Close()
                    fileStream2.Close();
                    HeaderData = new HeaderClass();
                    File.Delete(fileStream2.Name);
                    throw new FormatException(".m64 file is invalid!");
                }
                else
                {
                    FinishMIDIHeader(bw);
                    FinishMIDISettings(bw);
                    br.Close();
                    bw.Flush();
                    bw.Close();
                    // fileStream1.Close()
                    fileStream2.Close();
                    HeaderData = new HeaderClass();
                }
            }
        }
Exemple #8
0
        private void frmAddLayer_Load(object sender, EventArgs e)
        {
            LayerClass    layerClass;
            int           i;
            DataRow       item;
            IRow          row;
            string        str;
            string        str1;
            int           count;
            int           oID;
            string        str2;
            object        value;
            List <string> strs      = new List <string>();
            List <string> strs1     = new List <string>();
            DataTable     dataTable = null;

            dataTable = (this._type != 0 ? this.sysgrants.GetStaffObjectPri(this._id.ToString(), "gisLayer") : this.sysgrants.GetRolesObjectPri(this._id.ToString(), "gisLayer"));
            ITable table = CommonClass.OpenTable("LayerConfig");

            if (table == null)
            {
                return;
            }
            int num  = table.FindField("Name");
            int num1 = table.FindField("FeatureClassName");
            int num2 = 0;

            for (i = 0; i < dataTable.Rows.Count; i++)
            {
                item = dataTable.Rows[i];
                string str3 = Convert.ToString(item["GRANTOBJECT"]);
                strs.Add(str3);
                num2 = int.Parse(Convert.ToString(item["privilege"]));
                row  = table.GetRow(Convert.ToInt32(str3));
                str  = row.Value[num].ToString();
                str1 = row.Value[num1].ToString();
                strs.Add(str3);
                layerClass = new LayerClass(Convert.ToInt32(str3), str, str1, num2, true);
                this._layers.Add(layerClass);
                this.dataGridView1.Rows.Add();
                count = this.dataGridView1.Rows.Count;
                this.dataGridView1.Rows[count - 1].Cells[0].Value = str;
                if (num2 == 0)
                {
                    this.dataGridView1.Rows[count - 1].Cells[1].Value = "无";
                }
                else if (num2 == 1)
                {
                    this.dataGridView1.Rows[count - 1].Cells[1].Value = "可见";
                }
                else if (num2 == 2)
                {
                    this.dataGridView1.Rows[count - 1].Cells[1].Value = "可编辑";
                }
            }
            ITable table1 = CommonClass.OpenTable("DATASETTABLE");

            if (table1 != null)
            {
                dataTable = (this._type != 0 ? this.sysgrants.GetStaffObjectPri(this._id.ToString(), "gisDataset") : this.sysgrants.GetRolesObjectPri(this._id.ToString(), "gisDataset"));
                int num3 = table1.FindField("Name");
                int num4 = table1.FindField("RealName");
                for (i = 0; i < dataTable.Rows.Count; i++)
                {
                    item = dataTable.Rows[i];
                    strs1.Add(Convert.ToString(item["GRANTOBJECT"]));
                    oID  = int.Parse(Convert.ToString(item["GRANTOBJECT"]));
                    num2 = int.Parse(Convert.ToString(item["privilege"]));
                    row  = table1.GetRow(oID);
                    str  = row.Value[num3].ToString();
                    str1 = row.Value[num4].ToString();
                    strs1.Add(oID.ToString());
                    layerClass = new LayerClass(oID, str, str1, num2, true, "gisDataset");
                    this._layers.Add(layerClass);
                    this.dataGridView1.Rows.Add();
                    count = this.dataGridView1.Rows.Count;
                    this.dataGridView1.Rows[count - 1].Cells[0].Value = str;
                    if (num2 == 0)
                    {
                        this.dataGridView1.Rows[count - 1].Cells[1].Value = "无";
                    }
                    else if (num2 == 1)
                    {
                        this.dataGridView1.Rows[count - 1].Cells[1].Value = "可见";
                    }
                    else if (num2 == 2)
                    {
                        this.dataGridView1.Rows[count - 1].Cells[1].Value = "可编辑";
                    }
                }
            }
            ICursor cursor = table.Search(null, false);
            IRow    row1   = cursor.NextRow();

            while (row1 != null)
            {
                oID = row1.OID;
                if (strs.IndexOf(oID.ToString()) == -1)
                {
                    str2  = row1.Value[num].ToString();
                    value = row1.Value[num1];
                    if ((!(value is DBNull) && value.ToString().Trim().Length != 0))
                    {
                        layerClass = new LayerClass(oID, str2, value.ToString(), 0, false);
                        this.dataGridView1.Rows.Add();
                        count = this.dataGridView1.Rows.Count;
                        this.dataGridView1.Rows[count - 1].Cells[0].Value = str2;
                        this.dataGridView1.Rows[count - 1].Cells[1].Value = "无";
                        this._layers.Add(layerClass);
                    }
                    else
                    {
                        row1 = cursor.NextRow();
                        continue;
                    }
                }
                row1 = cursor.NextRow();
            }
            Marshal.ReleaseComObject(cursor);
            if (table1 != null)
            {
                IQueryFilter queryFilterClass = new QueryFilterClass()
                {
                    WhereClause = "DataType = 5"
                };
                num    = table1.FindField("Name");
                num1   = table1.FindField("RealName");
                cursor = table1.Search(queryFilterClass, false);
                row1   = cursor.NextRow();
                while (row1 != null)
                {
                    oID = row1.OID;
                    if (strs1.IndexOf(oID.ToString()) == -1)
                    {
                        str2  = row1.Value[num].ToString();
                        value = row1.Value[num1];
                        if ((!(value is DBNull) && value.ToString().Trim().Length != 0))
                        {
                            layerClass = new LayerClass(oID, str2, value.ToString(), 0, false, "gisDataset");
                            this.dataGridView1.Rows.Add();
                            count = this.dataGridView1.Rows.Count;
                            this.dataGridView1.Rows[count - 1].Cells[0].Value = str2;
                            this.dataGridView1.Rows[count - 1].Cells[1].Value = "无";
                            this._layers.Add(layerClass);
                        }
                        else
                        {
                            row1 = cursor.NextRow();
                            continue;
                        }
                    }
                    row1 = cursor.NextRow();
                }
                Marshal.ReleaseComObject(cursor);
            }
        }
Exemple #9
0
        private void UpdateLayerGRANTS(SysGrants sys, string userID, LayerClass layer, string newval)
        {
            int oID = layer.OID;

            sys.UpdateGrant(userID, "Roles", oID.ToString(), layer.DataType, newval);
        }