예제 #1
0
        public void AddNewAccInfo(AccInfo acc)//create new information of transfernce
        {
            try
            {
                if (Convert.ToInt32(acc.Amount) < 0)
                {
                    throw new Exception("Unavailable Amount");
                }
            }
            catch
            {
                throw new Exception("Unavailable Amount");
            }
            try
            {
                if (Convert.ToDateTime(acc.Date) > DateTime.Now)
                {
                    throw new Exception("Unavailable Date");
                }
            }
            catch
            {
                throw new Exception("Unavailable Date");
            }
            AccInfoC inter = new AccInfoC();

            try
            {
                inter.AddAccInfo(acc);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
예제 #2
0
        public List <AccInfo> SearchAccInfo(string bankNum, string dfrom, string dto, string category, string t_fWhom)
        {
            try
            {
                if (dfrom == "")
                {
                    dfrom = new DateTime(1900, 01, 01).ToShortDateString();
                }
                Convert.ToDateTime(dfrom);
            }
            catch
            {
                throw new Exception("Unavailable From Date");
            }
            try
            {
                if (dto == "")
                {
                    dto = DateTime.Now.ToShortDateString();
                }
                Convert.ToDateTime(dto);
            }
            catch
            {
                throw new Exception("Unavailable To Date");
            }

            AccInfoC infoC = new AccInfoC();

            return(infoC.ListBelongToBank(bankNum, dfrom, dto, category, t_fWhom));
        }
예제 #3
0
        public List <AccInfo> AccountsAIDetails(string accNum, string Dfrom, string Dto, string category, string f_twhom)
        {
            AccInfoC c = new AccInfoC();

            if (Dfrom == "")
            {
                Dfrom = "01/01/1900";
            }
            if (Dto == "")
            {
                Dto = DateTime.Now.ToShortDateString();
            }
            try
            {
                if (Convert.ToDateTime(Dfrom) > DateTime.Now)
                {
                    throw new Exception();
                }
                if (Convert.ToDateTime(Dto) > DateTime.Now)
                {
                    throw new Exception();
                }
            }
            catch
            {
                throw new Exception("Unavailable Date");
            }
            return(c.ListBelongToBank(accNum, Dfrom, Dto, category, f_twhom));
        }
예제 #4
0
        public void UpdateButton(AccInfo acc)
        {
            try
            {
                Convert.ToDouble(acc.Amount);
            }
            catch
            {
                throw new Exception("The Amount Isn't Available");
            }
            try
            {
                if (Convert.ToDateTime(acc.Date) > DateTime.Now)
                {
                    throw new Exception();
                }
            }
            catch
            {
                throw new Exception("The Date Isn't Available");
            }
            if (acc.InvoiceNum == "")
            {
                throw new Exception("The Invoice Isn't Available");
            }
            AccInfoC infoC = new AccInfoC();

            infoC.UpdateAccInfo(acc);
        }
예제 #5
0
        public List <AccInfo> SearchInfo(string date, string from, string to, string amount, string enterTB)
        {
            try
            {
                if (date != "")
                {
                    Convert.ToDateTime(date);
                }
            }
            catch
            {
                throw new Exception("The Date Isn't Available");
            }
            try
            {
                if (amount != "")
                {
                    Convert.ToDouble(amount);
                }
            }
            catch
            {
                throw new Exception("The Amount Isn't Available");
            }
            AccInfoC infoC = new AccInfoC();

            return(infoC.FilterAccInfo(date, "All", from, to, amount, enterTB));
        }
예제 #6
0
        public List <AccInfo> CategoryAIDetails(string Dfrom, string Dto, string category)
        {
            AccInfoC c = new AccInfoC();

            if (Dfrom == "")
            {
                Dfrom = "01/01/1900";
            }
            if (Dto == "")
            {
                Dto = DateTime.Now.ToShortDateString();
            }
            try
            {
                if (Convert.ToDateTime(Dfrom) > DateTime.Now)
                {
                    throw new Exception();
                }
                if (Convert.ToDateTime(Dto) > DateTime.Now)
                {
                    throw new Exception();
                }
            }
            catch
            {
                throw new Exception("Unavailable Date");
            }
            return(c.ListBelongToCategory(Dfrom, Dto, findCategoryName(category)));
        }
예제 #7
0
 public List <AccInfo> SearchListOfAccInfo(string date, string kind, string from, string to, string amount, string enterB)//return the list of information filtered by the following fields
 {
     try
     {
         bool dFlag = false;
         bool aFlag = false;
         if (date == "")
         {
             date  = DateTime.Now.ToString();
             dFlag = true;
         }
         if (Convert.ToDateTime(date) > DateTime.Now)
         {
             throw new Exception("Not Available Date");
         }
         if (from == "")
         {
             throw new Exception("The From Field Is Empty");
         }
         if (to == "")
         {
             throw new Exception("The To Field Is Empty");
         }
         if (amount == "")
         {
             aFlag  = true;
             amount = "3";
         }
         if (double.Parse(amount) < 0)
         {
             throw new Exception("Unavailable Amount");
         }
         if (dFlag)
         {
             date = "";
         }
         if (aFlag)
         {
             amount = "";
         }
         AccInfoC inter = new AccInfoC();
         return(inter.FilterAccInfo(date, kind, from, to, amount, enterB));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
예제 #8
0
        public void UpdateAccInfo(AccInfo i)
        {
            AccInfoC inter = new AccInfoC();

            inter.UpdateAccInfo(i);
        }
예제 #9
0
        public void DeleteAccInfo(int Id)
        {
            AccInfoC inter = new AccInfoC();

            inter.RemoveAccInfo(Id);
        }
예제 #10
0
        public AccInfo SelectAccInfo(int Id)//show the accInfo
        {
            AccInfoC inter = new AccInfoC();

            return(inter.FindAccInfo(Id));
        }
예제 #11
0
        public void DeleteButton(int id)
        {
            AccInfoC infoC = new AccInfoC();

            infoC.RemoveAccInfo(id);
        }