Esempio n. 1
0
        public static List <Object> RetrieveCustomerPersoData()
        {
            try
            {
                List <Object> returnedCustomers = new List <object>();

                List <Customer> customers = CustomerDL.RetrieveCustomerPersoData();

                foreach (Customer customer in customers)
                {
                    Object customerObj = new
                    {
                        ID             = customer.ID,
                        Surname        = customer.Surname,
                        Othernames     = customer.Othernames,
                        AccountNumber  = customer.AccountNumber,
                        CardPan        = Crypter.Decrypt(System.Configuration.ConfigurationManager.AppSettings.Get("ekey"), customer.Card.CardPan),
                        CardExpiryDate = String.Format("{0:MM/yy}", Convert.ToDateTime(customer.Card.CardExpiryDate)),
                        Downloaded     = customer.Downloaded
                    };

                    returnedCustomers.Add(customerObj);
                }

                return(returnedCustomers);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public static List <Object> RetrieveCustomers()
        {
            try
            {
                List <Object> returnedCustomers = new List <object>();

                List <Customer> customers = CustomerDL.RetrieveCustomers();

                foreach (Customer customer in customers)
                {
                    Object customerObj = new
                    {
                        ID            = customer.ID,
                        Surname       = customer.Surname,
                        Othernames    = customer.Othernames,
                        AccountNumber = customer.AccountNumber,
                    };

                    returnedCustomers.Add(customerObj);
                }

                return(returnedCustomers);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 public static bool Update(Customer customer)
 {
     try
     {
         return(CustomerDL.Update(customer));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public static bool IssueCustomerCard(Customer customer, out string message)
 {
     try
     {
         return(CustomerDL.IssueCustomerCard(customer, out message));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
 public static bool ResetDownload(long[] id)
 {
     try
     {
         return(CustomerDL.UpdateStatus(id, false));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
 private static void DownloadCustomerPersoData(string persoData, long[] id)
 {
     //System.Web.HttpContext.Current.Response.Clear();
     //System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=log.txt");
     //System.Web.HttpContext.Current.Response.AppendHeader("Content-Length", persoData.Length.ToString());
     //System.Web.HttpContext.Current.Response.ContentType = "text/plain";
     //System.Web.HttpContext.Current.Response.Write(persoData);
     //System.Web.HttpContext.Current.Response.Flush();
     FileWriter.Write(persoData.ToString());
     CustomerDL.UpdateStatus(id, true);
 }
Esempio n. 7
0
        public static void ProcessCustomerPersoFile(long[] id)
        {
            try
            {
                List <Customer> customers = CustomerDL.RetrieveCustomersByID(id);

                var customerPersoData = FormatCustomerPersoDataForDownload(customers);

                DownloadCustomerPersoData(customerPersoData, id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 8
0
 public static bool Save(Customer customer, out string message)
 {
     try
     {
         if (CustomerDL.CustomerExists(customer))
         {
             message = string.Format("Customer: {0} exists already", string.Format("{0} {1}", customer.Surname, customer.Othernames));
             return(false);
         }
         else
         {
             message = string.Empty;
             return(CustomerDL.Save(customer));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }