public string LineNotifyAccessToken_Get(string TokenID)
        {
            string SqlString = "Select Top 1 [AccessToken] From TB_LineNotifyAccessToken Where TokenID = @TokenID";
            object param     = new { TokenID = TokenID };

            return(SystemDB.DB_Action_Single <string>(str_conn, SqlString, param));
        }
Esempio n. 2
0
        public async Task <Dictionary <string, object> > BackEndSP_StockID_Update(string StockID, int status)
        {
            DynamicParameters           parameters = new DynamicParameters();
            Dictionary <string, object> result     = new Dictionary <string, object>();

            try
            {
                parameters.Add("@StockID", StockID, dbType: DbType.String);
                parameters.Add("@Status", status, dbType: DbType.Int32);

                parameters.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output);
                parameters.Add("@Msg", dbType: DbType.String, size: 500, direction: ParameterDirection.Output);

                DynamicParameters Result = await SystemDB.DB_Action_Output(str_conn, "BackEndSP_StockID_Update", parameters);

                int    code    = Result.Get <int>("@Code");
                string message = Result.Get <string>("@Msg");
                result.Add("Code", code);
                result.Add("Message", message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 取得APPKEY
        /// </summary>
        /// <param name="appid">應用程式識別碼</param>
        public string Appkey_Get(string appid)
        {
            StringBuilder SqlString = new StringBuilder("SELECT Top 1 [欄位名稱] FROM [DB名稱].[dbo].[表名] WITH (NOLOCK)");

            SqlString.Append("WHERE[條件一] ='").Append(appid).Append("'");
            return(SystemDB.DB_Action_Single <string>(str_conn, SqlString.ToString(), null));
        }
Esempio n. 4
0
        public void Dispose()
        {
            SalaryRecordManager.RemoveAll();
            AssessmentManager.RemoveAll();
            EmployeeManager.RemoveAll();
            DepartmentManager.RemoveAll();

            PostManager.RemoveAll();
            LevelManager.RemoveAll();
            PerformanceManager.RemoveAll();
            BenefitManager.RemoveAll();
            try
            {
                FileInfo file   = new FileInfo("../../TestUnint.sql");
                string   script = file.OpenText().ReadToEnd();

                SystemDB db = new SystemDB();

                db.Database.ExecuteSqlCommand(script);
            }
            catch (Exception e)
            {
                Trace.WriteLine(Model.Utility.Utility.GetExceptionMsg(e));
            }
        }
Esempio n. 5
0
        public LeaveManagerTests()
        {
            SystemDB db = new SystemDB();

            db.Database.CreateIfNotExists();

            Dispose();
        }
        public List <MainFunctionModel> MainFunction_Get()
        {
            StringBuilder SqlString = new StringBuilder(@"SELECT [MainFunctionID]
                                                            ,[MainFunctionName]
                                                            FROM [kevinSystemDB].[dbo].[MainFunctionData]");

            object param = new { };

            return(SystemDB.DB_Action_Multiple <MainFunctionModel>(str_conn, SqlString.ToString(), param));
        }
Esempio n. 7
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var user = httpContext.Session["currentUser"] as User;

            if (user == null)
            {
                httpContext.Response.Write("无权访问");
                httpContext.Response.End();

                return(false);
            }

            if (user.name == "root")
            {
                return(true);
            }
            else
            {
                var url = httpContext.Request.Path;
                if (url == null)
                {
                    return(false);
                }

                using (SystemDB db = new SystemDB())
                {
                    var role = (from e in db.roleList.Include("rightList")
                                where e.id == user.roleId
                                select e).FirstOrDefault();
                    if (role == null)
                    {
                        httpContext.Response.Write("无权访问");
                        httpContext.Response.End();

                        return(false);
                    }

                    var right = (from e in role.rightList
                                 where e.url.Contains(url)
                                 select e).FirstOrDefault();
                    if (right == null || right.authorize == "否")
                    {
                        httpContext.Response.Write("无权访问");
                        httpContext.Response.End();

                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 8
0
        public async Task <Dictionary <string, object> > APISP_Live_UserPermissionAdd(string name, string email, int status, int userlevel, int editor)
        {
            DynamicParameters           parameters = new DynamicParameters();
            Dictionary <string, object> result     = new Dictionary <string, object>();

            parameters.Add("@username", name, dbType: DbType.String);
            parameters.Add("@email", email, dbType: DbType.String);
            parameters.Add("@status", status, dbType: DbType.Int32);
            parameters.Add("@userlevel", userlevel, dbType: DbType.Int32);
            parameters.Add("@editor", editor, dbType: DbType.Int32);
            parameters.Add("@Code", dbType: DbType.Int32, size: 100, direction: ParameterDirection.Output);
            parameters.Add("@MSG", dbType: DbType.String, size: 100, direction: ParameterDirection.Output);
            DynamicParameters Result = await SystemDB.DB_Action_Output(str_conn, "APISP_Live_UserPermissionAdd", parameters);

            int    code    = parameters.Get <int>("@Code");
            string message = parameters.Get <string>("@MSG");

            result.Add("Code", code);
            result.Add("Message", message);
            return(result);
        }
Esempio n. 9
0
        public async Task <Dictionary <string, object> > BatchSP_ImportStockInfo(List <MainForceInOutInfo> MainForceInOutInfoList)
        {
            DynamicParameters           parameters = new DynamicParameters();
            Dictionary <string, object> result     = new Dictionary <string, object>();

            try
            {
                parameters.AddTable <MainForceInOutInfo>("@importTable", "TB_ImporeMainForceInOutInfo", MainForceInOutInfoList);
                parameters.Add("@Code", dbType: DbType.Int32, direction: ParameterDirection.Output);
                parameters.Add("@Msg", dbType: DbType.String, size: 500, direction: ParameterDirection.Output);
                DynamicParameters Result = await SystemDB.DB_Action_Output(str_conn, "BatchSP_ImportMainForceInOutInfo", parameters);

                int    code    = Result.Get <int>("@Code");
                string message = Result.Get <string>("@Msg");
                result.Add("Code", code);
                result.Add("Message", message);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Esempio n. 10
0
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            var user = filterContext.HttpContext.Session["currentUser"] as User;


            if (user == null)
            {
                filterContext.RequestContext.HttpContext.Response.Write("无权访问");
                filterContext.RequestContext.HttpContext.Response.End();

                return;
            }
            else if (user.name == "root")
            {
                return;
            }
            else
            {
                var    controller = filterContext.RouteData.Values["controller"];
                var    action     = filterContext.RouteData.Values["action"];
                string url        = "/" + controller.ToString() + "/" + action.ToString();

                using (SystemDB db = new SystemDB())
                {
                    var elements = from e in db.roleRightsList
                                   join r in db.rightList on e.rightId equals r.id
                                   where e.roleId == user.roleId
                                   select e;
                    if (elements.Count() <= 0)
                    {
                        filterContext.RequestContext.HttpContext.Response.Write("无权访问");
                        filterContext.RequestContext.HttpContext.Response.End();
                    }
                }
            }
        }
Esempio n. 11
0
 public SystemBiz()
 {
     m_db = new SystemDB();
 }
    void SystemTab()
    {
        if (System_DB == null)
        {
            System_DB = ScriptableObjectDatabase<SystemDB>.GetDatabase<SystemDB>(DATABASE_FOLDER_NAME, DATABASE_SYSTEM_NAME);
        }

        scrollPos = GUILayout.BeginScrollView(scrollPos, "Box", GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));

        GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
        SystemMainSection();
        SystemMusicSection();
        SystemSfxSection();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(GUILayout.ExpandHeight(true), GUILayout.Width(120));
        SystemInitialParty();
        GUILayout.EndHorizontal();

        GUILayout.EndScrollView();
    }
Esempio n. 13
0
        public List <string> SMSMessage_Send(string phoneNumber, int aid, int status, string message)
        {
            object param = new { Mobile = phoneNumber, AId = aid, Status = status, Code = message };

            return(SystemDB.DB_SPAction <string>(str_conn, "SP_MobileSendLog", param));
        }
Esempio n. 14
0
 public async Task <IEnumerable <StockIDModel> > BatchSP_StockID_StatusTrue_Get()
 {
     return(await SystemDB.DB_SPAction <StockIDModel>(str_conn, "BatchSP_StockID_StatusTrue_Get", null));
 }