Esempio n. 1
0
        public Row_c_user getC_Userbyempno(string empno, OleExec DB, DB_TYPE_ENUM DBType)
        {
            string  strSql = $@"select * from c_user where emp_no in ('{empno}') ";
            DataSet res    = DB.ExecSelect(strSql);

            if (res.Tables[0].Rows.Count > 0)
            {
                Row_c_user ret = (Row_c_user)NewRow();
                ret.loadData(res.Tables[0].Rows[0]);
                return(ret);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <summary>
        /// 加載所有用戶列表
        /// </summary>
        public void LoadInformation(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 r         = Data["PageRow"].ToString() == "" ? "10" : Data["PageRow"].ToString();
            string i         = Data["PageCount"].ToString() == "" ? "1" : Data["PageCount"].ToString();
            int    PageRow   = Convert.ToInt32(r == "0" ? "10" : r);
            int    PageCount = Convert.ToInt32(i == "0" ? "1" : i);
            string emp_no    = Data["emp_no"].ToString();

            string strSql = $@"select * from c_user order by  edit_time  ";

            System.Data.DataSet res = SFCDB.ExecSelect(strSql);

            int MaxPage = res.Tables[0].Rows.Count / PageRow + 1;

            if (MaxPage >= PageCount)
            {
                DataTable dt = GetInformation.SelectC_User(PageRow, PageCount, emp_no, SFCDB, DB_TYPE_ENUM.Oracle);

                if (dt.Rows.Count > 0)
                {
                    List <c_user_model> lsit = new List <c_user_model>();
                    foreach (DataRow item in dt.Rows)
                    {
                        lsit.Add(new c_user_model
                        {
                            ID            = item["ID"].ToString(),
                            FACTORY       = item["FACTORY"].ToString(),
                            BU_NAME       = item["BU_NAME"].ToString(),
                            EMP_NO        = item["EMP_NO"].ToString(),
                            EMP_NAME      = item["EMP_NAME"].ToString(),
                            EMP_PASSWORD  = item["EMP_PASSWORD"].ToString(),
                            EMP_LEVEL     = item["EMP_LEVEL"].ToString(),
                            DPT_NAME      = item["DPT_NAME"].ToString(),
                            POSITION_NAME = item["POSITION_NAME"].ToString(),
                            MAIL_ADDRESS  = item["MAIL_ADDRESS"].ToString(),
                            PHONE_NUMBER  = item["PHONE_NUMBER"].ToString(),
                            LOCATION      = item["LOCATION"].ToString(),
                            LOCK_FLAG     = item["LOCK_FLAG"].ToString(),
                            AGENT_EMP_NO  = item["AGENT_EMP_NO"].ToString(),
                            EMP_DESC      = item["EMP_DESC"].ToString(),
                            EDIT_EMP      = item["EDIT_EMP"].ToString(),
                            EMP_EN_NAME   = item["EMP_EN_NAME"].ToString()
                        });
                    }
                    StationReturn.Status  = StationReturnStatusValue.Pass;
                    StationReturn.Message = "成功取到用戶信息!";
                    StationReturn.Data    = lsit;
                }
                else
                {
                    StationReturn.Status  = StationReturnStatusValue.Fail;
                    StationReturn.Message = "無此用戶信息!";
                }
            }
            else
            {
                StationReturn.Status  = StationReturnStatusValue.Fail;
                StationReturn.Message = "所需分頁數(" + PageCount + ")大於最大分頁(" + MaxPage + ")";
            }

            this.DBPools["SFCDB"].Return(SFCDB);
        }