コード例 #1
0
        public static void fn會員更新點數(CMember member, int point)
        {
            string sql = $"EXEC 會員更新點數 @{CMemberKey.fMemberId},@{CMemberKey.fMoneyPoint}";
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter(CMemberKey.fMemberId, member.fMemberId),
                new SqlParameter(CMemberKey.fMoneyPoint, point)
            };

            CDbManager.executeSql(sql, paras);
        }
コード例 #2
0
        public static List <CMemberOrderSelectVM> fn會員訂單個人查詢(CMember m)
        {
            string sql = $"EXEC 訂單明細個人查詢 ";

            sql += $"@{CMemberOrderSelectVMKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter(CMemberOrderSelectVMKey.fMemberId, m.fMemberId));
            return((List <CMemberOrderSelectVM>)CDbManager.querySql(sql, paras, reader會員訂單個人查詢));
        }
コード例 #3
0
        public static List <CNotice> fn通知訊息查詢(CMember member)
        {
            string sql = $"EXEC 通知訊息查詢 ";

            sql += $"@{CMemberKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter(CNoticeKey.fMemberId, member.fMemberId));

            return((List <CNotice>)CDbManager.querySql(sql, paras, reader查詢通知訊息));
        }
コード例 #4
0
        public static List <CSetting> fn會員系統設定查詢(CMember member)
        {
            string sql = $"EXEC 系統設定查詢 ";

            sql += $"@{CMemberKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter(CSettingKey.fMemberId, member.fMemberId));

            return((List <CSetting>)CDbManager.querySql(sql, paras, reader查詢系統設定));
        }
コード例 #5
0
        public static void fn會員更新(CMember member)
        {
            string sql = $"EXEC 會員更新 ";

            sql += $"@{CMemberKey.fMemberId},";
            sql += $"@{CMemberKey.fAccount},";
            sql += $"@{CMemberKey.fPassword},";
            sql += $"@{CMemberKey.fFirstName},";
            sql += $"@{CMemberKey.fLastName},";
            sql += $"@{CMemberKey.fTheNickName},";
            sql += $"@{CMemberKey.fGender},";
            sql += $"@{CMemberKey.fBirthDay},";
            sql += $"@{CMemberKey.fTheAddress},";
            sql += $"@{CMemberKey.fMobilePhone},";
            sql += $"@{CMemberKey.fMoneyPoint},";
            sql += $"@{CMemberKey.fPhoto},";
            sql += $"@{CMemberKey.fRegisterDateTime},";
            sql += $"@{CMemberKey.fLastLoginDateTime},";
            sql += $"@{CMemberKey.fIsVIP},";
            sql += $"@{CMemberKey.fIsBanned},";
            sql += $"@{CMemberKey.fThePasswordURL}";
            //https://stackoverflow.com/questions/863374/sqlparameter-with-nullable-value-give-error-while-executenonquery
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter(CMemberKey.fMemberId, member.fMemberId),
                new SqlParameter(CMemberKey.fAccount, member.fAccount),
                new SqlParameter(CMemberKey.fPassword, member.fPassword),
                new SqlParameter(CMemberKey.fFirstName, member.fFirstName),
                new SqlParameter(CMemberKey.fLastName, member.fLastName),
                //fTheNickName可為NULL
                new SqlParameter(CMemberKey.fTheNickName, (object)member.fTheNickName ?? DBNull.Value),
                new SqlParameter(CMemberKey.fGender, member.fGender),
                new SqlParameter(CMemberKey.fBirthDay, member.fBirthDay),
                //fTheAddress可為NULL
                new SqlParameter(CMemberKey.fTheAddress, (object)member.fTheAddress ?? DBNull.Value),
                new SqlParameter(CMemberKey.fMobilePhone, member.fMobilePhone),
                new SqlParameter(CMemberKey.fMoneyPoint, member.fMoneyPoint),
                new SqlParameter(CMemberKey.fPhoto, member.fPhoto),
                new SqlParameter(CMemberKey.fRegisterDateTime, member.fRegisterDateTime),
                new SqlParameter(CMemberKey.fLastLoginDateTime, member.fLastLoginDateTime),
                new SqlParameter(CMemberKey.fIsVIP, member.fIsVIP),
                new SqlParameter(CMemberKey.fIsBanned, member.fIsBanned),
                //fThePasswordURL可為NULL
                new SqlParameter(CMemberKey.fThePasswordURL, (object)member.fThePasswordURL ?? DBNull.Value)
            };

            CDbManager.executeSql(sql, paras);
        }
コード例 #6
0
        public static CMember fn會員登入驗證(string act, string pwd)
        {
            //檢查帳號密碼是否正確
            CMember member = fn會員查詢().FirstOrDefault(m => act == m.fAccount && pwd == m.fPassword);

            if (member != null)
            {
                Console.WriteLine("登入成功!");
                Console.WriteLine("客戶ID:" + member.fMemberId);
                Console.WriteLine("客戶姓名:" + member.fFirstName + member.fLastName);
                Console.WriteLine("帳號:" + member.fAccount);
                Console.WriteLine("-----------------------------------------------------------");
            }
            else
            {
                Console.WriteLine("帳號或密碼錯誤!");
            }
            return(member);
        }
コード例 #7
0
        /// <summary>
        /// 此會員新增一筆訊息通知(小鈴鐺)
        /// </summary>
        /// <param name="member">會員</param>
        /// <param name="notice">訊息</param>
        public static void fn通知訊息新增(CMember member, CNotice notice)
        {
            string sql = $"EXEC 通知訊息新增 ";

            sql += $"@{CNoticeKey.fNoticeDatetime},";
            sql += $"@{CNoticeKey.fNoticeContent},";
            sql += $"@{CNoticeKey.fCategoryType},";
            sql += $"@{CNoticeKey.fLink},";
            sql += $"@{CMemberKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter(CNoticeKey.fNoticeDatetime, notice.fNoticeDatetime),
                new SqlParameter(CNoticeKey.fNoticeContent, notice.fNoticeContent),
                new SqlParameter(CNoticeKey.fCategoryType, notice.fCategoryType),
                new SqlParameter(CNoticeKey.fLink, notice.fLink),
                new SqlParameter(CNoticeKey.fMemberId, member.fMemberId)
            };

            CDbManager.executeSql(sql, paras);
        }
コード例 #8
0
        public static void fn會員系統設定更新(CSetting setting, CMember member)
        {
            string sql = $"EXEC 系統設定更新 ";

            sql += $"@{CSettingKey.fIsDarkMode},";
            sql += $"@{CSettingKey.fFontSize},";
            sql += $"@{CSettingKey.fFontType},";
            sql += $"@{CSettingKey.fIsFullWidth},";
            sql += $"@{CSettingKey.fIsNotice},";
            sql += $"@{CMemberKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter(CSettingKey.fIsDarkMode, setting.fIsDarkMode),
                new SqlParameter(CSettingKey.fFontSize, setting.fFontSize),
                new SqlParameter(CSettingKey.fFontType, setting.fFontType),
                new SqlParameter(CSettingKey.fIsFullWidth, setting.fIsFullWidth),
                new SqlParameter(CSettingKey.fIsNotice, setting.fIsNotice),
                new SqlParameter(CSettingKey.fMemberId, member.fMemberId)
            };

            CDbManager.executeSql(sql, paras);
        }
コード例 #9
0
        public static void fn會員系統設定新增(CMember member)
        {
            string sql = $"EXEC 系統設定新增 ";

            sql += $"@{CSettingKey.fIsDarkMode},";
            sql += $"@{CSettingKey.fFontSize},";
            sql += $"@{CSettingKey.fFontType},";
            sql += $"@{CSettingKey.fIsFullWidth},";
            sql += $"@{CSettingKey.fIsNotice},";
            sql += $"@{CMemberKey.fMemberId}";

            List <SqlParameter> paras = new List <SqlParameter>()  //同一個會員不會有兩種系統樣式,系統設定樣式寫死給預設
            {
                new SqlParameter(CSettingKey.fIsDarkMode, "false"),
                new SqlParameter(CSettingKey.fFontSize, "預設"),
                new SqlParameter(CSettingKey.fFontType, "新細明體"),
                new SqlParameter(CSettingKey.fIsFullWidth, "False"),
                new SqlParameter(CSettingKey.fIsNotice, "True"),
                new SqlParameter(CSettingKey.fMemberId, member.fMemberId)
            };

            CDbManager.executeSql(sql, paras);
        }