Esempio n. 1
0
        public static void 管理員更新(CAdmin admin)
        {
            string sql = $"EXEC 管理員更新 ";

            sql += $"@{CAdminKey.fAdminId},";
            sql += $"@{CAdminKey.fAdminAccount},";
            sql += $"@{CAdminKey.fAdminPassword},";
            sql += $"@{CAdminKey.fName},";
            sql += $"@{CAdminKey.fGender},";
            sql += $"@{CAdminKey.fBirthDay},";
            sql += $"@{CAdminKey.fTheAddress},";
            sql += $"@{CAdminKey.fMobilePhone},";
            sql += $"@{CAdminKey.fThePhoto},";
            sql += $"@{CAdminKey.fHireDateTime},";
            sql += $"@{CAdminKey.fLastLoginDateTime}";



            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter(CAdminKey.fAdminId, admin.fAdminId),
                new SqlParameter(CAdminKey.fAdminAccount, admin.fAdminAccount),
                new SqlParameter(CAdminKey.fAdminPassword, admin.fAdminPassword),
                new SqlParameter(CAdminKey.fName, admin.fName),
                new SqlParameter(CAdminKey.fGender, admin.fGender),
                new SqlParameter(CAdminKey.fBirthDay, admin.fBirthDay),
                new SqlParameter(CAdminKey.fTheAddress, (object)admin.fTheAddress ?? DBNull.Value), //可NULL
                new SqlParameter(CAdminKey.fMobilePhone, admin.fMobilePhone),
                new SqlParameter(CAdminKey.fThePhoto, (object)admin.fThePhoto ?? DBNull.Value),     //可NULL
                new SqlParameter(CAdminKey.fHireDateTime, admin.fHireDateTime),
                new SqlParameter(CAdminKey.fLastLoginDateTime, admin.fLastLoginDateTime)
            };

            CDbManager.executeSql(sql, paras);
        }
Esempio n. 2
0
        public static CAdmin fn管理員登入驗證(string act, string pwd)
        {
            //檢查帳號密碼是否正確
            CAdmin admin = fn管理員查詢().FirstOrDefault(m => act == m.fAdminAccount && pwd == m.fAdminPassword);

            if (admin != null)
            {
                Console.WriteLine("登入成功!");
                Console.WriteLine("客戶ID:" + admin.fAdminId);
                Console.WriteLine("客戶姓名:" + admin.fName);
                Console.WriteLine("帳號:" + admin.fAdminAccount);
                Console.WriteLine("-----------------------------------------------------------");
            }
            else
            {
                Console.WriteLine("帳號或密碼錯誤!");
            }
            return(admin);
        }