/// <summary> /// 刪除角色ID信息 /// </summary> public void DeleteRole(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_ROLE GetRoleInformation = new MESDataObject.Module.T_C_ROLE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_ROLE RoleRow = (MESDataObject.Module.Row_C_ROLE)GetRoleInformation.NewRow(); string EMP_NO = Data["EMP_NO"].ToString(); RoleRow = (MESDataObject.Module.Row_C_ROLE)GetRoleInformation.SELECTC_Rolebyrolename(EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (RoleRow != null) { string strRet = SFCDB.ExecSQL(RoleRow.GetDeleteString(DB_TYPE_ENUM.Oracle)); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "成功刪除角色信息!"; StationReturn.Data = ""; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "無此用戶信息!"; } this.DBPools["SFCDB"].Return(SFCDB); }
/// <summary> /// 更新角色ID信息 /// </summary> public void UpdateRole(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_ROLE GetRoleInformation = new MESDataObject.Module.T_C_ROLE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_ROLE RoleRow = (MESDataObject.Module.Row_C_ROLE)GetRoleInformation.NewRow(); string ROLE_NAME = Data["ROLE_NAME"].ToString(); string ROLE_DESC = Data["ROLE_DESC"].ToString(); RoleRow = (MESDataObject.Module.Row_C_ROLE)GetRoleInformation.SELECTC_Rolebyrolename(ROLE_NAME, SFCDB, DB_TYPE_ENUM.Oracle); if (RoleRow != null) { RoleRow.ROLE_DESC = Data["ROLE_DESC"].ToString(); RoleRow.EDIT_EMP = Data["EDIT_EMP"].ToString(); RoleRow.EDIT_TIME = DateTime.Now; string strRet = SFCDB.ExecSQL(RoleRow.GetUpdateString(DB_TYPE_ENUM.Oracle)); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "成功更新角色信息!"; StationReturn.Data = ""; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "無此角色信息!"; } this.DBPools["SFCDB"].Return(SFCDB); }
public Row_C_ROLE SELECTC_Rolebyrolename(string Role_Name, OleExec DB, DB_TYPE_ENUM DBType) { string strSql; if (Role_Name == "") { strSql = $@"select * from c_role "; } else { strSql = $@"select * from c_role where Role_Name like '%{Role_Name}%' "; } DataSet res = DB.ExecSelect(strSql); if (res.Tables[0].Rows.Count > 0) { Row_C_ROLE ret = (Row_C_ROLE)NewRow(); ret.loadData(res.Tables[0].Rows[0]); return(ret); } else { return(null); } }
/// <summary> /// 創建角色ID /// </summary> public void CreateRole(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_ROLE Roler = new MESDataObject.Module.T_C_ROLE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_ROLE RoleRow = (MESDataObject.Module.Row_C_ROLE)Roler.NewRow(); string Role_Name = Data["ROLE_NAME"].ToString(); DataTable StrRes = new DataTable(); StrRes = Roler.getC_Rolebyrolename(Role_Name, SFCDB, DB_TYPE_ENUM.Oracle); if (StrRes.Rows.Count != 0) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "已存在該角色"; } else { RoleRow.ID = Roler.GetNewID(BU, SFCDB); RoleRow.SYSTEM_NAME = Data["SYSTEM_NAME"].ToString();; RoleRow.ROLE_NAME = Role_Name; RoleRow.ROLE_DESC = Data["ROLE_DESC"].ToString(); RoleRow.EDIT_TIME = DateTime.Now; RoleRow.EDIT_EMP = Data["EDIT_EMP"].ToString(); string strRet = SFCDB.ExecSQL(RoleRow.GetInsertString(DB_TYPE_ENUM.Oracle)); if (strRet == "1") { StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "創建角色成功!"; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "創建角色失敗!"; } } this.DBPools["SFCDB"].Return(SFCDB); }
/// <summary> /// 查詢角色ID /// </summary> public void SelectRole(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_ROLE Roler = new MESDataObject.Module.T_C_ROLE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_ROLE RoleRow = (MESDataObject.Module.Row_C_ROLE)Roler.NewRow(); string Role_Name = Data["ROLE_NAME"].ToString(); DataTable StrRes = new DataTable(); StrRes = Roler.getC_Rolebyrolename(Role_Name, SFCDB, DB_TYPE_ENUM.Oracle); List <c_role> rolelist = new List <c_role>(); if (StrRes.Rows.Count > 0) { foreach (DataRow item in StrRes.Rows) { rolelist.Add(new c_role { ID = item["ID"].ToString(), SYSTEM_NAME = item["SYSTEM_NAME"].ToString(), ROLE_NAME = item["ROLE_NAME"].ToString(), ROLE_DESC = item["ROLE_DESC"].ToString(), EDIT_EMP = item["EDIT_EMP"].ToString() }); } StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "角色信息"; StationReturn.Data = rolelist; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "無任何角色信息!"; } this.DBPools["SFCDB"].Return(SFCDB); }