/// <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); }
public void GetMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string User_Name = Data["EMP_NO"].ToString(); MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); List <MESDataObject.Module.MENUS> pi = new List <MESDataObject.Module.MENUS>(); try { MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); pi = tcm.GetMenu(this.LoginUser.EMP_LEVEL, User_Name, SFCDB); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "获取菜单信息成功!"; StationReturn.Data = pi; } catch (Exception ex) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "获取菜单信息失败!"; StationReturn.Data = ex.Message.ToString(); } finally { this.DBPools["SFCDB"].Return(SFCDB); } }
/// <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> /// 刪除用戶信息 /// </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> /// 更新角色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 SelectInformation(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(); DataTable dt = GetInformation.SelectC_Userbyempno(EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); Dictionary <string, string> dic = new Dictionary <string, string>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Columns.Count; i++) { dic.Add(dt.Columns[i].ColumnName, dt.Rows[0][i].ToString()); } StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "成功取到用戶信息!"; StationReturn.Data = dic; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "無此用戶信息!"; } this.DBPools["SFCDB"].Return(SFCDB); }
/// <summary> /// 取回用戶密碼 /// </summary> public void GetPassword(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_c_user GetPassword = new MESDataObject.Module.T_c_user(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_c_user Resetrow = (MESDataObject.Module.Row_c_user)GetPassword.NewRow(); string EMP_NO = Data["EMP_NO"].ToString(); Dictionary <string, string> dic = new Dictionary <string, string>(); Resetrow = GetPassword.getC_Userbyempno(EMP_NO, SFCDB, DB_TYPE_ENUM.Oracle); if (Resetrow != null) { ///缺發送EMAIL 或者短信功能 dic.Add("EMP_PASSWORD", Resetrow.EMP_PASSWORD.ToString()); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "取回成功,密碼已發送至郵箱!"; StationReturn.Data = dic; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "無此用戶!"; } this.DBPools["SFCDB"].Return(SFCDB); }
public string GetNewLotNo(string SeqName, MESDBHelper.OleExec SFCDB) { string StrLotNo = ""; T_C_SEQNO T_C_Seqno = new T_C_SEQNO(SFCDB, DBType); StrLotNo = T_C_Seqno.GetLotno(SeqName, SFCDB); return(StrLotNo); }
//public void GetMenu(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) //{ // string User_Name = Data["EMP_NO"].ToString(); // MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); // try // { // LogicObject.Privilege lu = new LogicObject.Privilege(); // List<Privileges> pi= lu.GetMenu(User_Name, SFCDB); // StationReturn.Status = StationReturnStatusValue.Pass; // StationReturn.Message = "获取权限列表成功!!!"; // StationReturn.Data = pi; // } // catch(Exception ex) // { // StationReturn.Status = StationReturnStatusValue.Fail; // StationReturn.Message = "获取权限列表失败!!!该用户可能没有任何权限!!!"; // StationReturn.Data = ex.Message; // } // finally // { // this.DBPools["SFCDB"].Return(SFCDB); // } //} public void CreatMenuId(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); LogicObject.User lu = new LogicObject.User(); lu.CreatMenuId(Data, SFCDB, StationReturn); this.DBPools["SFCDB"].Return(SFCDB); }
public void Login(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { string EMP_NO = Data["EMP_NO"].ToString(); string PWD = Data["Password"].ToString(); string BU_NAME = Data["BU_NAME"].ToString(); DataSet res = new DataSet(); Language = Data["Language"].ToString(); MESReturnMessage.Language = Language; LoginReturn lr = new LoginReturn(); MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_c_user GetLoginUser = new MESDataObject.Module.T_c_user(SFCDB, this.DBTYPE); MESDataObject.Module.Row_c_user rcu = (Row_c_user)GetLoginUser.NewRow(); rcu = GetLoginUser.getC_Userbyempno(EMP_NO, SFCDB, this.DBTYPE); if (rcu == null) { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000010"; _DBPools["SFCDB"].Return(SFCDB); return; } c_user_info user_info = new c_user_info(); user_info = GetLoginUser.GetLoginUser(EMP_NO, SFCDB); LogicObject.User lu = new LogicObject.User(); if (PWD == rcu.EMP_PASSWORD) { lu.ID = user_info.ID; lu.FACTORY = user_info.FACTORY; lu.BU = user_info.BU_NAME; lu.EMP_NO = user_info.EMP_NO; lu.EMP_LEVEL = user_info.EMP_LEVEL; lu.DPT_NAME = user_info.DPT_NAME; string token1 = DateTime.Now.ToString("yyyyMMddHHmmss"); string token2 = rand.Next(100, 999).ToString(); char[] TokenChars = (token1 + token2).ToArray(); byte[] TokenBytes = Encoding.Default.GetBytes(TokenChars); string TokenBas64 = Convert.ToBase64String(TokenBytes); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000009"; LoginUser = lu; //lr = new LoginReturn() { Token = TokenBas64, User_ID = user.EMP_NO}; lr = new LoginReturn() { Token = TokenBas64, User_ID = LoginUser.EMP_NO, UserInfo = user_info }; } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000010"; } StationReturn.Data = lr; _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); }
/*Modify by LLF 2018-02-22 * public void Init(string StrLotNo, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType) * { * string ColoumName = "lot_no"; * DBType = _DBType; * T_R_LOT_STATUS TRWB = new T_R_LOT_STATUS(SFCDB, DBType); * T_R_LOT_DETAIL TWC = new T_R_LOT_DETAIL(SFCDB, DBType); * RLotNo = TRWB.GetByInput(StrLotNo, ColoumName, SFCDB); * SLot = RLotNo.GetDataObject(); * Rlotdetail = TWC.GetByLotID(SLot.ID, SFCDB); * Slotdetail = Rlotdetail.GetDataObject(); * } * * public void Init(string StrLotNo, MESDBHelper.OleExec SFCDB) * { * Init(StrLotNo, SFCDB, DBType); * }*/ public void Init(string StrLotNo, string StrSN, MESDBHelper.OleExec SFCDB, MESDataObject.DB_TYPE_ENUM _DBType) { string ColoumName = "lot_no"; DBType = _DBType; T_R_LOT_STATUS TRWB = new T_R_LOT_STATUS(SFCDB, DBType); T_R_LOT_DETAIL TWC = new T_R_LOT_DETAIL(SFCDB, DBType); RLotNo = TRWB.GetByInput(StrLotNo, ColoumName, SFCDB); SLot = RLotNo.GetDataObject(); Rlotdetail = TWC.GetByLotID(SLot.ID, StrSN, SFCDB); Slotdetail = Rlotdetail.GetDataObject(); }
/// <summary> ///添加角色所擁有的權限ID /// </summary> public void AddRolePrivilege(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); MESDataObject.Module.T_C_ROLE_PRIVILEGE Roler = new MESDataObject.Module.T_C_ROLE_PRIVILEGE(SFCDB, DB_TYPE_ENUM.Oracle); MESDataObject.Module.Row_C_ROLE_PRIVILEGE RoleRow = (MESDataObject.Module.Row_C_ROLE_PRIVILEGE)Roler.NewRow(); string Role_Name = Data["ROLE_NAME"].ToString(); DataTable StrRes = new DataTable(); this.DBPools["SFCDB"].Return(SFCDB); }
public static List <KPListBase> GetKPListBySkuNo(string Skuno, MESDBHelper.OleExec SFCDB) { List <KPListBase> ret = new List <KPListBase>(); T_C_KP_LIST T = new T_C_KP_LIST(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); List <string> IDS = T.GetListIDBySkuno(Skuno, SFCDB); for (int i = 0; i < IDS.Count; i++) { KPListBase I = new KPListBase(IDS[i], SFCDB); ret.Add(I); } return(ret); }
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(); } }
public static KPListBase GetKPListByListName(string ListName, MESDBHelper.OleExec SFCDB) { List <KPListBase> ret = new List <KPListBase>(); T_C_KP_LIST T = new T_C_KP_LIST(SFCDB, MESDataObject.DB_TYPE_ENUM.Oracle); //List<string> IDS = T.GetListIDBySkuno(Skuno, SFCDB); string strSql = $@"select ID from c_kp_list where listname='{ListName}'"; DataSet res = SFCDB.RunSelect(strSql); if (res.Tables[0].Rows.Count > 0) { return(new KPListBase(res.Tables[0].Rows[0]["ID"].ToString(), SFCDB)); } else { return(null); } }
/// <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(); } }
/// <summary> /// 查詢用戶信息 /// </summary> public void SelectInformation(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, this.DBTYPE); MESDataObject.Module.Row_c_user InformationRow = (MESDataObject.Module.Row_c_user)GetInformation.NewRow(); try { string EMP_NO = Data["EMP_NO"].ToString(); List <c_user_model> LoadUsetInfolsit = new List <c_user_model>(); LoadUsetInfolsit = GetInformation.SelectUserInfomation(EMP_NO, SFCDB); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Data = LoadUsetInfolsit; this.DBPools["SFCDB"].Return(SFCDB); } catch (Exception e) { this.DBPools["SFCDB"].Return(SFCDB); throw e; } }
/// <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); }
/// <summary> /// 查詢用戶角色權限 /// </summary> public void SelectUserRolePrivilege(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(); string LoginUserEmp = Data["LoginUserEmp"].ToString(); string EditEmp = Data["LoginUserEmp"].ToString(); DataTable StrRes = new DataTable(); // StrRes = UserRow.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); }
public List <MENUS> GetMenuNextID(string ColumnName, string Input, MESDBHelper.OleExec SFCDB) { string strSql = ""; strSql = $@" select ID, SYSTEM_NAME, MENU_NAME, PAGE_PATH, PARENT_CODE, SORT, STYLE_NAME, CLASS_NAME, LANGUAGE_ID, MENU_DESC from c_menu WHERE {ColumnName} = '{Input}' ORDER BY SORT "; DataSet res = SFCDB.ExecSelect(strSql); List <MENUS> Privileges = new List <MENUS>(); if (res.Tables[0].Rows.Count > 0) { foreach (DataRow item in res.Tables[0].Rows) { Privileges.Add(new MENUS { ID = item["ID"].ToString(), SYSTEM_NAME = item["SYSTEM_NAME"].ToString(), MENU_NAME = item["MENU_NAME"].ToString(), PAGE_PATH = item["PAGE_PATH"].ToString(), PARENT_CODE = item["PARENT_CODE"].ToString(), SORT = item["SORT"].ToString(), STYLE_NAME = item["STYLE_NAME"].ToString(), CLASS_NAME = item["CLASS_NAME"].ToString(), LANGUAGE_ID = item["LANGUAGE_ID"].ToString(), MENU_DESC = item["MENU_DESC"].ToString(), MENU_ITEM = GetMenuNextID(ColumnName, item["ID"].ToString(), SFCDB) }); } } return(Privileges); }
public void GetMenuInformation(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { MESDBHelper.OleExec SFCDB = _DBPools["SFCDB"].Borrow(); string m_id = Data["MenuId"].ToString(); try { MESDataObject.Module.T_C_MENU tcm = new MESDataObject.Module.T_C_MENU(SFCDB, this.DBTYPE); MESDataObject.Module.MenuInformation rcm = new MESDataObject.Module.MenuInformation(); rcm = tcm.getC_Menu(m_id, SFCDB); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.Message = "获取菜單成功!!!"; StationReturn.Data = rcm; this.DBPools["SFCDB"].Return(SFCDB); } catch { this.DBPools["SFCDB"].Return(SFCDB); StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.Message = "获取菜單失敗!"; } }
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 List <PrivilegeEditModel> GetUserRolePrivilege(string LoginUserEmp, string EditEmp, string EmpLevel, MESDBHelper.OleExec SFCDB) { string sql = string.Empty; /////9 emp_leve if (EmpLevel == "9") { sql = $@" SELECT A.ID, A.SYSTEM_NAME, A.PRIVILEGE_NAME, A.PRIVILEGE_DESC FROM C_PRIVILEGE A WHERE A.ID NOT IN (SELECT PRIVILEGE_ID FROM C_USER_PRIVILEGE WHERE USER_ID IN (SELECT ID FROM C_USER WHERE EMP_NO = '{EditEmp}')) UNION SELECT A.ID, A.SYSTEM_NAME, A.PRIVILEGE_NAME, A.PRIVILEGE_DESC FROM C_PRIVILEGE A WHERE A.ID NOT IN (SELECT Q.PRIVILEGE_ID FROM C_ROLE_PRIVILEGE Q, C_USER_ROLE W WHERE Q.ROLE_ID = W.ROLE_ID AND W.USER_ID IN (SELECT ID FROM C_USER WHERE EMP_NO = '{EditEmp}')) "; } else { sql = $@" SELECT A.ID, A.SYSTEM_NAME, A.PRIVILEGE_NAME, A.PRIVILEGE_DESC FROM C_PRIVILEGE A, C_USER B, C_USER_PRIVILEGE C WHERE C.USER_ID = B.ID AND C.PRIVILEGE_ID = A.MENU_ID AND B.EMP_NO = '{LoginUserEmp}' AND C.PRIVILEGE_ID NOT IN (SELECT PRIVILEGE_ID FROM C_USER_PRIVILEGE WHERE USER_ID IN (SELECT ID FROM C_USER WHERE EMP_NO = '{EditEmp}')) UNION SELECT A.ID, A.SYSTEM_NAME, A.PRIVILEGE_NAME, A.PRIVILEGE_DESC FROM C_PRIVILEGE A, C_USER_ROLE B, C_ROLE_PRIVILEGE C, C_USER D WHERE C.ROLE_ID = B.ROLE_ID AND A.ID = C.PRIVILEGE_ID AND D.EMP_NO = '{LoginUserEmp}' AND D.ID = B.USER_ID AND C.PRIVILEGE_ID NOT IN (SELECT Q.PRIVILEGE_ID FROM C_ROLE_PRIVILEGE Q, C_USER_ROLE W WHERE Q.ROLE_ID = W.ROLE_ID AND W.USER_ID IN (SELECT ID FROM C_USER WHERE EMP_NO = '{EditEmp}')) "; } DataSet res = SFCDB.ExecSelect(sql); List <PrivilegeEditModel> Privilegelist = new List <PrivilegeEditModel>(); if (res.Tables[0].Rows.Count > 0) { foreach (DataRow item in res.Tables[0].Rows) { Privilegelist.Add(new PrivilegeEditModel { ID = item["ID"].ToString(), SYSTEM_NAME = item["SYSTEM_NAME"].ToString(), PRIVILEGE_NAME = item["PRIVILEGE_NAME"].ToString(), PRIVILEGE_DESC = item["PRIVILEGE_DESC"].ToString() }); } } return(Privilegelist); }
public void Init(string StrLotNo, string StrSN, MESDBHelper.OleExec SFCDB) { Init(StrLotNo, StrSN, SFCDB, DBType); }
public List <MENUS> GetMenu(string emp_l, string User_No, MESDBHelper.OleExec SFCDB) { string strSql = ""; if (emp_l != "9") { #region sql1 //strSql = $@" SELECT b.ID, // b.SYSTEM_NAME, // b.MENU_NAME, // b.PAGE_PATH, // b.PARENT_CODE, // b.SORT, // b.STYLE_NAME, // b.CLASS_NAME, // b.LANGUAGE_ID, // b.MENU_DESC // FROM C_USER_PRIVILEGE a, C_menu b, c_user c // WHERE C.ID = A.USER_ID // AND A.PRIVILEGE_ID = B.ID // AND b.PARENT_CODE = '0' // AND C.EMP_NO = '{User_No}' ORDER BY SORT "; strSql = $@" SELECT B.ID, B.SYSTEM_NAME, B.MENU_NAME, B.PAGE_PATH, B.PARENT_CODE, B.SORT, B.STYLE_NAME, B.CLASS_NAME, B.LANGUAGE_ID, B.MENU_DESC FROM C_MENU B WHERE EXISTS (SELECT 1 FROM C_PRIVILEGE GH WHERE EXISTS (SELECT 1 FROM C_USER_PRIVILEGE A, C_USER C WHERE C.ID = A.USER_ID AND C.EMP_NO = '{User_No}' AND GH.ID = A.PRIVILEGE_ID UNION SELECT 1 FROM C_USER_ROLE D, C_USER E, C_ROLE_PRIVILEGE F WHERE E.ID = D.USER_ID AND F.ROLE_ID = D.ROLE_ID AND E.EMP_NO = '{User_No}' AND GH.ID = F.PRIVILEGE_ID) AND GH.MENU_ID = B.ID) AND B.PARENT_CODE = '0' ORDER BY SORT "; #endregion } else { #region sql2 strSql = @" select ID, SYSTEM_NAME, MENU_NAME, PAGE_PATH, PARENT_CODE, SORT, STYLE_NAME, CLASS_NAME, LANGUAGE_ID, MENU_DESC from c_menu WHERE PARENT_CODE = '0' ORDER BY SORT "; #endregion } DataSet res = SFCDB.ExecSelect(strSql); List <MENUS> Privileges = new List <MENUS>(); if (res.Tables[0].Rows.Count > 0) { foreach (DataRow item in res.Tables[0].Rows) { Privileges.Add(new MENUS { ID = item["ID"].ToString(), SYSTEM_NAME = item["SYSTEM_NAME"].ToString(), MENU_NAME = item["MENU_NAME"].ToString(), PAGE_PATH = item["PAGE_PATH"].ToString(), PARENT_CODE = item["PARENT_CODE"].ToString(), SORT = item["SORT"].ToString(), STYLE_NAME = item["STYLE_NAME"].ToString(), CLASS_NAME = item["CLASS_NAME"].ToString(), LANGUAGE_ID = item["LANGUAGE_ID"].ToString(), MENU_DESC = item["MENU_DESC"].ToString(), MENU_ITEM = getmenus(item["ID"].ToString(), User_No, emp_l, SFCDB) }); } } return(Privileges); }
public List <MENUS> getmenus(string PARENT_CODE, string User_No, string ul, MESDBHelper.OleExec SFCDB) { string sql = ""; if (ul != "9") { sql = $@" SELECT B.ID, B.SYSTEM_NAME, B.MENU_NAME, B.PAGE_PATH, B.PARENT_CODE, B.SORT, B.STYLE_NAME, B.CLASS_NAME, B.LANGUAGE_ID, B.MENU_DESC FROM C_MENU B WHERE EXISTS (SELECT 1 FROM C_PRIVILEGE GH WHERE EXISTS (SELECT 1 FROM C_USER_PRIVILEGE A, C_USER C WHERE C.ID = A.USER_ID AND C.EMP_NO = '{User_No}' AND GH.ID = A.PRIVILEGE_ID UNION SELECT 1 FROM C_USER_ROLE D, C_USER E, C_ROLE_PRIVILEGE F WHERE E.ID = D.USER_ID AND F.ROLE_ID = D.ROLE_ID AND E.EMP_NO = '{User_No}' AND GH.ID = F.PRIVILEGE_ID) AND GH.MENU_ID = B.ID) AND B.PARENT_CODE = '{PARENT_CODE}' ORDER BY SORT "; } else { sql = $@" SELECT ID, SYSTEM_NAME, MENU_NAME, PAGE_PATH, PARENT_CODE, SORT, STYLE_NAME, CLASS_NAME, LANGUAGE_ID, MENU_DESC FROM c_menu WHERE PARENT_CODE = '{PARENT_CODE}' ORDER BY SORT "; } DataSet res = SFCDB.ExecSelect(sql); List <MENUS> pi = new List <MENUS>(); if (res.Tables[0].Rows.Count > 0) { foreach (DataRow item in res.Tables[0].Rows) { pi.Add(new MENUS { ID = item["ID"].ToString(), SYSTEM_NAME = item["SYSTEM_NAME"].ToString(), MENU_NAME = item["MENU_NAME"].ToString(), PAGE_PATH = item["PAGE_PATH"].ToString(), PARENT_CODE = item["PARENT_CODE"].ToString(), SORT = item["SORT"].ToString(), STYLE_NAME = item["STYLE_NAME"].ToString(), CLASS_NAME = item["CLASS_NAME"].ToString(), LANGUAGE_ID = item["LANGUAGE_ID"].ToString(), MENU_DESC = item["MENU_DESC"].ToString(), MENU_ITEM = getmenus(item["ID"].ToString(), User_No, ul, SFCDB) }); } } return(pi); }
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(); } }