/// <summary> /// 創建權限對應的ID /// </summary> public void CreatePrivilegeID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_PRIVILEGE RolerPrivilege = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_PRIVILEGE RolerPrivilegeRow = (MESDataObject.Module.Row_C_PRIVILEGE)RolerPrivilege.NewRow(); string PRIVILEGE_ID = Data["PRIVILEGE_ID"].ToString(); string PRIVILEGE_NAME = Data["PRIVILEGE_NAME"].ToString(); DataTable StrRes = new DataTable(); StrRes = RolerPrivilege.CheckPrivilegeID(PRIVILEGE_ID, PRIVILEGE_NAME, SFCDB, this.DBTYPE); if (StrRes.Rows.Count != 0) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "創建權限ID失敗!"; } else { RolerPrivilegeRow.ID = RolerPrivilege.GetNewID(BU, SFCDB); RolerPrivilegeRow.MENU_ID = Data["MENU_ID"].ToString(); RolerPrivilegeRow.PRIVILEGE_NAME = Data["PRIVILEGE_NAME"].ToString(); RolerPrivilegeRow.PRIVILEGE_DESC = Data["PRIVILEGE_DESC"].ToString(); RolerPrivilegeRow.EDIT_TIME = DateTime.Now; RolerPrivilegeRow.EDIT_EMP = Data["EDIT_EMP"].ToString(); string STRRES = SFCDB.ExecSQL(RolerPrivilegeRow.GetInsertString(this.DBTYPE)); if (STRRES == "1") { StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "創建權限ID成功!"; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "權限ID已存在!"; } } this.DBPools["SFCDB"].Return(SFCDB); }
/// <summary> /// 查詢權限對應的ID /// </summary> public void SelectPrivilegeID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { LoginReturn lr = new LoginReturn(); MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_PRIVILEGE RolerPrivilege = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_PRIVILEGE RolerPrivilegeRow = (MESDataObject.Module.Row_C_PRIVILEGE)RolerPrivilege.NewRow(); DataTable TablePrivilege = new DataTable(); TablePrivilege = RolerPrivilege.SelectPrivilegeID(SFCDB, DB_TYPE_ENUM.Oracle); List <Privilegesid> Privilegesid = new List <Privilegesid>(); if (TablePrivilege.Rows.Count > 0) { foreach (DataRow item in TablePrivilege.Rows) { List <string> menu = new List <string>(); Privilegesid.Add(new Privilegesid { PRIVILEGE_ID = item["PRIVILEGE_ID"].ToString(), PRIVILEGE_NAME = item["PRIVILEGE_NAME"].ToString(), PRIVILEGE_DESC = item["PRIVILEGE_DESC"].ToString() }); } } else { Privilegesid.Add(null); } StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "獲取權限目錄OK"; StationReturn.Data = Privilegesid; this.DBPools["SFCDB"].Return(SFCDB); }