private void UpdateLayerGRANTS(int newval) { int i; ListViewItem item; if (this.lvStaff.SelectedItems.Count != 0) { string staffID = (this.lvStaff.SelectedItems[0].Tag as Staff).StaffID; SysGrants sysGrant = new SysGrants(); if (!this.m_IsAll) { for (i = 0; i < this.lvLayers.SelectedItems.Count; i++) { item = this.lvLayers.SelectedItems[i]; if (item.Group == this.lvLayers.Groups[0]) { this.UpdateLayerGRANTS(sysGrant, staffID, item.Tag as LayerClass, newval.ToString()); item.SubItems[1].Text = this.PrivilegeDes[newval]; } } } else { for (i = 0; i < this.lvLayers.Items.Count; i++) { item = this.lvLayers.Items[i]; if (item.Group == this.lvLayers.Groups[0]) { this.UpdateLayerGRANTS(sysGrant, staffID, item.Tag as LayerClass, newval.ToString()); item.SubItems[1].Text = this.PrivilegeDes[newval]; } } } } }
private void UpdateLayerGRANTS(int newval) { int i; ListViewItem item; if (this.lvRoles.SelectedItems.Count != 0) { string roleID = (this.lvRoles.SelectedItems[0].Tag as ORGRole).RoleID; SysGrants sysGrant = new SysGrants(); if (!this.m_IsAll) { for (i = 0; i < this.lvLayers.SelectedItems.Count; i++) { item = this.lvLayers.SelectedItems[i]; this.UpdateLayerGRANTS(sysGrant, roleID, item.Tag as LayerClass, newval.ToString()); item.SubItems[1].Text = this.PrivilegeDes[newval]; } } else { for (i = 0; i < this.lvLayers.Items.Count; i++) { item = this.lvLayers.Items[i]; this.UpdateLayerGRANTS(sysGrant, roleID, item.Tag as LayerClass, newval.ToString()); item.SubItems[1].Text = this.PrivilegeDes[newval]; } } } }
private void btnStartEditing_Click(object sender, EventArgs e) { SysGrants grants = new SysGrants(); bool flag = false; if ((this.m_pTable as IDataset).Workspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace) { if (AppConfigInfo.UserID.Length == 0) { flag = true; } else { flag = grants.GetStaffAndRolesLayerPri(AppConfigInfo.UserID, 2, (this.m_pTable as IDataset).Name); } } else { flag = true; } if (flag) { ((this.m_pTable as IDataset).Workspace as IWorkspaceEdit).StartEditing(true); this.dataGrid1.ReadOnly = false; this.btnStartEditing.Enabled = false; this.btnSaveEditing.Enabled = false; this.m_InEditing = true; this.btnStopEditing.Enabled = true; } }
private bool CheckIsEdit(IDataset pDataset) { if (this.m_pEditWorkspace != null) { IWorkspace workspace = pDataset.Workspace; if (workspace.ConnectionProperties.IsEqual(this.m_pEditWorkspace.ConnectionProperties)) { if (workspace.Type != esriWorkspaceType.esriRemoteDatabaseWorkspace) { return(true); } if (workspace is IVersionedWorkspace) { IVersionedObject obj2 = pDataset as IVersionedObject; if (obj2.IsRegisteredAsVersioned) { SysGrants grants = new SysGrants(); return(((AppConfigInfo.UserID.Length == 0) || (AppConfigInfo.UserID.ToLower() == "admin")) || grants.GetStaffAndRolesLayerPri(AppConfigInfo.UserID, 2, pDataset.Name)); } } } } return(false); }
public BulidMenuXMLByDB(string string_3) { this.string_0 = ""; this.string_1 = ""; this.sysGrants_0 = null; this.menuInfoHelper_0 = new MenuInfoHelper(); this.dataProviderType_0 = DataProviderType.Sql; this.int_0 = 0; this.string_0 = string_3; this.sysGrants_0 = new SysGrants(); this.dataProviderType_0 = DataProviderType.Sql; string[] strArray2 = ConfigurationManager.AppSettings["SYSPRIVDB"].Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); if ((strArray2[0].ToLower() == "sqlserver") || (strArray2[0].ToLower() == "sql")) { this.dataProviderType_0 = DataProviderType.Sql; } else if (strArray2[0].ToLower() == "oracle") { this.dataProviderType_0 = DataProviderType.Oracle; } else if (strArray2[0].ToLower() == "oledb") { this.dataProviderType_0 = DataProviderType.OleDb; } else if (strArray2[0].ToLower() == "odbc") { this.dataProviderType_0 = DataProviderType.Odbc; } else if (strArray2[0].ToLower() == "access") { this.dataProviderType_0 = DataProviderType.Access; } this.string_2 = strArray2[1]; }
public GxDatabase() { if ((AppConfigInfo.UserID.Length > 0) && (AppConfigInfo.UserID != "admin")) { this.sysGrants_0 = new SysGrants(AppConfigInfo.UserID); } }
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()); } } }
public void Delete(string string2) { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this._dataProviderType, this._connectionString); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery(CommandType.Text, string.Format("delete from {0} where ID='{1}'", this._tableName, string2)); ORGStaffRoleHelper.DeleteByStaffID(dataAccessLayer, string2); SysGrants.DeleteByStaffID(dataAccessLayer, string2); dataAccessLayer.Close(); }
public void Delete(string string_2) { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery(CommandType.Text, string.Format("delete from {0} where ROLEID='{1}'", this.string_0, string_2)); ORGStaffRoleHelper.DeleteByRoleID(dataAccessLayer, string_2); SysGrants.DeleteByRoleID(dataAccessLayer, string_2); dataAccessLayer.Close(); }
public CreateBarsHelper(BarManager barManager_1, PopupMenu popupMenu_1, IFramework iframework_1, List <ICommand> list_1, IPopuMenuWrap ipopuMenuWrap_1) { this.CreateHandle(); base.CreateControl(); this.popupMenu_0 = popupMenu_1; this.barManager_0 = barManager_1; this.iframework_0 = iframework_1; this.list_0 = list_1; this.ipopuMenuWrap_0 = ipopuMenuWrap_1; this.sysGrants_0 = new SysGrants(AppConfigInfo.UserID); }
public void Connect() { try { object obj2; object obj3; this.iworkspaceName_0.ConnectionProperties.GetAllProperties(out obj2, out obj3); this.iworkspace_0 = (this.iworkspaceName_0 as IName).Open() as IWorkspace; this.iworkspace_0.ConnectionProperties.GetAllProperties(out obj2, out obj3); if (((this.sysGrants_0 == null) && (this.iworkspace_0.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)) && ((AppConfigInfo.UserID.Length > 0) && (AppConfigInfo.UserID != "admin"))) { this.sysGrants_0 = new SysGrants(AppConfigInfo.UserID); } this.method_0(this.iworkspace_0); } catch (Exception exception) { if (exception is COMException) { switch (((uint)(exception as COMException).ErrorCode)) { case 2147751273: case 2147751169: MessageBox.Show("连接数据库失败", "连接"); return; case 2147751274: MessageBox.Show("连接数据库失败\r\n该服务器上的SDE没有启动", "连接"); return; case 2147811737: MessageBox.Show("连接的数据库服务器未启动", "连接"); return; case 2147751224: MessageBox.Show("连接的数据库服务器已暂停", "连接"); return; case 2147500037: case 2147811652: case 2147751178: MessageBox.Show("连接数据库失败", "连接"); return; } } Logger.Current.Error("", exception, ""); } }
private void btnDeleteMenu_Click(object sender, EventArgs e) { if (this.lvFunctions.SelectedItems.Count > 0) { ORGRole tag = this.lvRoles.SelectedItems[0].Tag as ORGRole; SysGrants sysGrant = new SysGrants(); for (int i = this.lvFunctions.SelectedItems.Count - 1; i >= 0; i--) { ListViewItem item = this.lvFunctions.SelectedItems[i]; MenuInfo menuInfo = item.Tag as MenuInfo; sysGrant.DeleteGrant(tag.RoleID, "Roles", menuInfo.MenuID, "gisPluge"); this.lvFunctions.Items.Remove(item); } } }
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); } } }
private void btnDeleteMenu_Click(object sender, EventArgs e) { if (this.lvFunctions.SelectedItems.Count > 0) { Staff tag = this.lvStaff.SelectedItems[0].Tag as Staff; SysGrants sysGrant = new SysGrants(); for (int i = this.lvFunctions.SelectedItems.Count - 1; i >= 0; i--) { ListViewItem item = this.lvFunctions.SelectedItems[i]; if (item.Group == this.lvFunctions.Groups[0]) { MenuInfo menuInfo = item.Tag as MenuInfo; sysGrant.DeleteGrant(tag.StaffID, "Staff", menuInfo.MenuID, "gisPluge"); } this.lvFunctions.Items.Remove(item); } } }
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); } } } }
private static void old_acctor_mc() { SketchShareEx.m_psnaper = new PointSnapper(); SketchShareEx.m_CurrentStep = 0; SketchShareEx.m_SysGrants = new SysGrants(AppConfigInfo.UserID); SketchShareEx.m_pSketchCommandFolw = new SketchCommandFlow(); SketchShareEx.IsFixLength = false; SketchShareEx.IsFixDirection = false; SketchShareEx.FixLength = 0; SketchShareEx.FixDirection = 0; SketchShareEx.StartPoint = null; SketchShareEx.LastPoint = null; SketchShareEx.IsCreateParrel = false; SketchShareEx.m_offset = 1; SketchShareEx.ConstructOffset = 5; SketchShareEx.PointCount = 0; SketchShareEx.m_pAnchorPoint = null; SketchShareEx.m_bInUse = false; SketchShareEx.m_pPointCollection = null; SketchShareEx.m_pLastPoint1 = null; SketchShareEx.m_pEndPoint1 = null; SketchShareEx.m_bShowVlaue = true; SketchShareEx.m_totalLength = 0; SketchShareEx.m_bSnapSuccessful = false; SketchShareEx.m_pSym = new SimpleMarkerSymbol(); SketchShareEx.m_pPoint = null; SketchShareEx.m_HasLicense = false; SketchShareEx.m_LastPartGeometry = null; SketchShareEx.m_bInStreaming = false; SketchShareEx.m_MinDis = 0; SketchShareEx.m_HasLicense = EditorLicenseProviderCheck.Check(); SketchShareEx.m_pSym.Style = esriSimpleMarkerStyle.esriSMSCircle; SketchShareEx.m_pSym.Size = 8; SketchShareEx.m_pSym.Outline = true; SketchShareEx.m_pSym.Color = ColorManage.GetRGBColor(0, 255, 255); }
private void ReadSYSGRANTSLayerInfo(object RoleID) { ListViewItem listViewItem; int i; DataRow item; IRow row; string str; SysGrants sysGrant = new SysGrants(); DataTable rolesObjectPri = sysGrant.GetRolesObjectPri(RoleID.ToString(), "gisLayer"); ITable table = CommonClass.OpenTable("LayerConfig"); if (table == null) { return; } int num = table.FindField("Name"); int num1 = table.FindField("FeatureClassName"); string[] privilegeDes = new string[2]; for (i = 0; i < rolesObjectPri.Rows.Count; i++) { item = rolesObjectPri.Rows[i]; try { row = table.GetRow(Convert.ToInt32(item["GRANTOBJECT"])); str = row.Value[num1].ToString(); privilegeDes[0] = row.Value[num].ToString(); privilegeDes[1] = this.PrivilegeDes[Convert.ToInt32(item["privilegeFlag"])]; listViewItem = new ListViewItem(privilegeDes) { Tag = new LayerClass(row.OID, privilegeDes[0], str, Convert.ToInt32(item["privilegeFlag"]), true, "gisLayer") }; this.lvLayers.Items.Add(listViewItem); } catch { } } table = CommonClass.OpenTable("DATASETTABLE"); if (table != null) { num = table.FindField("Name"); num1 = table.FindField("RealName"); rolesObjectPri = sysGrant.GetRolesObjectPri(RoleID.ToString(), "gisDataset"); for (i = 0; i < rolesObjectPri.Rows.Count; i++) { item = rolesObjectPri.Rows[i]; try { row = table.GetRow(Convert.ToInt32(item["GRANTOBJECT"])); str = row.Value[num1].ToString(); privilegeDes[0] = row.Value[num].ToString(); privilegeDes[1] = this.PrivilegeDes[Convert.ToInt32(item["privilegeFlag"])]; listViewItem = new ListViewItem(privilegeDes) { Tag = new LayerClass(row.OID, privilegeDes[0], str, Convert.ToInt32(item["privilegeFlag"]), true, "gisDataset") }; this.lvLayers.Items.Add(listViewItem); } catch { } } } }
private void UpdateLayerGRANTS(SysGrants sys, string userID, LayerClass layer, string newval) { int oID = layer.OID; sys.UpdateGrant(userID, "Roles", oID.ToString(), layer.DataType, newval); }