示例#1
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());
                }
            }
        }
示例#2
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);
        }