public static CustomerPersonalInfo GetCustomerDetailsByCustomerID(int customerId, AspxCommonInfo aspxCommonObj)
 {
     try
     {
         CustomerPersonalInfo customerPersonalInfo = AspxCustomerMgntProvider.GetCustomerDetailsByCustomerID(customerId, aspxCommonObj);
         return(customerPersonalInfo);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #2
0
        public static CustomerPersonalInfo GetCustomerDetailsByCustomerID(int CustomerID, AspxCommonInfo aspxCommonObj)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPUC(aspxCommonObj);
                parameter.Add(new KeyValuePair <string, object>("@customerID", CustomerID));
                SQLHandler sqlH = new SQLHandler();

                System.Data.SqlClient.SqlDataReader drCustDetail = sqlH.ExecuteAsDataReader("[dbo].[usp_Aspx_GetCustomerDetailsByCustomerID]", parameter);

                CustomerPersonalInfo customerPersonalInfo = new CustomerPersonalInfo();
                int count = 0;
                while (drCustDetail.Read())
                {
                    if (count == 0)
                    {
                        DateTime tempDateTime;
                        int      tempInt;
                        //customerPersonalInfo.AccountCreatedIn = DateTime.TryParse(drCustDetail["CreateDate"].ToString(), out tempDateTime) ? tempDateTime : DateTime.MinValue;
                        customerPersonalInfo.AccountCreatedOn = DateTime.TryParse(drCustDetail["CreateDate"].ToString(), out tempDateTime) ? tempDateTime.ToString("HH:mm dd/MM/yyyy") : "Error retrieving data";
                        //customerPersonalInfo.ConfirmedEmail = drCustDetail["Email"].ToString();
                        customerPersonalInfo.CustomerID   = Int32.TryParse(drCustDetail["CustomerID"].ToString(), out tempInt) ? tempInt : 0;
                        customerPersonalInfo.LastLoggedIn = DateTime.TryParse(drCustDetail["LastLoginDate"].ToString(), out tempDateTime) ? tempDateTime.ToString("HH:mm dd/MM/yyyy") : "Never";
                        customerPersonalInfo.PortalID     = Int32.TryParse(drCustDetail["PortalID"].ToString(), out tempInt) ? tempInt : 0;
                        customerPersonalInfo.UserName     = drCustDetail["UserName"].ToString();

                        string strLifetimeSales = FixDouble(drCustDetail["LifetimeSales"].ToString());
                        customerPersonalInfo.LifetimeSales = strLifetimeSales;
                        string strAverageSales = FixDouble(drCustDetail["AverageSales"].ToString());
                        customerPersonalInfo.AverageSales = strAverageSales;

                        if (drCustDetail["DefaultBilling"].ToString() == "True" && drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress           = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State     = drCustDetail["saState"].ToString();

                            //Shipping address
                            customerPersonalInfo.ShippingAddress           = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State     = drCustDetail["saState"].ToString();
                        }
                        else if (drCustDetail["DefaultBilling"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress           = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State     = drCustDetail["saState"].ToString();
                        }
                        else if (drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Shipping address
                            customerPersonalInfo.ShippingAddress           = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State     = drCustDetail["saState"].ToString();
                        }
                    }
                    else
                    {
                        if (drCustDetail["DefaultBilling"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress           = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State     = drCustDetail["saState"].ToString();
                        }
                        else if (drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Shipping address
                            customerPersonalInfo.ShippingAddress           = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1  = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2  = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City      = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company   = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country   = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName  = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip       = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State     = drCustDetail["saState"].ToString();
                        }
                    }

                    count++;
                }

                return(customerPersonalInfo);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public static CustomerPersonalInfo GetCustomerDetailsByCustomerID(int CustomerID, AspxCommonInfo aspxCommonObj)
        {
            try
            {
                List<KeyValuePair<string, object>> parameter = CommonParmBuilder.GetParamSPUC(aspxCommonObj);
                parameter.Add(new KeyValuePair<string, object>("@customerID", CustomerID));
                SQLHandler sqlH = new SQLHandler();

                System.Data.SqlClient.SqlDataReader drCustDetail = sqlH.ExecuteAsDataReader("[dbo].[usp_Aspx_GetCustomerDetailsByCustomerID]", parameter);

                CustomerPersonalInfo customerPersonalInfo = new CustomerPersonalInfo();
                int count = 0;
                while (drCustDetail.Read())
                {
                    if (count == 0)
                    {
                        DateTime tempDateTime;
                        int tempInt;
                        //customerPersonalInfo.AccountCreatedIn = DateTime.TryParse(drCustDetail["CreateDate"].ToString(), out tempDateTime) ? tempDateTime : DateTime.MinValue;
                        customerPersonalInfo.AccountCreatedOn = DateTime.TryParse(drCustDetail["CreateDate"].ToString(), out tempDateTime) ? tempDateTime.ToString("HH:mm dd/MM/yyyy") : "Error retrieving data";
                        //customerPersonalInfo.ConfirmedEmail = drCustDetail["Email"].ToString();
                        customerPersonalInfo.CustomerID = Int32.TryParse(drCustDetail["CustomerID"].ToString(), out tempInt) ? tempInt : 0;
                        customerPersonalInfo.LastLoggedIn = DateTime.TryParse(drCustDetail["LastLoginDate"].ToString(), out tempDateTime) ? tempDateTime.ToString("HH:mm dd/MM/yyyy") : "Never";
                        customerPersonalInfo.PortalID = Int32.TryParse(drCustDetail["PortalID"].ToString(), out tempInt) ? tempInt : 0;
                        customerPersonalInfo.UserName = drCustDetail["UserName"].ToString();

                        string strLifetimeSales = FixDouble(drCustDetail["LifetimeSales"].ToString());
                        customerPersonalInfo.LifetimeSales = strLifetimeSales;
                        string strAverageSales = FixDouble(drCustDetail["AverageSales"].ToString());
                        customerPersonalInfo.AverageSales = strAverageSales;

                        if (drCustDetail["DefaultBilling"].ToString() == "True" && drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State = drCustDetail["saState"].ToString();

                            //Shipping address
                            customerPersonalInfo.ShippingAddress = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State = drCustDetail["saState"].ToString();

                        }
                        else if (drCustDetail["DefaultBilling"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State = drCustDetail["saState"].ToString();
                        }
                        else if (drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Shipping address
                            customerPersonalInfo.ShippingAddress = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State = drCustDetail["saState"].ToString();
                        }
                    }
                    else
                    {
                        if (drCustDetail["DefaultBilling"].ToString() == "True")
                        {
                            //Billing address
                            customerPersonalInfo.BillingAddress = new AddressInfo();
                            customerPersonalInfo.BillingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.BillingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.BillingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.BillingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.BillingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.BillingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.BillingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.BillingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.BillingAddress.State = drCustDetail["saState"].ToString();
                        }
                        else if (drCustDetail["DefaultShipping"].ToString() == "True")
                        {
                            //Shipping address
                            customerPersonalInfo.ShippingAddress = new AddressInfo();
                            customerPersonalInfo.ShippingAddress.Address1 = drCustDetail["saAddress1"].ToString();
                            customerPersonalInfo.ShippingAddress.Address2 = drCustDetail["saAddress2"].ToString();
                            customerPersonalInfo.ShippingAddress.City = drCustDetail["saCity"].ToString();
                            customerPersonalInfo.ShippingAddress.Company = drCustDetail["saCompany"].ToString();
                            customerPersonalInfo.ShippingAddress.Country = drCustDetail["saCountry"].ToString();
                            customerPersonalInfo.ShippingAddress.FirstName = drCustDetail["saFirstName"].ToString();
                            customerPersonalInfo.ShippingAddress.LastName = drCustDetail["saLastName"].ToString();
                            customerPersonalInfo.ShippingAddress.Zip = drCustDetail["saZip"].ToString();
                            customerPersonalInfo.ShippingAddress.State = drCustDetail["saState"].ToString();
                        }
                    }

                    count++;
                }

                return customerPersonalInfo;
            }
            catch (Exception e)
            {
                throw e;
            }
        }