/// <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); }
/// <summary> /// 更新用戶信息 /// </summary> public void UpdateInformation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_c_user GetInformation = new MESDataObject.Module.T_c_user(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_c_user InformationRow = (MESDataObject.Module.Row_c_user)GetInformation.NewRow(); string EMP_NO = Data["EMP_NO"].ToString(); string EMP_PASSWORD = Data["EMP_PASSWORD"].ToString(); InformationRow = (MESDataObject.Module.Row_c_user)GetInformation.getC_Userbyempno(EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (InformationRow != null) { InformationRow.EMP_PASSWORD = Data["EMP_PASSWORD"].ToString(); string strRet = SFCDB.ExecSQL(InformationRow.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); }
/// <summary> /// 刪除用戶信息 /// </summary> public void DeleteInformation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_c_user GetInformation = new MESDataObject.Module.T_c_user(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_c_user InformationRow = (MESDataObject.Module.Row_c_user)GetInformation.NewRow(); string EMP_NO = ""; List <string> list = new List <string>(); for (int i = 0; i < Data["EMP_NO"].Count(s => s != null); i++) { list.Add(Data["EMP_NO"][i].ToString()); EMP_NO += "'" + Data["EMP_NO"][i].ToString() + "',"; } EMP_NO = EMP_NO.TrimEnd(','); InformationRow = (MESDataObject.Module.Row_c_user)GetInformation.getC_Userbyempno(EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (InformationRow != null) { string strRet = SFCDB.ExecSQL(InformationRow.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> /// 創建新用戶 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void CreateNewUser(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_c_user USER = new MESDataObject.Module.T_c_user(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_c_user UserRow = (MESDataObject.Module.Row_c_user)USER.NewRow(); UserRow.ID = USER.GetNewID(BU, SFCDB); UserRow.FACTORY = Data["FACTORY"].ToString(); UserRow.BU_NAME = Data["BU_NAME"].ToString(); UserRow.EMP_NO = Data["EMP_NO"].ToString(); UserRow.EMP_PASSWORD = Data["EMP_PASSWORD"].ToString(); UserRow.EMP_NAME = Data["EMP_NAME"].ToString(); UserRow.EMP_LEVEL = Data["EMP_LEVEL"].ToString(); UserRow.DPT_NAME = Data["DPT_NAME"].ToString(); UserRow.POSITION_NAME = Data["POSITION_NAME"].ToString(); UserRow.MAIL_ADDRESS = Data["MAIL_ADDRESS"].ToString(); UserRow.PHONE_NUMBER = Data["PHONE_NUMBER"].ToString(); UserRow.LOCATION = Data["LOCATION"].ToString(); UserRow.LOCK_FLAG = "N"; UserRow.AGENT_EMP_NO = Data["AGENT_EMP_NO"].ToString(); UserRow.CHANGE_PASSWORD_TIME = DateTime.Now; UserRow.EMP_DESC = Data["EMP_DESC"].ToString(); UserRow.EDIT_TIME = DateTime.Now; UserRow.EDIT_EMP = Data["EDIT_EMP"].ToString(); UserRow.EMP_EN_NAME = Data["EMP_EN_NAME"].ToString(); DataTable userstr = new DataTable(); userstr = USER.SelectC_Userbyempno(UserRow.EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (userstr.Rows.Count != 0) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "註冊失敗,已存在該用戶"; } else { string strRet = SFCDB.ExecSQL(UserRow.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); }
public void UpdateMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_MENU rcm = (MESDataObject.Module.Row_C_MENU)tcm.NewRow(); string UpdateSQL = ""; SFCDB.BeginTrain(); try { string m_name = Data["MENU_NAME"].ToString(); string m_desc = Data["MENU_DESC"].ToString(); string m_emp = Data["EDIT_EMP"].ToString(); string m_id = Data["ID"].ToString(); rcm = tcm.getC_MenubyID(m_id, SFCDB); rcm.MENU_NAME = m_name; rcm.PAGE_PATH = Data["PAGE_PATH"].ToString(); rcm.STYLE_NAME = Data["STYLE_NAME"].ToString(); rcm.CLASS_NAME = Data["CLASS_NAME"].ToString(); rcm.LANGUAGE_ID = Data["LANGUAGE_ID"].ToString(); rcm.MENU_DESC = m_desc; rcm.EDIT_TIME = DateTime.Now; rcm.EDIT_EMP = m_emp; UpdateSQL += rcm.GetUpdateString(this.DBTYPE) + ";\n"; MESDataObject.Module.T_C_PRIVILEGE tcp = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_PRIVILEGE rcp = (MESDataObject.Module.Row_C_PRIVILEGE)tcp.NewRow(); rcp = tcp.getC_PrivilegebyMenuID(m_id, SFCDB); rcp.PRIVILEGE_NAME = m_name; rcp.PRIVILEGE_DESC = m_desc; rcp.EDIT_TIME = DateTime.Now; rcp.EDIT_EMP = m_emp; UpdateSQL += rcp.GetUpdateString(this.DBTYPE) + ";\n"; SFCDB.ExecSQL("Begin\n" + UpdateSQL + "End;"); SFCDB.CommitTrain(); this.DBPools["SFCDB"].Return(SFCDB); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "编辑菜單成功!!"; } catch (Exception ex) { SFCDB.RollbackTrain(); this.DBPools["SFCDB"].Return(SFCDB); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "编辑菜單失敗!!"; StationReturn.Data = ex.Message.ToString(); } }
/// <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 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); }
public void DeletetMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_MENU rcm = (MESDataObject.Module.Row_C_MENU)tcm.NewRow(); string ID = Data["ID"].ToString(); string deleteSQL = ""; SFCDB.BeginTrain(); try { if (tcm.Check_PARENT(ID, SFCDB)) { rcm = tcm.getC_MenubyID(ID, SFCDB); deleteSQL += rcm.GetDeleteString(this.DBTYPE) + ";\n"; MESDataObject.Module.T_C_PRIVILEGE tcp = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_PRIVILEGE rcp = (MESDataObject.Module.Row_C_PRIVILEGE)tcp.NewRow(); rcp = tcp.getC_PrivilegebyMenuID(ID, SFCDB); deleteSQL += rcp.GetDeleteString(this.DBTYPE) + ";\n"; SFCDB.ExecSQL("Begin\n" + deleteSQL + "End;"); SFCDB.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "刪除菜單及其權限成功!!!"; StationReturn.Data = ID; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "要刪除的菜單存在子菜單!!不可刪除!"; } this.DBPools["SFCDB"].Return(SFCDB); } catch (Exception ex) { SFCDB.RollbackTrain(); this.DBPools["SFCDB"].Return(SFCDB); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "刪除菜單失敗!"; StationReturn.Data = ex.Message.ToString(); } }
public void OrderbyMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); string PARENTID = Data["PARENTID"].ToString(); int index = 10; string sql = ""; SFCDB.BeginTrain(); try { MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_MENU rcm = (MESDataObject.Module.Row_C_MENU)tcm.NewRow(); foreach (string item in Data["MENUIDS"]) { rcm = tcm.getC_MenubyIDandPARENT(item.Trim('\'').Trim('\"'), PARENTID, SFCDB); if (rcm != null) { rcm.SORT = index; sql += rcm.GetUpdateString(this.DBTYPE) + ";\n"; index += 10; } } SFCDB.ExecSQL("Begin\n" + sql + "End;"); SFCDB.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "排序菜单信息成功!"; this.DBPools["SFCDB"].Return(SFCDB); } catch (Exception ex) { SFCDB.RollbackTrain(); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "排序菜单信息失败!"; StationReturn.Data = ex.Message.ToString(); this.DBPools["SFCDB"].Return(SFCDB); } }
public void CreatMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_MENU rcm = (MESDataObject.Module.Row_C_MENU)tcm.NewRow(); string m_name = Data["MENU_NAME"].ToString(); string m_desc = Data["MENU_DESC"].ToString(); string m_emp = Data["EDIT_EMP"].ToString(); string PARENT_CODE = Data["PARENT_CODE"].ToString(); string UpdateSQL = ""; SFCDB.BeginTrain(); try { if (tcm.Check_MENU_NAME(m_name, SFCDB)) { string m_id = tcm.GetNewID(BU, SFCDB); Dictionary <string, string> id = new Dictionary <string, string>(); id.Add("ID", m_id); rcm.ID = m_id; rcm.SYSTEM_NAME = SystemName; rcm.MENU_NAME = m_name; rcm.PAGE_PATH = Data["PAGE_PATH"].ToString(); rcm.PARENT_CODE = PARENT_CODE; rcm.SORT = tcm.GetmaxSORT(PARENT_CODE, SFCDB); rcm.STYLE_NAME = Data["STYLE_NAME"].ToString(); rcm.CLASS_NAME = Data["CLASS_NAME"].ToString(); rcm.LANGUAGE_ID = Data["LANGUAGE_ID"].ToString(); rcm.MENU_DESC = m_desc; rcm.EDIT_TIME = DateTime.Now; rcm.EDIT_EMP = m_emp; UpdateSQL += rcm.GetInsertString(this.DBTYPE) + ";\n"; MESDataObject.Module.T_C_PRIVILEGE tcp = new MESDataObject.Module.T_C_PRIVILEGE(SFCDB, this.DBTYPE); MESDataObject.Module.Row_C_PRIVILEGE rcp = (MESDataObject.Module.Row_C_PRIVILEGE)tcp.NewRow(); rcp.ID = tcp.GetNewID(BU, SFCDB); rcp.MENU_ID = m_id; rcp.SYSTEM_NAME = SystemName; rcp.PRIVILEGE_NAME = m_name; rcp.PRIVILEGE_DESC = m_desc; rcp.EDIT_TIME = DateTime.Now; rcp.EDIT_EMP = m_emp; rcp.BASECONFIG_FLAG = "Y"; UpdateSQL += rcp.GetInsertString(this.DBTYPE) + ";\n"; SFCDB.ExecSQL("Begin\n" + UpdateSQL + "End;"); SFCDB.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "添加菜單成功!!!"; StationReturn.Data = id; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "要建立的菜單已經存在!!"; } this.DBPools["SFCDB"].Return(SFCDB); } catch (Exception ex) { this.DBPools["SFCDB"].Return(SFCDB); SFCDB.RollbackTrain(); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "建立菜單失敗!"; StationReturn.Data = ex.Message.ToString(); } }