Esempio n. 1
0
        public Taifex Option(Taifex TaifexItem)
        {
            try
            {
                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("http://www.taifex.com.tw/chinese/3/7_12_4_tbl.asp"));
                //以GoogleFinance為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();
                HtmlNode     tempNode;

                doc.Load(ms, Encoding.UTF8);
                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[1]/div[1]/div[1]/div[2]/table[1]/tbody[1]/tr[2]/td[1]/table[1]/tbody[1]");
                //選擇權契約
                TaifexItem.Option_Dealer_Buy   = Decimal.Parse(tempNode.SelectSingleNode(@"tr[4]/td[10]").InnerText.Replace(",", "").ToString());
                TaifexItem.Option_Dealer_Sell  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[4]/td[12]").InnerText.Replace(",", "").ToString());
                TaifexItem.Option_Dealer_Net   = Decimal.Parse(tempNode.SelectSingleNode(@"tr[4]/td[14]").InnerText.Replace(",", "").ToString());
                TaifexItem.Option_Foreign_Buy  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[6]/td[8]").InnerText.Replace(",", "").ToString());
                TaifexItem.Option_Foreign_Sell = Decimal.Parse(tempNode.SelectSingleNode(@"tr[6]/td[10]").InnerText.Replace(",", "").ToString());
                TaifexItem.Option_Foreign_Net  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[6]/td[12]").InnerText.Replace(",", "").ToString());

                doc = null;
                url = null;
                ms.Close();
                return(TaifexItem);
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 2
0
 public string LoginCheck(string UserName, string Password)
 {
     try
     {
         Members LoginMember = db.Members.Find(UserName.ToLower());
         if (LoginMember != null)
         {
             if (String.IsNullOrWhiteSpace(LoginMember.AuthCode))
             {
                 if (PasswordCheck(LoginMember, Password))
                 {
                     return("");
                 }
                 else
                 {
                     return("密碼輸入錯誤");
                 }
             }
             else
             {
                 return("此帳號尚未經過Email驗證,請去收信");
             }
         }
         else
         {
             return("無此會員帳號,請去註冊");
         }
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 3
0
 public string EmailValidate(string UserName, string AuthCode)
 {
     try
     {
         Members ValidateMember = db.Members.Find(UserName);
         string  ValidateStr    = string.Empty;
         if (ValidateMember != null)
         {
             if (ValidateMember.AuthCode == AuthCode)
             {
                 ValidateMember.AuthCode = string.Empty;
                 db.SaveChanges();
                 ValidateStr = "帳號信箱驗證成功,現在可以登入了";
             }
             else
             {
                 ValidateStr = "驗證碼錯誤,請重新確認在註冊";
             }
         }
         else
         {
             ValidateStr = "傳送資料錯誤,請重新確認或再註冊";
         }
         return(ValidateStr);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 4
0
        public List <Exchange> getExchangeList(ForPaging Paging, string Currency)
        {
            try
            {
                IQueryable <Exchange> SearchData;
                SearchData = db.Exchanges.Where(p => p.Currency.Equals(Currency));

                if (String.IsNullOrEmpty(Currency) || SearchData.Count() == 0)
                {
                    List <Exchange> nullExchange = new List <Exchange>();
                    Paging.MaxPage = 1;
                    Paging.SetRightPage();
                    return(nullExchange);
                }
                else
                {
                    Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchData.Count() / Paging.ItemNum)));
                    Paging.SetRightPage();
                    return(SearchData.OrderByDescending(p => p.QuotedDate).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList());
                }
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 5
0
        public List <CYQ> getCYQ(string Num)
        {
            try
            {
                IQueryable <CYQ> SearchData;
                bool             numIsEmpty = String.IsNullOrEmpty(Num);

                if (!numIsEmpty)
                {
                    int Id = int.Parse(Num);
                    SearchData = db.CYQs.Where(p => p.Stock_Number.Equals(Id));

                    if (SearchData.Count() == 0)
                    {
                        List <CYQ> nullCYQ = new List <CYQ>();
                        return(nullCYQ);
                    }
                    else
                    {
                        return(SearchData.ToList().OrderByDescending(p => p.Publish_Week).ToList());
                    }
                }
                else
                {
                    List <CYQ> nullCYQ = new List <CYQ>();
                    return(nullCYQ);
                }
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 6
0
        public void UpdateOil(CRB_BDI[] CRBList)
        {
            try
            {
                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("http://www.stockq.org/commodity/FUTRWOIL.php"));
                //以台灣銀行為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();
                doc.Load(ms, Encoding.UTF8);
                HtmlNode tempNode;

                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/table[1]/tr[1]/td[2]/center[3]/table[1]/center[1]/table[1]");

                // 取得匯率
                for (int i = 2; i < 12; i++)
                {
                    CRBList[i - 2].Oil = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + i.ToString() + "]/td[2]").InnerText);
                    CRBList[i + 8].Oil = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + i.ToString() + "]/td[5]").InnerText);
                }

                //清除資料
                doc = null;
                url = null;
                ms.Close();
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return;
            }
        }
Esempio n. 7
0
        public void UpdateBDI_CRB()
        {
            try
            {
                clearData("BDI", "", 0);
                CRB_BDI[] CRBList = new CRB_BDI[20];
                for (int i = 0; i < 20; i++)
                {
                    CRBList[i] = new CRB_BDI();
                }
                UpdateBDI(CRBList);
                UpdateCRB(CRBList);
                UpdateOil(CRBList);

                foreach (var item in CRBList)
                {
                    db.CRB_BDI.Add(item);
                }
                db.SaveChanges();
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return;
            }
        }
Esempio n. 8
0
        public void DeleteFile(int Id)
        {
            FileContent GetFile = db.FileContents.Find(Id);

            try
            {
                //System.IO.File.Delete(GetFile.Url);

                //Retrieve storage account from connection string.
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=uploadmvc;AccountKey=Jww05RChCYY5vL6qu3fYumb2vhVow44SGnXI1xuSK0QEEGKPKlfGW00XAo4qp3AhknzV74kbdtmJa7GFJ5g1Jw==;EndpointSuffix=core.windows.net");
                // Create the blob client.
                CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                // Retrieve reference to a previously created container.
                CloudBlobContainer container = blobClient.GetContainerReference("mvc");
                // Retrieve reference to a blob named "[要刪除的檔案名稱]".
                CloudBlockBlob blockBlob = container.GetBlockBlobReference("Upload/" + GetFile.Url.Substring(GetFile.Url.LastIndexOf("/") + 1));
                // Delete the blob.
                blockBlob.Delete();

                db.FileContents.Remove(GetFile);
                db.SaveChanges();
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return;
            }
        }
Esempio n. 9
0
 public void ClearData(string cmd)
 {
     try
     {
         if (cmd == "Monetary")
         {
             IQueryable <MonetaryAggregate> tempDataList  = db.MonetaryAggregates;
             List <MonetaryAggregate>       MonetaryItems = tempDataList.ToList();
             foreach (var item in MonetaryItems)
             {
                 db.MonetaryAggregates.Remove(item);
             }
         }
         else if (cmd == "Libor")
         {
             IQueryable <Libor> tempDataList = db.Libors;
             List <Libor>       LiborItems   = tempDataList.ToList();
             foreach (var item in LiborItems)
             {
                 db.Libors.Remove(item);
             }
         }
         db.SaveChanges();
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return;
     }
 }
Esempio n. 10
0
        public List <Exchange> getExchange()
        {
            try
            {
                List <Exchange> exchangeList = new List <Exchange>();
                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("http://rate.bot.com.tw/xrt?Lang=zh-TW"));
                //以台灣銀行為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();
                doc.Load(ms, Encoding.UTF8);
                HtmlNode tempNode;

                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[1]/main[1]/div[4]/table[1]/tbody[1]");

                // 取得匯率
                for (int num = 1; num < 9; num++)
                {
                    Exchange exchange_Temp1 = new Exchange();

                    exchange_Temp1.Currency         = tempNode.SelectSingleNode(@"tr[" + num + "]/td[1]/div[1]/div[2]").InnerText;
                    exchange_Temp1.QuotedDate       = DateTime.Parse(DateTime.Now.AddHours(8).ToString("yyyy/MM/dd hh:mm"));
                    exchange_Temp1.CashRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[2]").InnerText.ToString());
                    exchange_Temp1.CashRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[3]").InnerText.ToString());
                    exchange_Temp1.SpotRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[4]").InnerText.ToString());
                    exchange_Temp1.SpotRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[5]").InnerText.ToString());

                    exchangeList.Add(exchange_Temp1);
                }

                Exchange exchange_Temp = new Exchange();

                exchange_Temp.Currency         = tempNode.SelectSingleNode(@"tr[15]/td[1]/div[1]/div[2]").InnerText;
                exchange_Temp.QuotedDate       = DateTime.Parse(DateTime.Now.AddHours(8).ToString("yyyy/MM/dd hh:mm"));
                exchange_Temp.CashRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[15]/td[2]").InnerText.ToString());
                exchange_Temp.CashRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[15]/td[3]").InnerText.ToString());
                exchange_Temp.SpotRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[15]/td[4]").InnerText.ToString());
                exchange_Temp.SpotRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[15]/td[5]").InnerText.ToString());

                exchangeList.Add(exchange_Temp);

                //清除資料
                doc = null;
                url = null;
                ms.Close();

                return(exchangeList);
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 11
0
 public Guestbooks GetDataById(int Id)
 {
     try
     {
         return(db.Guestbooks.Find(Id));
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 12
0
 public List <Macroeconomic> getEconomic()
 {
     try
     {
         IQueryable <Macroeconomic> SearchData = db.Macroeconomics;
         return(SearchData.ToList().OrderByDescending(p => p.Publish_Date).ToList());
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 13
0
 public bool CheckUpdate(int id)
 {
     try
     {
         Guestbooks Data = db.Guestbooks.Find(id);
         return(Data != null && Data.ReplyTime == null);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(false);
     }
 }
Esempio n. 14
0
 public string Text(string stockText1, string stockText2)
 {
     try
     {
         string stockText = stockText1.Replace(stockText2, "").Replace(",", "").Trim();
         return(stockText);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 15
0
 public FileContent GetFileContent(int Id)
 {
     try
     {
         FileContent GetFile = db.FileContents.Find(Id);
         return(GetFile);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 16
0
 public List <FileContent> GetFileList(ForPaging Paging)
 {
     try
     {
         IQueryable <FileContent> SearchData = GetAllFileList(Paging);
         return(SearchData.OrderByDescending(p => p.Id).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList());
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 17
0
 public void InsertGuestbooks(Guestbooks newData)
 {
     try
     {
         newData.CreateTime = DateTime.Now.AddHours(8);
         db.Guestbooks.Add(newData);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         logger.Error(LogUtility.GetExceptionDetails(ex));
     }
 }
Esempio n. 18
0
 public bool PasswordCheck(Members CheckMember, string Password)
 {
     try
     {
         bool result = CheckMember.Password.Equals(HashPassword(Password));
         return(result);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(false);
     }
 }
Esempio n. 19
0
 public List <CRB_BDI> getCRB_BDI()
 {
     try
     {
         IQueryable <CRB_BDI> SearchData = db.CRB_BDI;
         return(SearchData.ToList().OrderByDescending(p => p.Publish_Date).ToList());
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 20
0
        public void UpdateExchange(string Currency)
        {
            try
            {
                List <Exchange> exchangeList = new List <Exchange>();
                int             nodes;
                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("http://rate.bot.com.tw/xrt/quote/l6m/" + Currency + "?Lang=zh-TW"));
                //以台灣銀行為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();
                doc.Load(ms, Encoding.UTF8);
                HtmlNode tempNode;

                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[1]/main[1]/div[4]/table[1]/tbody[1]");
                nodes    = tempNode.SelectNodes("tr").Count();

                // 取得匯率
                for (int num = 1; num < nodes; num++)
                {
                    Exchange exchange_Temp = new Exchange();

                    exchange_Temp.Currency         = Currency.ToUpper();
                    exchange_Temp.QuotedDate       = DateTime.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[1]").InnerText.ToString());
                    exchange_Temp.CashRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[3]").InnerText.ToString());
                    exchange_Temp.CashRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[4]").InnerText.ToString());
                    exchange_Temp.SpotRate_Buying  = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[5]").InnerText.ToString());
                    exchange_Temp.SpotRate_Selling = Decimal.Parse(tempNode.SelectSingleNode(@"tr[" + num + "]/td[6]").InnerText.ToString());

                    exchangeList.Add(exchange_Temp);
                }

                foreach (var item in exchangeList)
                {
                    db.Exchanges.Add(item);
                }
                db.SaveChanges();
                //清除資料
                doc = null;
                url = null;
                ms.Close();
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return;
            }
        }
Esempio n. 21
0
 public void Deleteuestbooks(int Id)
 {
     try
     {
         Guestbooks DeleteData = db.Guestbooks.Find(Id);
         db.Guestbooks.Remove(DeleteData);
         db.SaveChanges();
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return;
     }
 }
Esempio n. 22
0
 public bool AccountCheck(string Account)
 {
     try
     {
         Members Search = db.Members.Find(Account.ToLower());
         bool    result = (Search == null);
         return(result);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(false);
     }
 }
Esempio n. 23
0
        public List <RateItem> getRate()
        {
            try
            {
                List <RateItem> RateList = new List <RateItem>();

                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("http://www.cnyes.com/CentralBank/interest1.aspx?type=all"));
                //以台灣銀行為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();
                doc.Load(ms, Encoding.UTF8);
                HtmlNode tempNode;
                string[] RateOrder = new string[] { "1", "2", "3", "6", "7", "13", "15", "16", "17", "18", "19", "23" };

                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/div[6]/div[1]/div[1]/div[2]/div[2]/table[1]");

                // 取得匯率
                for (int num = 0; num < RateOrder.Count(); num++)
                {
                    RateItem Rate = new RateItem();

                    Rate.Country   = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[1]").InnerText;
                    Rate.RateName  = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[2]").InnerText;
                    Rate.Rate      = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[3]").InnerText;
                    Rate.LastRate  = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[6]").InnerText;
                    Rate.point     = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[4]").InnerText;
                    Rate.pubDate   = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[5]").InnerText;
                    Rate.Inflation = tempNode.SelectSingleNode(@"tr[" + RateOrder[num] + "]/td[7]").InnerText;

                    RateList.Add(Rate);
                }

                //清除資料
                doc = null;
                url = null;
                ms.Close();

                return(RateList);
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 24
0
        public void UpdateLibor()
        {
            try
            {
                ClearData("Libor");
                Libor LiborItem = new Libor();
                //指定來源網頁
                WebClient url = new WebClient();
                //將網頁來源資料暫存到記憶體內
                MemoryStream ms = new MemoryStream(url.DownloadData("https://ibank.firstbank.com.tw/NetBank/7/0117.html?sh=none"));
                //以GoogleFinance為範例

                // 使用預設編碼讀入 HTML
                HtmlDocument doc = new HtmlDocument();

                HtmlNode        tempNode;
                List <HtmlNode> trNode;
                doc.Load(ms, Encoding.Default);

                tempNode = doc.DocumentNode.SelectSingleNode(@"/html[1]/body[1]/table[2]");
                trNode   = tempNode.CssSelect("tr").ToList();

                for (int i = 3; i < 180; i++)
                {
                    Libor TempLibor = new Libor();

                    TempLibor.QuotedDate = DateTime.Parse(trNode[i].SelectSingleNode(@"td[1]").InnerText);
                    TempLibor.C0N        = Decimal.Parse(trNode[i].SelectSingleNode(@"td[2]").InnerText);
                    TempLibor.C1W        = Decimal.Parse(trNode[i].SelectSingleNode(@"td[3]").InnerText);
                    TempLibor.C1M        = Decimal.Parse(trNode[i].SelectSingleNode(@"td[4]").InnerText);
                    TempLibor.C3M        = Decimal.Parse(trNode[i].SelectSingleNode(@"td[5]").InnerText);
                    TempLibor.C6M        = Decimal.Parse(trNode[i].SelectSingleNode(@"td[6]").InnerText);
                    TempLibor.C12M       = Decimal.Parse(trNode[i].SelectSingleNode(@"td[7]").InnerText);

                    db.Libors.Add(TempLibor);
                }
                db.SaveChanges();

                //清除資料
                doc = null;
                url = null;
                ms.Close();
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return;
            }
        }
Esempio n. 25
0
 public void ReplyGuestbooks(Guestbooks ReplyData)
 {
     try
     {
         Guestbooks OldData = db.Guestbooks.Find(ReplyData.Id);
         OldData.Reply     = ReplyData.Reply;
         OldData.ReplyTime = DateTime.Now.AddHours(8);
         db.SaveChanges();
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return;
     }
 }
Esempio n. 26
0
        public List <Libor> getLiborList()
        {
            try
            {
                IQueryable <Libor> SearchData;
                SearchData = db.Libors;

                return(SearchData.OrderByDescending(p => p.QuotedDate).ToList());
            }
            catch (System.IO.IOException e)
            {
                logger.Error(LogUtility.GetExceptionDetails(e));
                return(null);
            }
        }
Esempio n. 27
0
 public IQueryable <Guestbooks> GetAllDataList(ForPaging Paging, string Search)
 {
     try
     {
         IQueryable <Guestbooks> Data = db.Guestbooks.Where(p => p.MembersAccount.Contains(Search) || p.Content.Contains(Search) || p.Reply.Contains(Search) || p.Members.Name.Contains(Search));
         Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count() / Paging.ItemNum)));
         Paging.SetRightPage();
         return(Data);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 28
0
 public void UpdateGuestbooks(Guestbooks UpdateData)
 {
     try
     {
         Guestbooks OldData = db.Guestbooks.Find(UpdateData.Id);
         OldData.MembersAccount = UpdateData.MembersAccount;
         OldData.Content        = UpdateData.Content;
         db.SaveChanges();
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return;
     }
 }
Esempio n. 29
0
 public IQueryable <FileContent> GetAllFileList(ForPaging Paging)
 {
     try
     {
         IQueryable <FileContent> Data = db.FileContents;
         Paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Data.Count()) / Paging.ItemNum));
         Paging.SetRightPage();
         return(Data);
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return(null);
     }
 }
Esempio n. 30
0
 public void Register(Members newMember)
 {
     try
     {
         newMember.Password = HashPassword(newMember.Password);
         newMember.Account  = newMember.Account.ToLower();
         newMember.IsAdmin  = false;
         db.Members.Add(newMember);
         db.SaveChanges();
     }
     catch (System.IO.IOException e)
     {
         logger.Error(LogUtility.GetExceptionDetails(e));
         return;
     }
 }