Пример #1
0
        public bool ValidateUser(string activationToken)
        {
            bool IsValid;
            var result = BusinessLogic.GetTempUserDetails(activationToken);
            DateTime now = DateTime.Now;
            TimeSpan weekSpan = now.AddDays(7) - now;

             DateTime ValidDate=DateTime.Now.Subtract(weekSpan);

               if (result == null || result.Tables[0].Rows.Count == 0)
            {
               IsValid = false;
               }
               else if  (result.Tables[0].Rows[0]["ActivationToken"].ToString() == activationToken && (DateTime)result.Tables[0].Rows[0]["CreatedDate"] >= ValidDate)
                {

                CustomerDetails newCustomer = new CustomerDetails();

                newCustomer.Email = result.Tables[0].Rows[0]["Email"].ToString();
                newCustomer.Password = result.Tables[0].Rows[0]["Password"].ToString();
                newCustomer.FirstName = result.Tables[0].Rows[0]["FirstName"].ToString();
                newCustomer.LastName = result.Tables[0].Rows[0]["LastName"].ToString();
                newCustomer.DateOfBirth = (DateTime)result.Tables[0].Rows[0]["DateOfBirth"];
                newCustomer.Gender = result.Tables[0].Rows[0]["Gender"].ToString();
                newCustomer.PhoneNumber = result.Tables[0].Rows[0]["Phone"].ToString();
                newCustomer.Image = (byte[])result.Tables[0].Rows[0]["UserImage"];

                bool result1 = BusinessLogic.CreateNewCustomer(newCustomer);
                if (result1)
                    {
                        int count = BusinessLogic.DeleteTempUserDetails(activationToken);
                        IsValid = true;
                    }
                else
                    {
                        IsValid = false;
                    }

                }
            else
            {
                //String message = "Validation Expire";
                IsValid = false;

            }

            return IsValid;
        }
        public CustomerDetailsResponse Get(CustomerDetails request)
        {
            var customer = Db.IdOrDefault<Customer>(request.Id);
            if (customer == null)
                throw new HttpError(HttpStatusCode.NotFound, new ArgumentException("Customer does not exist: " + request.Id));

            using (var ordersService = base.ResolveService<OrdersService>())
            {
                var ordersResponse = ordersService.Get(new Orders { CustomerId = customer.Id });

                return new CustomerDetailsResponse {
                    Customer = customer,
                    CustomerOrders = ordersResponse.Results,
                };
            }
        }
Пример #3
0
        protected void btnSignUp_Click(object sender, EventArgs e)
        {
            if (cbTermCondition.Checked == false)
            //if (!Isvalididate())
            {
                CheckBoxRequired.IsValid = false;
                return;
            }
            if (!signUpValidation.ShowMessageBox)
            {
                Guid userGuid1 = Guid.NewGuid();
                String userGuid = userGuid1.ToString();
                if (!SendEmail1(userGuid))
                {
                    return;
                }
                CustomerDetails newCustomer = new CustomerDetails();
                //TODO: use calendar control
                newCustomer.DateOfBirth = DateTime.Parse(GetSelectedDoB());
                newCustomer.Email = txtEmail.Text;
                newCustomer.FirstName = txtFirstName.Text;
                newCustomer.LastName = txtLastName.Text;
                newCustomer.Password = txtPassword.Text;
                // newCustomer.PhoneNumber = txtPhoneNumber.Text;
                newCustomer.PhoneNumber = txtPhNumberPart1.Text ;
                newCustomer.Gender = rbtnMale.Checked ? "M" : "F";
                //if (ImageUpload.PostedFile != null)
                //{
                //    int len = ImageUpload.PostedFile.ContentLength;
                //    byte[] pic = new byte[len];
                //    ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                //    newCustomer.Image = pic;
                //}
                newCustomer.ActivationToken = userGuid.ToString();
                newCustomer.CreatedDate = DateTime.Now;

                bool result = BusinessLogic.CreateNewTempCustomer(newCustomer);
                if (result)
                {
                    Response.Redirect("~/CPA/VerifyEmail.aspx?Email=" + txtEmail.Text);
                }
            }
        }
Пример #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!Isvalididate())
                return;
            CustomerDetails customer = new CustomerDetails();
            //TODO: use calendar control
            customer.UserID = Session["userID"].ToString();
            //customer.UserID = "3";
            customer.Email = txtEmail.Text;
            customer.FirstName = txtFirstName.Text;
            customer.LastName = txtLastName.Text;

            customer.DateOfBirth = DateTime.Parse(txtDateOfBirth.Text);
            customer.Gender = rbtnMale.Checked ? "M" : "F";
            customer.PhoneNumber = txtPhNumberPart1.Text ;
            if (ImageUpload.HasFile)
            {
                int len = ImageUpload.PostedFile.ContentLength;
                byte[] pic = new byte[len];
                ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                customer.Image = pic;

            }
            else
            {
                customer.Image = BusinessLogic.GetUserImage(int.Parse(Session["userID"].ToString()));
            }
            if(customer.Image == null)
            {
                customer.Image = new byte[0];
            }
             bool result=BusinessLogic.UpdateCustomerDetails(customer);

             if (result)
             {
                Session["userName"] = txtFirstName.Text;
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "Account Details", "alert('Your account details has been updated successfully!');", true);
                RefreshUserProfile();
             }
        }
Пример #5
0
        public int CreateNewCustomer(string Emailormobile, string password)
        {
            CustomerDetails cd = new CustomerDetails();

            cd.CustEmail  = Emailormobile;
            cd.Password   = password;
            cd.IsActive   = true;
            cd.IsDelete   = false;
            cd.IsUpdate   = false;
            cd.InsertDate = DateTime.Now;
            cd.LMDDate    = DateTime.Now;
            cd.role       = 4;
            db.CustomerDetails.Add(cd);
            db.SaveChanges();
            System.Text.RegularExpressions.Regex expr = new Regex(@"^\d{10}$");
            if (expr.IsMatch(Emailormobile))
            {
                //Your authentication key
                string authKey = "144054A8Is1H8TDV58be6289";
                //Multiple mobiles numbers separated by comma
                string mobileNumber = Emailormobile;
                //Sender ID,While using route4 sender id should be 6 characters long.
                string senderId = "SHPLOL";
                //Your message to send, Add URL encoding here.
                int    _min    = 1000;
                int    _max    = 9999;
                Random _rdm    = new Random();
                int    rnum    = _rdm.Next(_min, _max);
                string message = HttpUtility.UrlEncode("Livingstud.com : Registration Thank you " + Emailormobile + " For Registring with us . Please Continue Shopping with us http://www.Livingstud.com");

                //Prepare you post parameters
                StringBuilder sbPostData = new StringBuilder();
                sbPostData.AppendFormat("authkey={0}", authKey);
                sbPostData.AppendFormat("&mobiles={0}", mobileNumber);
                sbPostData.AppendFormat("&message={0}", message);
                sbPostData.AppendFormat("&sender={0}", senderId);
                sbPostData.AppendFormat("&route={0}", "4");

                try
                {
                    //Call Send SMS API
                    string sendSMSUri = "http://api.msg91.com/api/sendhttp.php";
                    //Create HTTPWebrequest
                    HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri);
                    //Prepare and Add URL Encoded data
                    UTF8Encoding encoding = new UTF8Encoding();
                    byte[]       data     = encoding.GetBytes(sbPostData.ToString());
                    //Specify post method
                    httpWReq.Method        = "POST";
                    httpWReq.ContentType   = "application/x-www-form-urlencoded";
                    httpWReq.ContentLength = data.Length;
                    using (Stream stream = httpWReq.GetRequestStream())
                    {
                        stream.Write(data, 0, data.Length);
                    }
                    //Get the response
                    HttpWebResponse response       = (HttpWebResponse)httpWReq.GetResponse();
                    StreamReader    reader         = new StreamReader(response.GetResponseStream());
                    string          responseString = reader.ReadToEnd();

                    //Close the response
                    reader.Close();
                    response.Close();
                }
                catch (SystemException ex)
                {
                }
            }
            else
            {
                try
                {
                    using (MailMessage mail = new MailMessage())
                    {
                        mail.From = new MailAddress("*****@*****.**");
                        mail.To.Add(Emailormobile);
                        mail.Subject = "Livingstud.com : Registration";

                        mail.Body       = "Livingstud.com : Registration Thank you " + Emailormobile + " For Registring with us . Please Continue Shopping with us http://www.Livingstud.com";
                        mail.IsBodyHtml = true;
                        //  mail.Attachments.Add(new Attachment("C:\\file.zip"));
                        using (SmtpClient smtp = new SmtpClient())//465 //587
                        {
                            smtp.EnableSsl             = true;
                            smtp.UseDefaultCredentials = false;
                            smtp.Credentials           = new NetworkCredential("*****@*****.**", "nayananm291193");
                            smtp.Host           = "smtp.gmail.com";
                            smtp.Port           = 587;
                            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                            smtp.Send(mail);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }

            int lastCustId = cd.CustID;

            Session["CustId"] = lastCustId;



            return(lastCustId);
        }
Пример #6
0
        private static Persistence.EntityFramework.Entities.Customer Map(Persistence.EntityFramework.Entities.Customer customerDb, CustomerDetails modelCustomer)
        {
            customerDb.FullName   = modelCustomer.FullName;
            customerDb.Title      = modelCustomer.Title;
            customerDb.Address    = modelCustomer.Address;
            customerDb.City       = modelCustomer.City;
            customerDb.Country    = modelCustomer.Country;
            customerDb.Fax        = modelCustomer.Fax;
            customerDb.HomePhone  = modelCustomer.HomePhone;
            customerDb.PostalCode = modelCustomer.PostalCode;
            customerDb.Region     = modelCustomer.Region;

            return(customerDb);
        }
Пример #7
0
 public void AddCustomer(CustomerDetails customerDetails)
 {
     dbContext.CustomerDetails.Add(customerDetails);
     dbContext.SaveChanges();
 }
 protected virtual void Dispose(bool isdisposable)
 {
     CustomerDetails.Clear();
     CustomerDetails1.Clear();
 }
Пример #9
0
        public async Task <string> SendEmailNotification(int CustomerID, int OrderID, IConfiguration _configuration)
        {
            string status = string.Empty;

            try
            {
                ConfigDataAccess _configAccess = new ConfigDataAccess(_configuration);

                BuddyDataAccess _buddyAccess = new BuddyDataAccess();

                CommonDataAccess _commonAccess = new CommonDataAccess(_configuration);

                DatabaseResponse templateResponse = await _configAccess.GetEmailNotificationTemplate(NotificationEvent.OrderSuccess.ToString());

                LogInfo.Information("Email Customer : " + CustomerID);

                // Get Customer Data from CustomerID for email and Name
                CustomerDetails customer = await _commonAccess.GetCustomerDetailByOrder(CustomerID, OrderID);

                LogInfo.Information("Email Customer data : " + JsonConvert.SerializeObject(customer));

                if (customer != null && !string.IsNullOrEmpty(customer.DeliveryEmail))
                {
                    StringBuilder orderedNumbersSb = new StringBuilder();

                    StringBuilder deliveryAddressSb = new StringBuilder();

                    orderedNumbersSb.Append("<table width='100%'>");

                    int counter = 0;

                    foreach (OrderNumber number in customer.OrderedNumbers)
                    {
                        if (counter > 0)
                        {
                            orderedNumbersSb.Append("<tr><td width='100%' colspan='3'> </td></tr>");
                        }
                        orderedNumbersSb.Append("<tr><td width='25%'>MobileNumber :<td width='20%'>");
                        orderedNumbersSb.Append(number.MobileNumber);
                        orderedNumbersSb.Append("</td><td width ='55%'></td></tr>");
                        orderedNumbersSb.Append("<tr><td width='25%'>Plan :<td width='20%'>");
                        orderedNumbersSb.Append(number.PlanMarketingName);
                        orderedNumbersSb.Append("</td><td width ='55%'>");
                        orderedNumbersSb.Append(number.PricingDescription);
                        orderedNumbersSb.Append("</td></tr> ");
                        counter++;
                    }

                    orderedNumbersSb.Append("</table>");

                    if (!string.IsNullOrEmpty(customer.ShippingBuildingNumber))
                    {
                        deliveryAddressSb.Append(customer.ShippingBuildingNumber);
                    }

                    if (!string.IsNullOrEmpty(customer.ShippingStreetName))
                    {
                        if (deliveryAddressSb.ToString() != "")
                        {
                            deliveryAddressSb.Append(" ");
                        }

                        deliveryAddressSb.Append(customer.ShippingStreetName);
                    }

                    deliveryAddressSb.Append("<br />");

                    StringBuilder shippingAddr2 = new StringBuilder();

                    if (!string.IsNullOrEmpty(customer.ShippingFloor))
                    {
                        shippingAddr2.Append(customer.ShippingFloor);
                    }

                    if (!string.IsNullOrEmpty(customer.ShippingUnit))
                    {
                        if (shippingAddr2.ToString() != "")
                        {
                            shippingAddr2.Append(" ");
                        }
                        shippingAddr2.Append(customer.ShippingUnit);
                    }

                    if (!string.IsNullOrEmpty(customer.ShippingBuildingName))
                    {
                        if (shippingAddr2.ToString() != "")
                        {
                            shippingAddr2.Append(" ");
                        }

                        shippingAddr2.Append(customer.ShippingBuildingName);
                    }

                    deliveryAddressSb.Append(shippingAddr2.ToString());

                    deliveryAddressSb.Append("<br />");

                    if (!string.IsNullOrEmpty(customer.ShippingPostCode))
                    {
                        deliveryAddressSb.Append(customer.ShippingPostCode);
                    }

                    string deliveryDate = customer.SlotDate.ToString("dd MMM yyyy") + " " + new DateTime(customer.SlotFromTime.Ticks).ToString("hh:mm tt")
                                          + " to " + new DateTime(customer.SlotToTime.Ticks).ToString("hh:mm tt");

                    var notificationMessage = MessageHelper.GetMessage(customer.ToEmailList, customer.Name,

                                                                       NotificationEvent.OrderSuccess.ToString(),

                                                                       ((EmailTemplate)templateResponse.Results).TemplateName, _configuration, customer.DeliveryEmail,
                                                                       customer.OrderNumber, orderedNumbersSb.ToString(), deliveryAddressSb.ToString(),
                                                                       customer.AlternateRecipientName == null ? customer.Name : customer.AlternateRecipientName,
                                                                       customer.AlternateRecipientContact == null ? customer.ShippingContactNumber : customer.AlternateRecipientContact,
                                                                       string.IsNullOrEmpty(customer.AlternateRecipientEmail) ? customer.DeliveryEmail : customer.AlternateRecipientEmail,
                                                                       deliveryDate, customer.ReferralCode);

                    DatabaseResponse notificationResponse = await _configAccess.GetConfiguration(ConfiType.Notification.ToString());

                    MiscHelper parser = new MiscHelper();

                    var notificationConfig = parser.GetNotificationConfig((List <Dictionary <string, string> >)notificationResponse.Results);

                    LogInfo.Information("Email Message to send  " + JsonConvert.SerializeObject(notificationResponse));

                    Publisher orderSuccessNotificationPublisher = new Publisher(_configuration, notificationConfig.SNSTopic);

                    try
                    {
                        status = await orderSuccessNotificationPublisher.PublishAsync(notificationMessage);
                    }
                    catch (Exception ex)
                    {
                        LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical) + "publishing :" + status);
                        throw ex;
                    }

                    LogInfo.Information("Email send status : " + status + " " + JsonConvert.SerializeObject(notificationMessage));

                    status = await SendOrderSuccessSMSNotification(customer, _configuration);

                    try
                    {
                        DatabaseResponse notificationLogResponse = await _configAccess.CreateEMailNotificationLogForDevPurpose(
                            new NotificationLogForDevPurpose
                        {
                            EventType = NotificationEvent.OrderSuccess.ToString(),
                            Message   = JsonConvert.SerializeObject(notificationMessage)
                        });
                    }
                    catch (Exception ex)
                    {
                        LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical) + "Email send:" + OrderID);
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical) + "OrderID:" + OrderID);
                throw ex;
            }

            return(status);
        }
 public static CustomerDetails GetCustomerDetail(int id)
 {
     return(CustomerDetails.GetCustomerDetail(id));
 }
Пример #11
0
 public void AddCustomer(CustomerDetails customerDetails)
 {
     _dataAccess.AddCustomer(customerDetails);
 }
Пример #12
0
            /// <summary>
            /// Post process payment (used by payment gateways that require redirecting to a third-party URL)
            /// </summary>
            /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param>
            public void PostProcessPaymentDistributedOrder(PostProcessTransactionPaymentRequest postProcessPaymentRequest)
            {

                PGResponse objPGResponse = new PGResponse();
                CustomerDetails oCustomer = new CustomerDetails();
                SessionDetail oSession = new SessionDetail();
                AirLineTransaction oAirLine = new AirLineTransaction();
                MerchanDise oMerchanDise = new MerchanDise();

                SFA.CardInfo objCardInfo = new SFA.CardInfo();

                SFA.Merchant objMerchant = new SFA.Merchant();

                ShipToAddress objShipToAddress = new ShipToAddress();
                BillToAddress oBillToAddress = new BillToAddress();
                ShipToAddress oShipToAddress = new ShipToAddress();
                MPIData objMPI = new MPIData();
                PGReserveData oPGreservData = new PGReserveData();
                Address oHomeAddress = new Address();
                Address oOfficeAddress = new Address();
                // For getting unique MerchantTxnID 
                // Only for testing purpose. 
                // In actual scenario the merchant has to pass his transactionID
                DateTime oldTime = new DateTime(1970, 01, 01, 00, 00, 00);
                DateTime currentTime = DateTime.Now;
                TimeSpan structTimespan = currentTime - oldTime;
                string lMrtTxnID = ((long)structTimespan.TotalMilliseconds).ToString();
                var merchantId = _EmiPaymentSettings.MerchantId.ToString();
                var orderId = postProcessPaymentRequest.CurrentOrderTransaction.TransactionId;
                var Id = orderId.ToString();
                var amount = postProcessPaymentRequest.CurrentOrderTransaction.TransactionAmount.ToString(new CultureInfo("en-US", false).NumberFormat);


                //Setting Merchant Details
                objMerchant.setMerchantDetails(merchantId, merchantId, merchantId, "", lMrtTxnID, Id, "https://www.laorigin.com/PaymentEmi/ReturnDistributedOrder?orderId=" + Id, "POST", "INR", "INV123", "req.Sale", amount, "GMT+05:30", "ASP.NET64", "true", "ASP.NET64", "ASP.NET64", "ASP.NET64");

                // Setting BillToAddress Details
                oBillToAddress.setAddressDetails(postProcessPaymentRequest.Order.CustomerId.ToString(),
                                                   postProcessPaymentRequest.Order.Customer.SystemName,
                                                postProcessPaymentRequest.Order.BillingAddress.Address1,
                                                 postProcessPaymentRequest.Order.BillingAddress.Address2,
                                                 "",
                                                  postProcessPaymentRequest.Order.BillingAddress.City,
                                                 postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name
                                                 , postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                                 postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                                  postProcessPaymentRequest.Order.Customer.Email);

                // Setting ShipToAddress Details
                oShipToAddress.setAddressDetails(postProcessPaymentRequest.Order.BillingAddress.Address1,
                                                postProcessPaymentRequest.Order.BillingAddress.Address2,
                                                "",
                                                postProcessPaymentRequest.Order.BillingAddress.City,
                                                postProcessPaymentRequest.Order.BillingAddress.StateProvince.Name,

                                                postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode,
                                                postProcessPaymentRequest.Order.BillingAddress.Country.Name,
                                                postProcessPaymentRequest.Order.Customer.Email);

                //Setting MPI datails.
                //objMPI.setMPIRequestDetails ("1000","INR10.00","356","2","2 shirts","","","","0","","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");

                // Setting Name home/office Address Details 
                // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
                oHomeAddress.setAddressDetails("2Sandeep", "Uttam Corner", "Chinchwad", "Pune", "state", "4385435873", "IND", "*****@*****.**");

                // Order of Parameters =>        AddLine1, AddLine2,      AddLine3,   City,   State ,  Zip,          Country, Email id
                oOfficeAddress.setAddressDetails("2Opus", "MayFairTowers", "Wakdewadi", "Pune", "state", "4385435873", "IND", "*****@*****.**");

                // Stting  Customer Details 
                // Order of Parameters =>  First Name,LastName ,Office Address Object,Home Address Object,Mobile No,RegistrationDate, flag for matching bill to address and ship to address 
                oCustomer.setCustomerDetails(postProcessPaymentRequest.Order.Customer.SystemName, "", oOfficeAddress, oHomeAddress, "", "13-06-2007", "Y");

                //Setting Merchant Dise Details 
                // Order of Parameters =>       Item Purchased,Quantity,Brand,ModelNumber,Buyers Name,flag value for matching CardName and BuyerName
                oMerchanDise.setMerchanDiseDetails("Computer", "2", "Intel", "P4", "Sandeep Patil", "Y");

                //Setting  Session Details        
                // Order of Parameters =>     Remote Address, Cookies Value            Browser Country,Browser Local Language,Browser Local Lang Variant,Browser User Agent'
                oSession.setSessionDetails(getRemoteAddr(), getSecureCookie(HttpContext.Current.Request), "", HttpContext.Current.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"], "", HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"]);

                //Settingr AirLine Transaction Details  
                //Order of Parameters =>               Booking Date,FlightDate,Flight   Time,Flight Number,Passenger Name,Number Of Tickets,flag for matching card name and customer name,PNR,sector from,sector to'
                oAirLine.setAirLineTransactionDetails("10-06-2007", "22-06-2007", "13:20", "119", "Sandeep", "1", "Y", "25c", "Pune", "Mumbai");

                SFAClient objSFAClient = new SFAClient("c:\\inetpub\\wwwroot\\SFAClient\\Config\\");
                objPGResponse = objSFAClient.postSSL(objMPI, objMerchant, oBillToAddress, oShipToAddress, oPGreservData, oCustomer, oSession, oAirLine, oMerchanDise);

                if (objPGResponse.RedirectionUrl != "" & objPGResponse.RedirectionUrl != null)
                {
                    string strResponseURL = objPGResponse.RedirectionUrl;
                    HttpContext.Current.Response.Redirect(strResponseURL);
                }
                else
                {
                    HttpContext.Current.Response.Write("Response Code:" + objPGResponse.RespCode);
                    HttpContext.Current.Response.Write("Response message:" + objPGResponse.RespMessage);
                }
            }
        public bool ValidateUser(string activationToken)
        {
            bool IsValid;
            var result = BusinessLogic.GetTempUserDetails(activationToken);
            DateTime now = DateTime.Now;
            TimeSpan weekSpan = now.AddDays(7) - now;

             DateTime ValidDate=DateTime.Now.Subtract(weekSpan);

               if (result == null || result.Tables[0].Rows.Count == 0)
            {
               IsValid = false;
               }
               else if  (result.Tables[0].Rows[0]["ActivationToken"].ToString() == activationToken && (DateTime)result.Tables[0].Rows[0]["CreatedDate"] >= ValidDate)
                {

                CustomerDetails newCustomer = new CustomerDetails();

                newCustomer.Email = result.Tables[0].Rows[0]["Email"].ToString();
                newCustomer.Password = result.Tables[0].Rows[0]["Password"].ToString();
                newCustomer.FirstName = result.Tables[0].Rows[0]["FirstName"].ToString();
                newCustomer.LastName = result.Tables[0].Rows[0]["LastName"].ToString();
                newCustomer.DateOfBirth = (DateTime)result.Tables[0].Rows[0]["DateOfBirth"];
                newCustomer.Gender = result.Tables[0].Rows[0]["Gender"].ToString();
                newCustomer.PhoneNumber = result.Tables[0].Rows[0]["Phone"].ToString();
                newCustomer.Image = (byte[])result.Tables[0].Rows[0]["UserImage"];

                bool result1 = BusinessLogic.CreateNewCustomer(newCustomer);
                if (result1)
                    {
                        int count = BusinessLogic.DeleteTempUserDetails(activationToken);

                        //    string user;
                        //    Session["roleID"] = 1;
                        //    if ((user = BusinessLogic.GetLoggedInUserName(txtEmail.Text, txtPassword.Text)) != null)
                        //    {
                        //        Session["userName"] = user;
                        //    }
                        //    int userID = BusinessLogic.GetNewUserID();
                        //    Session["userID"] = userID;
                        //    string redirectURL = string.Format("~/CPA/PersonalInformation.aspx?CPAID={0}&Schedule={1}&Purpose={2}&UserID={3}&ID={4}", Request.QueryString["CPAID"], lblScheduleDate.Text,
                        //                    lblPurposeOfVisit.Text, userID, Request.QueryString["ID"]);
                        //    //TODO: set login user name. FormsAuthentication.SetCookies
                        //    Response.Redirect(redirectURL);
                        //}
                        IsValid = true;
                    }
                else
                    {
                        IsValid = false;
                    }

                }
            else
            {
                //String message = "Validation Expire";
                IsValid = false;

            }

            return IsValid;
        }
Пример #14
0
        protected void btnSignUp_Click(object sender, EventArgs e)
        {
            //if (!IsTermsAccepted())
            //    return;

            if (!Isvalididate())
                return;
            Guid userGuid1 = Guid.NewGuid();
            string userGuid = userGuid1.ToString();
            if (!SendEmail1(userGuid))
            {
                return;
            }
            if (!ValidationSummary1.ShowMessageBox)
            {

                CustomerDetails newCustomer = new CustomerDetails();
                //TODO: use calendar control
                newCustomer.DateOfBirth = DateTime.Parse(txtDOB.Text);//Exact(txtDD.Text + "/" + txtMM.Text + "/" + txtYYYY.Text, "M/d/yyyy", CultureInfo.InvariantCulture);
                newCustomer.Email = txtEmail.Text;
                newCustomer.FirstName = txtFirstName.Text;
                newCustomer.LastName = txtLastName.Text;
                newCustomer.Password = txtPassword.Text;
                newCustomer.PhoneNumber = txtPhNumberPart1.Text + "-" + txtPhNumberPart2.Text + "-" + txtPhNumberPart3.Text;
                newCustomer.Gender = rbtnMale.Checked ? "M" : "F";
               string local= HttpContext.Current.Request.Url.Port.ToString();
                int len;
                byte[] pic;
                //if (Session["FileUpload1"] != null)
                if (ImageUpload.PostedFile != null)
                {
                     len = ImageUpload.PostedFile.ContentLength;
                     pic = new byte[len];
                     ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                     newCustomer.Image = pic;
                }
                else
                {
                     len = 0;
                     pic = new byte[len];
                     newCustomer.Image = pic;
                }

                //ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                //newCustomer.Image = pic;
                newCustomer.ActivationToken = userGuid.ToString();
                newCustomer.CreatedDate = DateTime.Now;

                bool result = BusinessLogic.CreateNewTempCustomer(newCustomer);
                //if (result)
                //{

                //    string user;
                //    Session["roleID"] = 1;
                //    if ((user = BusinessLogic.GetLoggedInUserName(txtEmail.Text, txtPassword.Text)) != null)
                //    {
                //        Session["userName"] = user;
                //    }
                //    int userID = BusinessLogic.GetNewUserID();
                //    Session["userID"] = userID;
                //    string redirectURL = string.Format("~/CPA/PersonalInformation.aspx?CPAID={0}&Schedule={1}&Purpose={2}&UserID={3}&ID={4}", Request.QueryString["CPAID"], lblScheduleDate.Text,
                //                    lblPurposeOfVisit.Text, userID, Request.QueryString["ID"]);
                //    //TODO: set login user name. FormsAuthentication.SetCookies
                //    Response.Redirect(redirectURL);
                //}
                if (result)
                {
                    //TODO: set login user name. FormsAuthentication.SetCookies
                    //string user;

                    //Session["roleID"] = 1;

                    //int userID = BusinessLogic.GetNewUserID();
                    //Session["userID"] = userID;
                    //if ((user = BusinessLogic.GetLoggedInUserName(txtEmail.Text, txtPassword.Text)) != null)
                    //{
                    //    Session["userName"] = user;
                    Response.Redirect("~/CPA/VerifyEmail.aspx?Email=" + txtEmail.Text);

                }
            }
        }
Пример #15
0
 public FinanceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
 {
     this._regionManager = regionManager;
     _loadSearchCommand = new DelegateCommand<object>(NavigateToSearch, CanLoad);
     _searchCustNoCommand = new DelegateCommand<object>(SearchCustNo, CanLoad);
     _firstCommand = new DelegateCommand<object>(LoadFirstCustomerDetails, CanLoad);
     _lastCommand = new DelegateCommand<object>(LoadLastCustomerDetails, CanLoad);
     _nextCommand = new DelegateCommand<object>(LoadNextCustomerDetails, CanLoad);
     _previousCommand = new DelegateCommand<object>(LoadPreviousCustomerDetails, CanLoad);
     _saveCustDetailsCommand = new DelegateCommand<object>(SaveCustDetails, CanSave);
     CustomerSummaryDetails = new CustomerSummary();
     SelectedCustomer = new CustomerDetails();
     _eventAggregator = eventAggregator;
     SaveCustomerEvent saveCustEvent = _eventAggregator.GetEvent<SaveCustomerEvent>();
     saveCustEvent.Subscribe(SaveCustomerEventHandler);
     NextCustomerEvent nextCustEvent = _eventAggregator.GetEvent<NextCustomerEvent>();
     nextCustEvent.Subscribe(NextCustomerEventHandler);
     PreviousCustomerEvent previousCustEvent = _eventAggregator.GetEvent<PreviousCustomerEvent>();
     previousCustEvent.Subscribe(PreviousCustomerEventHandler);
     SearchCustomerEvent searchCustEvent = _eventAggregator.GetEvent<SearchCustomerEvent>();
     searchCustEvent.Subscribe(SearchCustomerEventHandler);
     FirstCustomerEvent firstCustEvent = _eventAggregator.GetEvent<FirstCustomerEvent>();
     firstCustEvent.Subscribe(FirstCustomerEventHandler);
     LastCustomerEvent lastCustEvent = _eventAggregator.GetEvent<LastCustomerEvent>();
     lastCustEvent.Subscribe(LastCustomerEventHandler);
     HeaderCustomerNoSelectedEvent customerNoSelectedEvent = _eventAggregator.GetEvent<HeaderCustomerNoSelectedEvent>();
     customerNoSelectedEvent.Subscribe(CustomerNoSelectedEventHandler);
     HeaderCustomerSelectedEvent customerSelectedEvent = _eventAggregator.GetEvent<HeaderCustomerSelectedEvent>();
     customerSelectedEvent.Subscribe(CustomerSelectedEventHandler);
 }
Пример #16
0
        public async void ProcessAccountInvoiceQueueMessage(int InvoiceID)
        {
            try
            {
                OrderDataAccess _orderAccess = new OrderDataAccess(_iconfiguration);

                DatabaseResponse accountTypeResponse = await _orderAccess.GetInvoiceRemarksFromInvoiceID(InvoiceID);

                if (((string)accountTypeResponse.Results) == "RecheduleDeliveryInformation")
                {
                    DatabaseResponse orderMqResponse = new DatabaseResponse();
                    orderMqResponse = await _messageQueueDataAccess.GetRescheduleMessageQueueBody(InvoiceID);

                    QMHelper qMHelper = new QMHelper(_iconfiguration, _messageQueueDataAccess);
                    var      result   = await qMHelper.SendMQ(orderMqResponse);

                    var invoiceDetails = (RescheduleDeliveryMessage)orderMqResponse.Results;

                    if (invoiceDetails != null && invoiceDetails.slotDate != null)
                    {
                        CustomerDetails customer = new CustomerDetails
                        {
                            Name                  = invoiceDetails.name,
                            DeliveryEmail         = invoiceDetails.email,
                            ShippingContactNumber = invoiceDetails.shippingContactNumber,
                            OrderNumber           = invoiceDetails.orderNumber,
                            SlotDate              = invoiceDetails.slotDate ?? DateTime.Now,
                            SlotFromTime          = invoiceDetails.slotFromTime ?? DateTime.Now.TimeOfDay,
                            SlotToTime            = invoiceDetails.slotToTime ?? DateTime.Now.TimeOfDay
                        };

                        string status = await SendOrderSuccessSMSNotification(customer, NotificationEvent.RescheduleDelivery.ToString());
                    }
                }

                else
                {
                    DatabaseResponse invoiceMqResponse = new DatabaseResponse();

                    invoiceMqResponse = await _messageQueueDataAccess.GetAccountInvoiceMessageQueueBody(InvoiceID);

                    InvoceQM invoiceDetails = new InvoceQM();

                    string topicName = string.Empty;

                    string pushResult = string.Empty;

                    if (invoiceMqResponse != null && invoiceMqResponse.Results != null)
                    {
                        invoiceDetails = (InvoceQM)invoiceMqResponse.Results;

                        // invoiceDetails.invoicelist= await GetInvoiceList(invoiceDetails.customerID);

                        invoiceDetails.paymentmode = invoiceDetails.CardFundMethod == EnumExtensions.GetDescription(PaymentMode.CC) ? PaymentMode.CC.ToString() : PaymentMode.DC.ToString();

                        MessageQueueRequest queueRequest = new MessageQueueRequest
                        {
                            Source           = CheckOutType.AccountInvoices.ToString(),
                            NumberOfRetries  = 1,
                            SNSTopic         = topicName,
                            CreatedOn        = DateTime.Now,
                            LastTriedOn      = DateTime.Now,
                            PublishedOn      = DateTime.Now,
                            MessageAttribute = EnumExtensions.GetDescription(RequestType.PayBill),
                            MessageBody      = JsonConvert.SerializeObject(invoiceDetails),
                            Status           = 0
                        };

                        try
                        {
                            Dictionary <string, string> attribute = new Dictionary <string, string>();

                            topicName = ConfigHelper.GetValueByKey(ConfigKey.SNS_Topic_ChangeRequest.GetDescription(), _iconfiguration).Results.ToString().Trim();

                            attribute.Add(EventTypeString.EventType, EnumExtensions.GetDescription(RequestType.PayBill));

                            pushResult = await _messageQueueDataAccess.PublishMessageToMessageQueue(topicName, invoiceDetails, attribute);

                            queueRequest.PublishedOn = DateTime.Now;

                            if (pushResult.Trim().ToUpper() == "OK")
                            {
                                queueRequest.Status = 1;

                                await _messageQueueDataAccess.InsertMessageInMessageQueueRequest(queueRequest);
                            }
                            else
                            {
                                queueRequest.Status = 0;

                                await _messageQueueDataAccess.InsertMessageInMessageQueueRequest(queueRequest);
                            }
                        }
                        catch (Exception ex)
                        {
                            LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                            queueRequest.Status = 0;

                            await _messageQueueDataAccess.InsertMessageInMessageQueueRequest(queueRequest);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
            }
        }
Пример #17
0
        public BaseResponse ChargeAmount(CustomerDetails customerDetails, AuditInfo auditInfo, Veneka.Indigo.Integration.Config.IConfig config, ExternalSystemFields externalFields)
        {
            List <IProductPrintField> printFields = _cardManService.GetProductPrintFields(customerDetails.ProductId, null, null);

            _log.Trace(t => t("Looking up account in Core Banking System."));

            if (config == null)
            {
                _log.Trace("FeeChargeLogic: ChargeAmount config IS NULL");
            }

            InterfaceInfo interfaceInfo = new InterfaceInfo
            {
                Config        = config,
                InterfaceGuid = config.InterfaceGuid.ToString()
            };

            _log.Trace("InterfaceInfo interfaceInfo = new InterfaceInfo : No Issues");

            CardObject _object = new CardObject();

            _object.CustomerAccount = new AccountDetails();
            _object.CustomerAccount.AccountNumber = customerDetails.AccountNumber;
            _object.PrintFields = printFields;
            var response = _comsCore.CheckBalance(customerDetails, externalFields, interfaceInfo, auditInfo);

            if (response.ResponseCode == 0)
            {
                {
                    try
                    {
                        string feeResponse = String.Empty;

                        // Charge Fee if it's greater than 0 and has not already been charged for.
                        if (customerDetails.FeeCharge != null && customerDetails.FeeCharge.Value > 0 && String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                        {
                            _log.Trace(t => t("FeeChargeLogic: ChargeAmount : calling Charge the fee."));
                            string feeReferenceNumber = string.Empty;

                            var response_fee = _comsCore.ChargeFee(customerDetails, externalFields, interfaceInfo, auditInfo);

                            if (response_fee.ResponseCode == 0)
                            {
                                // customerDetails.FeeReferenceNumber = feeReferenceNumber;
                                _log.DebugFormat($"FeeReferenceNumber {customerDetails.FeeReferenceNumber}");
                                return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                            }
                            else
                            {
                                _log.Trace(t => t(feeResponse));

                                return(new BaseResponse(ResponseType.UNSUCCESSFUL, feeResponse, feeResponse));
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                            {
                                if (_log.IsDebugEnabled)
                                {
                                    _log.DebugFormat("Fee already charged: Ref{0}", customerDetails.FeeReferenceNumber);
                                }
                                else
                                {
                                    _log.Trace(t => t("Fee already charged."));
                                }
                            }
                            return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                        }
                    }
                    catch (NotImplementedException nie)
                    {
                        _log.Warn(nie);
                        return(new BaseResponse(ResponseType.ERROR,
                                                nie.Message,
                                                nie.Message));
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex);
                        return(new BaseResponse(ResponseType.ERROR,
                                                ex.Message,
                                                _log.IsDebugEnabled || _log.IsTraceEnabled ? ex.Message : ""));
                    }
                }
            }

            return(new BaseResponse(ResponseType.UNSUCCESSFUL, response.ResponseMessage, response.ResponseMessage));
        }
Пример #18
0
 public static SavingsAccount SavingsAccountCreator(CustomerDetails customer)
 {
     return(new SavingsAccount(customer));
 }
 public static List <CustomerDetails> GetListOfCustomersByAdminClient(int clientId)
 {
     return(CustomerDetails.LoadListByAdminClient(clientId));
 }
Пример #20
0
 public static CurrentAccount CurrentAccountCreator(CustomerDetails customer)
 {
     return(new CurrentAccount(customer));
 }
Пример #21
0
        /// <summary>Initializes a new instance of the <see cref="PayPalPayload" /> class.</summary>
        /// <param name="customerDetails">The underlying <see cref="CustomerDetails" />
        ///     <a href="http://www.oodesign.com/bridge-pattern.html">Implementor</a>
        ///     that facilitates this
        ///     <a href="http://www.dofactory.com/net/bridge-design-pattern">Bridge</a>.</param>
        protected PayPalPayload(CustomerDetails customerDetails) {

            this.customerDetails = customerDetails;
        }
Пример #22
0
        public async Task <bool> addCustomer(CustomerDetails customerDetails)
        {
            try {
                List <Customer> customer = new List <Customer>();

                Customer customeravailability = customer.Where(x => x.Email == customerDetails.Email).FirstOrDefault();

                if (customeravailability == null)
                {
                    byte[] passToHash;
                    string encryptedPassword = "";

                    passToHash        = System.Text.Encoding.UTF8.GetBytes(customerDetails.Password); // string password convert to byte array
                    encryptedPassword = Shared.shared.Hash(passToHash);                               // call passwrod encryption menthod


                    Customer cus = new Customer
                    {
                        FirstName       = customerDetails.firstName,
                        LastName        = customerDetails.LastName,
                        Email           = customerDetails.Email,
                        BilingAddress   = customerDetails.BilingAddress,
                        Password        = encryptedPassword,
                        DeliveryAddress = customerDetails.DeliveryAddress,
                        DeleveryCity    = customerDetails.DeliveryCity,
                        MobileNo        = customerDetails.MobileNo,
                    };

                    var result = await _customerdetails.InsertCustomerRecord(cus);

                    if (result != null)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            } catch (Exception ex)
            {
                return(false);
            }
            // InsertCustomerData insertCustomer = new InsertCustomerData();

            //List<Customer> customerde = new List<Customer>();

            // Customer cu = new Customer
            //{
            // // cu.FirstName = customerDetails.firstName,
            //// cu.LastName

            //// };

            /// customerde = await insertCustomer.InsertCustomerRecord(customerDetails);

            //return customerde;
            //List<Product> products = await _productlist.GetAllProducts();
            // return products;
        }
 public static void CustomerOrderHistory(CustomerDetails cust)
 {
     Console.Clear();
     cust.ViewOrderHistory();
     CDash(cust);
 }
Пример #24
0
 public void CancelEdit()
 {
     CustomerDetails.CancelEdit();
 }
Пример #25
0
        //private void ClearData2()
        //{
        //    txtCustomerName2.Text = string.Empty;
        //    txtAddress2.Text = string.Empty;
        //    txtForignAddress2.Text = string.Empty;
        //    txtPhone2.Text = string.Empty;
        //    txtDateofBirth2.Text = string.Empty;
        //    ddlSex2.SelectedIndex = 0;
        //    txtNationality2.Text = "Bangladeshi";
        //    txtPassportNo2.Text = string.Empty;
        //    txtIssueAt2.Text = string.Empty;
        //    txtNationalID2.Text = string.Empty;
        //    txtBirthCertNo2.Text = string.Empty;
        //    txtEmail2.Text = string.Empty;
        //    ddlResidenceStatus2.SelectedIndex = 0;
        //    hdnIsReinvested.Value = "0";
        //}

        public void SetCustomerDetails(CustomerDetails oCustomerDetails)
        {
            ClearData();
            if (oCustomerDetails != null)
            {
                if (oCustomerDetails.isReinvestmet)
                {
                    btnSaveAndLoad.Enabled = true;
                    btnMasterLoad.Enabled  = false;
                }
                else if (oCustomerDetails.isViewOnly)
                {
                    btnSaveAndLoad.Enabled = false;
                    btnMasterLoad.Enabled  = false;
                }
                else
                {
                    btnSaveAndLoad.Enabled = true;
                    btnMasterLoad.Enabled  = true;
                }

                txtCustomerID.Text       = oCustomerDetails.CustomerID.ToString();
                txtMasterNo.Text         = oCustomerDetails.MasterNo;
                txtCustomerName.Text     = oCustomerDetails.CustomerName;
                txtAddress.Text          = oCustomerDetails.Address;
                txtPermanentAddress.Text = oCustomerDetails.PermanentAddress;
                txtForignAddress.Text    = oCustomerDetails.ForeignAddress;
                txtPhone.Text            = oCustomerDetails.Phone;

                txtDateofBirth.Text = oCustomerDetails.DateOfBirth.ToString(Constants.DATETIME_FORMAT);
                DDListUtil.Assign(ddlDateofBirthCountry, oCustomerDetails.DateOfBirth_Country);
                txtDateofBirthPlace.Text = oCustomerDetails.DateOfBirth_Place;

                DDListUtil.Assign(ddlSex, oCustomerDetails.Sex);

                if (!string.IsNullOrEmpty(oCustomerDetails.Nationality))
                {
                    txtNationality.Text = oCustomerDetails.Nationality;
                }
                DDListUtil.Assign(ddlNationalityCountry, oCustomerDetails.Nationality_Country);
                DDListUtil.Assign(ddlResidentCountry, oCustomerDetails.Resident_Country);

                txtPassportNo.Text = oCustomerDetails.PassportNo;
                DDListUtil.Assign(ddlPassportCountry, oCustomerDetails.PassportNo_Country);
                txtPassportIssueAt.Text = oCustomerDetails.PassportNo_IssueAt;

                txtNationalID.Text = oCustomerDetails.NationalID;
                DDListUtil.Assign(ddlNationalIDCountry, oCustomerDetails.NationalID_Country);
                txtNationalIDIssueAt.Text = oCustomerDetails.NationalID_IssueAt;

                txtBirthCertNo.Text = oCustomerDetails.BirthCertificateNo;
                DDListUtil.Assign(ddlBirthCertNoCountry, oCustomerDetails.BirthCertificateNo_Country);
                txtBirthCertNoIssueAt.Text = oCustomerDetails.BirthCertificateNo_IssueAt;

                txtEmail.Text = oCustomerDetails.EmailAddress;
                DDListUtil.Assign(ddlResidenceStatus, oCustomerDetails.ResidenceStatus);

                //txtCustomerName2.Text = oCustomerDetails.CustomerName2;
                //txtAddress2.Text = oCustomerDetails.Address2;
                //txtForignAddress2.Text = oCustomerDetails.ForeignAddress2;
                //txtPhone2.Text = oCustomerDetails.Phone2;
                //txtDateofBirth2.Text = oCustomerDetails.DateOfBirth2.ToString(Constants.DATETIME_FORMAT);
                //DDListUtil.Assign(ddlSex2, oCustomerDetails.Sex2);
                //if (!string.IsNullOrEmpty(oCustomerDetails.Nationality2))
                //{
                //    txtNationality2.Text = oCustomerDetails.Nationality2;
                //}
                //txtPassportNo2.Text = oCustomerDetails.PassportNo2;
                //txtIssueAt2.Text = oCustomerDetails.IssuedAt2;
                //txtNationalID2.Text = oCustomerDetails.NationalID2;
                //txtBirthCertNo2.Text = oCustomerDetails.BirthCertificateNo2;
                //txtEmail2.Text = oCustomerDetails.EmailAddress2;
                //DDListUtil.Assign(ddlResidenceStatus2, oCustomerDetails.ResidenceStatus2);

                hdTmpCustomerID.Value = oCustomerDetails.CustomerID.ToString();
                if (oCustomerDetails.isReinvestmet)
                {
                    hdnIsReinvested.Value = "1";
                }
                EnableDisableControls(oCustomerDetails.isViewOnly, oCustomerDetails.isReinvestmet);
            }
        }
Пример #26
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // 체크박스 컨트롤에 자바스크립트 이벤트 적용
            this.chkDelivery.Attributes["onclick"] = "return CopyForm();";

            // 현재 사용자의 쇼핑카트 아이디 가져오기 : 회원 또는 비회원
            ShoppingCartDB cart   = new ShoppingCartDB();
            String         cartId = cart.GetShoppingCartId();

            // 현재 접속자의 장바구니 내용 읽어오기 : ASP.NET1.X 버전과 호환 테스트 위해 데이터그리드 사용하였음
            ctlCheckOutList.DataSource = cart.GetItems(cartId);
            ctlCheckOutList.DataBind();

            // 총합 출력하기 : 만약에 3만원 이상 구매시 배송료(2500원) 미포함
            //lblTotal.Text =
            //  String.Format("{0:###,###}", cart.GetTotal(cartId));
            int intTotal = cart.GetTotal(cartId);

            if (intTotal >= 30000)
            {
                lblTotal.Text = String.Format("{0:###,###}", intTotal);
            }
            else
            {
                this.lblDelivery.Visible = true;
                lblTotal.Text            = String.Format("{0:###,###}", intTotal + 2500);
            }

            // 회원/비회원에 따른 폼 모양 정의
            if (Page.User.Identity.IsAuthenticated)
            {
                // 고객 정보 읽어오기
                string          customerId      = Page.User.Identity.Name.ToString();
                CustomersDB     customerDB      = new CustomersDB();
                CustomerDetails customerDetails = customerDB.GetCustomerDetails(customerId);

                // 고객 정보 바인딩
                // 주문자 정보 입력
                this.txtCustomerName.Text        = customerDetails.CustomerName;
                this.txtPhone1.Text              = customerDetails.Phone1;
                this.txtPhone2.Text              = customerDetails.Phone2;
                this.txtPhone3.Text              = customerDetails.Phone3;
                this.txtMobile1.Text             = customerDetails.Mobile1;
                this.txtMobile2.Text             = customerDetails.Mobile2;
                this.txtMobile3.Text             = customerDetails.Mobile3;
                this.txtZip.Text                 = customerDetails.Zip;
                this.txtAddress.Text             = customerDetails.Address;
                this.txtAddressDetail.Text       = customerDetails.AddressDetail;
                this.txtSsn1.Text                = customerDetails.Ssn1;
                this.txtSsn2.Text                = customerDetails.Ssn2;
                this.txtEmailAddress.Text        = customerDetails.EmailAddress;
                this.MemberDivisionPanel.Visible = false;
                // 배송지 정보 입력
                this.txtDeliveryCustomerName.Text  = customerDetails.CustomerName;
                this.txtDeliveryTelePhone1.Text    = customerDetails.Phone1;
                this.txtDeliveryTelePhone2.Text    = customerDetails.Phone2;
                this.txtDeliveryTelePhone3.Text    = customerDetails.Phone3;
                this.txtDeliveryMobilePhone1.Text  = customerDetails.Mobile1;
                this.txtDeliveryMobilePhone2.Text  = customerDetails.Mobile2;
                this.txtDeliveryMobilePhone3.Text  = customerDetails.Mobile3;
                this.txtDeliveryZipCode.Text       = customerDetails.Zip;
                this.txtDeliveryAddress.Text       = customerDetails.Address;
                this.txtDeliveryAddressDetail.Text = customerDetails.AddressDetail;
            }
            else
            {
                this.MemberDivisionPanel.Visible = true;
            }
        }
 public async Task CreateCustomerDetails(CustomerDetails model)
 {
     await _db.GetContainer("CustomersDetails").CreateItemAsync(model);
 }
Пример #28
0
        protected void cmdCheckOut_Click(object sender, System.EventArgs e)
        {
            // 쇼핑카트 클래스 인스턴스 생성
            ShoppingCartDB cart = new ShoppingCartDB();

            // 쇼핑카트 아아디 가져오기 : 회원
            string cartId = cart.GetShoppingCartId();

            // 주문번호 : 회원이든 비회원이든 주문번호는 생성(비회원이면, 주문정보 확인시 사용)
            int orderId = 0;

            // 회원/비회원에 따른 폼 모양 정의
            if (Page.User.Identity.IsAuthenticated)
            {
                // 고객코드 가져오기
                string customerId = Page.User.Identity.Name;

                // 주문 정보 클래스 사용
                OrderDetails orderDetails = new OrderDetails();
                orderDetails.CustomerID = customerId;
                // 배송비 포함 여부 : 3만원 이상
                orderDetails.TotalPrice  = (cart.GetTotal(cartId) >= 30000) ? cart.GetTotal(cartId) : cart.GetTotal(cartId) + 2500;
                orderDetails.OrderStatus = "신규주문";
                orderDetails.Payment     = this.lstPayment.SelectedValue;
                // 배송비 포함 여부 : 3만원 이상
                orderDetails.PaymentPrice   = (cart.GetTotal(cartId) >= 30000) ? cart.GetTotal(cartId) : cart.GetTotal(cartId) + 2500;
                orderDetails.PaymentInfo    = "미입금";
                orderDetails.DeliveryInfo   = 1;//일단 회원...
                orderDetails.DeliveryStatus = "미배송";
                orderDetails.OrderIP        = Request.UserHostAddress;
                orderDetails.Password       = "";
                orderDetails.CartID         = cartId;
                orderDetails.Message        = this.txtMessage.Text;
                //
                orderDetails.CustomerName = this.txtCustomerName.Text;
                orderDetails.TelePhone    =
                    String.Format("{0}-{1}-{2}"
                                  , this.txtDeliveryTelePhone1.Text
                                  , this.txtDeliveryTelePhone2.Text
                                  , this.txtDeliveryTelePhone3.Text);
                orderDetails.MobilePhone =
                    String.Format("{0}-{1}-{2}"
                                  , this.txtDeliveryMobilePhone1.Text
                                  , this.txtDeliveryMobilePhone2.Text
                                  , this.txtDeliveryMobilePhone3.Text);
                orderDetails.ZipCode       = this.txtDeliveryZipCode.Text;
                orderDetails.Address       = this.txtDeliveryAddress.Text;
                orderDetails.AddressDetail = this.txtDeliveryAddressDetail.Text;

                // 고객이면서 장바구니에 구매 상품이 담겨져 있다면,
                if ((cartId != null) && (customerId != null))
                {
                    // 주문 클래스 인스턴스 생성
                    OrdersDB ordersDatabase = new OrdersDB();
                    // 주문 실행
                    orderId = ordersDatabase.PlaceOrder(orderDetails);
                    // 주문 완료 표시
                    lblMessage.Text     = "당신이 주문하신 주문번호는 : " + orderId + "입니다.";
                    cmdCheckOut.Visible = false;// 구매 버튼 숨기기
                }
            }
            else // 비회원 주문 처리
            {
                // 고객 클래스 인스턴스 생성
                CustomersDB     accountSystem   = new CustomersDB();
                CustomerDetails customerDetails = new CustomerDetails();

                customerDetails.CustomerName   = this.txtCustomerName.Text;
                customerDetails.Phone1         = this.txtPhone1.Text;
                customerDetails.Phone2         = this.txtPhone2.Text;
                customerDetails.Phone3         = this.txtPhone2.Text;
                customerDetails.Mobile1        = this.txtMobile1.Text;
                customerDetails.Mobile2        = this.txtMobile2.Text;
                customerDetails.Mobile3        = this.txtMobile3.Text;
                customerDetails.Zip            = this.txtZip.Text;
                customerDetails.Address        = this.txtAddress.Text;
                customerDetails.AddressDetail  = this.txtAddressDetail.Text;
                customerDetails.Ssn1           = this.txtSsn1.Text;
                customerDetails.Ssn2           = this.txtSsn2.Text;
                customerDetails.EmailAddress   = this.txtEmailAddress.Text;
                customerDetails.MemberDivision = 0;//비회원

                // 고객 정보 저장 및 고객 코드 반환
                string customerId = accountSystem.AddNonCustomer(customerDetails);

                // 주문 정보 클래스 사용
                OrderDetails orderDetails = new OrderDetails();
                orderDetails.CustomerID     = customerId;
                orderDetails.TotalPrice     = (cart.GetTotal(cartId) >= 30000) ? cart.GetTotal(cartId) : (cart.GetTotal(cartId) + 2500);
                orderDetails.OrderStatus    = "신규주문";
                orderDetails.Payment        = this.lstPayment.SelectedValue;
                orderDetails.PaymentPrice   = (cart.GetTotal(cartId) >= 30000) ? cart.GetTotal(cartId) : (cart.GetTotal(cartId) + 2500);
                orderDetails.PaymentInfo    = "미입금";
                orderDetails.DeliveryInfo   = 0;// 비회원...
                orderDetails.DeliveryStatus = "미배송";
                orderDetails.OrderIP        = Request.UserHostAddress;
                orderDetails.Password       = this.txtOrdersPassword.Text;
                orderDetails.CartID         = cartId;
                orderDetails.Message        = this.txtMessage.Text;
                //
                orderDetails.CustomerName = this.txtCustomerName.Text;
                orderDetails.TelePhone    =
                    String.Format("{0}-{1}-{2}"
                                  , this.txtDeliveryTelePhone1.Text
                                  , this.txtDeliveryTelePhone2.Text
                                  , this.txtDeliveryTelePhone3.Text);
                orderDetails.MobilePhone =
                    String.Format("{0}-{1}-{2}"
                                  , this.txtDeliveryMobilePhone1.Text
                                  , this.txtDeliveryMobilePhone2.Text
                                  , this.txtDeliveryMobilePhone3.Text);
                orderDetails.ZipCode       = this.txtDeliveryZipCode.Text;
                orderDetails.Address       = this.txtDeliveryAddress.Text;
                orderDetails.AddressDetail = this.txtDeliveryAddressDetail.Text;

                // 비회원이면서 장바구니에 구매 상품이 담겨져 있다면,
                if ((cartId != null) && (customerId != null))
                {
                    // 주문 클래스 인스턴스 생성
                    OrdersDB ordersDatabase = new OrdersDB();
                    // 주문 실행
                    orderId = ordersDatabase.PlaceOrder(orderDetails);
                    // 주문 완료 표시
                    lblMessage.Text     = "<hr />당신이 주문하신 주문번호는 : " + orderId + "입니다.<br />";
                    lblMessage.Text    += "<a href='Default.aspx'>홈으로 가기</a><hr />";
                    cmdCheckOut.Visible = false;// 구매 버튼 숨기기
                }
            }

            // 메일전송 : 주문 내역을 메일 또는 SMS로 보내주는 코드는 이 부분에 위치
            // System.Web.Mail.SmtpMail.Send("*****@*****.**", this.txtEmailAddress.Text, "주문이 완료되었습니다.", "주문번호 : " + orderId + ", 주문비밀번호 : " + this.txtOrdersPassword.Text);
        }
Пример #29
0
        public string OrderStatusUpdate(int OrderID, string Status)
        {
            Order ostatus = db.Order.Find(OrderID);

            ostatus.TransactStatus = Status.ToString();
            db.SaveChanges();
            string          value     = Status;
            int             custid    = ostatus.CustomerID;
            string          _sub      = string.Empty;
            CustomerDetails custemail = db.CustomerDetails.Where(x => x.CustID == custid).FirstOrDefault();

            System.Text.RegularExpressions.Regex expr = new Regex(@"^\d{10}$");
            if (!expr.IsMatch(custemail.CustEmail))
            {
                if (custemail.CustEmail != null || custemail.CustEmail != "")
                {
                    if (value == "Order Placed")
                    {
                        _sub = "Order Placed";
                    }
                    if (value == "Order InProgress")
                    {
                        _sub = "Order InProgress";
                    }
                    if (value == "Order shipped")
                    {
                        _sub = "Order Shipped";
                    }
                    if (value == "Order Delivered")
                    {
                        _sub = "Order Delivered";
                    }
                    if (value == "Order Cancel")
                    {
                        _sub = "Order Cancel";
                    }
                    string Emailtext  = System.IO.File.ReadAllText(@"" + Server.MapPath("~/Template/Emailtemp.txt"));
                    string Emailtext1 = "";
                    string Emailtext2 = "";
                    Emailtext  = Emailtext.Replace("@custname", custemail.CustFName + " " + custemail.CustLName);
                    Emailtext1 = Emailtext.Replace("@Orderno", OrderID.ToString());
                    Emailtext2 = Emailtext1.Replace("@Status", Status);

                    OTPEmailOder(custemail.CustEmail, Emailtext2, "LivingSTUD.com : #" + OrderID + " " + _sub);
                }
            }
            else
            {
                OTPMobileOrder(custemail.CustEmail, "Your #" + OrderID + " " + Status + " ,\r\n Track your order on http://livingstud.com/OrderTrack/" + OrderID + "\r\n Get Order details at  http://www.livingstud.com/orders/Paymentsuccessfull?orderid=" + OrderID + " \r\n continue shopping with us on http://www.livingstud.com  \r\n LivingStud.com team", "LivingSTUD.com " + Status + " : #" + OrderID);
            }
            OrderLog ol = new OrderLog();

            ol.OID        = OrderID;
            ol.CustId     = custemail.CustID.ToString();
            ol.Status     = Status;
            ol.InsertDate = DateTime.Now;
            ol.Owner      = "Kaustubh";
            if (Status == "Order InProgress")
            {
                ol.Owner = "Vishu";
            }
            if (Status == "Order shipped")
            {
                ol.Owner = "Onkar";
            }
            db.OrderLogs.Add(ol);
            db.SaveChanges();
            return("Order ID : " + OrderID + " Status Changed To : " + Status);
        }
Пример #30
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!Isvalididate())
                return;
            CustomerDetails customer = new CustomerDetails();
            //TODO: use calendar control
            customer.UserID = Session["userID"].ToString();
            //customer.UserID = "3";
            customer.Email = txtEmail.Text;
            customer.Password = txtPassword.Text;
            customer.FirstName = txtFirstName.Text;
            customer.LastName = txtLastName.Text;

            customer.DateOfBirth = DateTime.Parse(txtDOB.Text);
            customer.Gender = rbtnMale.Checked ? "M" : "F";
            customer.PhoneNumber = txtPhNumberPart1.Text + '-' + txtPhNumberPart2.Text + '-' + txtPhNumberPart3.Text;
            if (ImageUpload.HasFile)
            {
                int len = ImageUpload.PostedFile.ContentLength;
                byte[] pic = new byte[len];
                ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                customer.Image = pic;

            }
            else
            {
                customer.Image = BusinessLogic.GetUserImage(int.Parse(Session["userID"].ToString()));
            }

             bool result=BusinessLogic.UpdateCustomerDetails(customer);

             if (result)
             {
                Session["userName"] = txtFirstName.Text;
                System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Save Sucessful')</SCRIPT>");
                pnlEditUserProfile.Visible = false;
                RefreshUserProfile();
                pnlUserProfile.Visible = true;
             }
        }
Пример #31
0
        public int MakePayment()
        {
            int orderid = 0;

            if (Session["CustId"] != "" || Session["CustId"] != null)
            {
                CustomerDetails cd         = db.CustomerDetails.Find(Convert.ToInt32(Session["CustId"]));
                int             custid     = Convert.ToInt32(Session["CustId"].ToString());
                int             twopercent = 0;
                List <Order>    or         = db.Order.Where(x => x.CustomerID == custid).ToList();
                if (or.Count == 0)
                {
                    twopercent         = Convert.ToInt32(TempData["pTotalCost"]) * 2 / 100;
                    cd.WalletMoney     = twopercent;
                    db.Entry(cd).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
                Order NewOrder = new Order();
                NewOrder.CustomerID     = cd.CustID;
                NewOrder.ProducID       = 0;
                NewOrder.ColorID        = 0;
                NewOrder.SizeID         = 0;
                NewOrder.Quantity       = 0;
                NewOrder.CompanyName    = cd.CustFName ?? "";
                NewOrder.ContactFName   = cd.CustFName ?? "";
                NewOrder.ContactLName   = cd.CustLName ?? "";
                NewOrder.ContactTitle   = "";
                NewOrder.Address1       = cd.CustAddress1;
                NewOrder.Address2       = cd.CustAddress2 ?? "";
                NewOrder.Order_City     = cd.CustCity ?? 0;
                NewOrder.Order_State    = cd.CustState ?? 0;
                NewOrder.PostalCode     = cd.CustPostalCode;
                NewOrder.Country        = cd.CustCountry ?? 0;
                NewOrder.Phone          = cd.CustPhone ?? "";
                NewOrder.Fax            = cd.CustFax ?? "";
                NewOrder.Email          = cd.CustEmail;
                NewOrder.WebSite        = cd.CustWebSite ?? "";
                NewOrder.PaymentMethods = "ONLINE";
                NewOrder.TranactionID   = 0;
                NewOrder.OrderDate      = DateTime.Now;
                NewOrder.RequiredDate   = DateTime.Now.AddDays(7);
                NewOrder.ShipedDate     = DateTime.Now;
                NewOrder.TransactStatus = "Order Placed";
                NewOrder.ErrMsg         = "NA";
                NewOrder.PaymentAmount  = Convert.ToDecimal(TempData["pTotalCost"]);
                NewOrder.PaidAount      = 0;
                NewOrder.PaymentDate    = DateTime.Now;
                NewOrder.IsActive       = true;
                NewOrder.IsDelete       = false;
                NewOrder.IsUpdate       = false;
                NewOrder.InsertDate     = DateTime.Now;
                NewOrder.LMDDate        = DateTime.Now;
                db.Order.Add(NewOrder);
                db.SaveChanges();
                orderid = NewOrder.OrderID;
                if (orderid > 0)
                {
                    List <Order> sessionProductList = (List <Order>)Session["CartLst"];
                    if (sessionProductList != null)
                    {
                        for (int i = 0; i < Convert.ToInt32(sessionProductList.Count); i++)
                        {
                            OrderedItems   oi       = new OrderedItems();
                            ProductDetails pdetails = db.ProductDetails.Find(Convert.ToInt32(sessionProductList[i].ProducID));
                            ProductDetails pds      = db.ProductDetails.Find(Convert.ToInt32(sessionProductList[i].ProducID));

                            oi.OrderID            = orderid;
                            oi.ProductID          = Convert.ToInt32(sessionProductList[i].ProducID);
                            oi.ProductCode        = pdetails.ProductCode;
                            oi.ProductName        = pdetails.ProductName;
                            oi.ProductCategory    = pdetails.ProductCategory ?? 0;
                            oi.ProductSubCategory = pdetails.ProductSubCategory ?? 0;
                            oi.ProductSize        = sessionProductList[i].SizeID.ToString();
                            oi.ProductColor       = sessionProductList[i].ColorID.ToString();
                            oi.ProductQuantity    = Convert.ToInt32(sessionProductList[i].Quantity);
                            oi.ProductPrice       = sessionProductList[i].VAT;
                            oi.VAT           = pdetails.VAT ?? 0;
                            oi.ProductWeight = pdetails.ProductWeight ?? 0;
                            oi.IsActive      = true;
                            oi.IsDelete      = false;
                            oi.IsUpdate      = false;
                            oi.InsertDate    = DateTime.Now;
                            oi.LMDDate       = DateTime.Now;
                            db.OrderedItems.Add(oi);
                            db.SaveChanges();
                            //int remainingqty = qytnp[0] - oi.ProductQuantity;
                            //pds.ProductQuantity = remainingqty;
                            //db.Entry(pds).State = EntityState.Modified;
                            //db.SaveChanges();
                            Session["MyCartval"] = 0;
                        }
                    }
                }

                if (cd.CustPhone != null)
                {
                    //Your authentication key
                    string authKey = "144054A8Is1H8TDV58be6289";
                    //Multiple mobiles numbers separated by comma
                    string mobileNumber = cd.CustPhone;
                    //Sender ID,While using route4 sender id should be 6 characters long.
                    string senderId = "SHPLOL";
                    //Your message to send, Add URL encoding here.
                    int    _min    = 1000;
                    int    _max    = 9999;
                    Random _rdm    = new Random();
                    int    rnum    = _rdm.Next(_min, _max);
                    string message = HttpUtility.UrlEncode("livingstud.com : Order Thank you " + cd.CustPhone + " For livingstud with us . Your Order id is  " + orderid + ", Track Order http://livingstud.com/Orders/OrderTrack , Please Continue Shopping with us http://www.livingstud.com");

                    //Prepare you post parameters
                    StringBuilder sbPostData = new StringBuilder();
                    sbPostData.AppendFormat("authkey={0}", authKey);
                    sbPostData.AppendFormat("&mobiles={0}", mobileNumber);
                    sbPostData.AppendFormat("&message={0}", message);
                    sbPostData.AppendFormat("&sender={0}", senderId);
                    sbPostData.AppendFormat("&route={0}", "4");

                    try
                    {
                        //Call Send SMS API
                        string sendSMSUri = "http://api.msg91.com/api/sendhttp.php";
                        //Create HTTPWebrequest
                        HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri);
                        //Prepare and Add URL Encoded data
                        UTF8Encoding encoding = new UTF8Encoding();
                        byte[]       data     = encoding.GetBytes(sbPostData.ToString());
                        //Specify post method
                        httpWReq.Method        = "POST";
                        httpWReq.ContentType   = "application/x-www-form-urlencoded";
                        httpWReq.ContentLength = data.Length;
                        using (Stream stream = httpWReq.GetRequestStream())
                        {
                            stream.Write(data, 0, data.Length);
                        }
                        //Get the response
                        HttpWebResponse response       = (HttpWebResponse)httpWReq.GetResponse();
                        StreamReader    reader         = new StreamReader(response.GetResponseStream());
                        string          responseString = reader.ReadToEnd();

                        //Close the response
                        reader.Close();
                        response.Close();
                    }
                    catch (SystemException ex)
                    {
                    }
                }
                if (cd.CustEmail != null)
                {
                    try
                    {
                        using (MailMessage mail = new MailMessage())
                        {
                            mail.From = new MailAddress("*****@*****.**");//[email protected]
                            mail.To.Add(cd.CustEmail);
                            mail.Subject = "livingstud.com : Thank you " + cd.CustFName + " For Shopping with us";
                            string ifmurl = "http://www.livingstud.com/orders/Paymentsuccessfull?orderid=" + orderid;
                            //mail.Body = "ShopLootle.com : Thank you " + cd.CustFName + " For Shopping with us . Your Order id is  " + orderid + ", Track Order http://livingstud.com/Orders/OrderTrack , Please Continue Shopping with us http://wwwLivingstud.com <br><iframe src=" + ifmurl + ">Sorry your browser does not support inline frames.<a href="+ifmurl+" target='_blank'>Click here for Purchase Receipt</a> </iframe>";
                            Order or1 = db.Order.Find(orderid);
                            if (or1.OrderID > 0)
                            {
                                List <OrderedItems> oi = db.OrderedItems.Where(n => n.OrderID == orderid).ToList();
                                ViewBag.Items = oi;
                            }
                            string mybodyforloop = "";
                            string mybody        = "<html><head><link href='http://livingstud.com/css/bootstrap.css' type='text/css' rel='stylesheet' media='all'><link href='http://livingstud.com/css/style.css' type='text/css' rel='stylesheet' media='all'></head><body>Dear " + cd.CustFName + ",<br><br>Thank you for Shopping with us !<br> Your Order id is  " + orderid + ", Track Order http://livingstud.com/Orders/OrderTrack , <br>Please Continue Shopping with us http://www.Livingstud.com <br><div id='myinvoice'><div class='container'><div class='row'><div class='well col-xs-10 col-sm-10 col-md-6 col-xs-offset-1 col-sm-offset-1 col-md-offset-3'><div class='row'><center><h1>Receipt</h1></center><div class='col-xs-6 col-sm-6 col-md-6'><address><h4>Livingstud.com</h4>Email : [email protected]<br><abbr title='Phone'>P:</abbr> +918097471959</address></div><div class='col-xs-6 col-sm-6 col-md-6 text-right'><p><em>order Date: " + or1.InsertDate + "</em></p><p><em>Receipt #: " + orderid + "</em></p></div></div><div class='row'><div class='text-center'></div><table class='table table-hover'><thead><tr><th>Product</th><th>Qty</th><th class='text-center'>Price</th><th class='text-center'>Total</th></tr></thead><tbody>";
                            foreach (var items in ViewBag.Items)
                            {
                                mybodyforloop += mybodyforloop + "<tr><td class='col-md-9'><em>" + items.ProductName + "</em></td><td class='col-md-1' style='text-align: center'> " + items.ProductQuantity + " </td><td class='col-md-1 text-center'>₹ " + items.ProductPrice + "</td><td class='col-md-1 text-center'>₹ " + items.ProductPrice + "</td></tr>";
                            }
                            mybody          = mybody + mybodyforloop + "<tr><td></td><td></td><td class='text-right'><h4><strong>Total: </strong></h4></td><td class='text-center text-danger'><h4><strong>₹ " + or1.PaymentAmount + "</strong></h4></td></tr></tbody></table></div><div class='row'><div class='text-center'><h1>Delivery Details</h1></div><table class='table table-hover'><thead><tr><th>Contact Details</th></tr></thead><tbody><tr><td class='col-md-9'><em>" + or1.ContactFName + "</em><em>" + or1.ContactLName + "</em><em>" + or1.Phone + "</em><em>, " + cd.CustEmail + "</em></td></tr></tbody></table><table class='table table-hover'><thead><tr><th>Address</th></tr></thead><tbody><tr><td class='col-md-9'><em>" + or1.Address1 + "<br />" + or1.Address2 + "</em></td></tr></tbody></table></div></div></div></div></div></body></html>";
                            mail.Body       = mybody;
                            mail.IsBodyHtml = true;
                            //  mail.Attachments.Add(new Attachment("C:\\file.zip"));
                            using (SmtpClient smtp = new SmtpClient())//465 //587
                            {
                                smtp.EnableSsl             = true;
                                smtp.UseDefaultCredentials = false;
                                smtp.Credentials           = new NetworkCredential("*****@*****.**", "nayananm291193");
                                smtp.Host           = "smtp.gmail.com";
                                smtp.Port           = 587;
                                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                                smtp.Send(mail);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            OrderLog ol = new OrderLog();

            ol.OID        = orderid;
            ol.CustId     = Session["CustId"].ToString();
            ol.Status     = "Order Placed";
            ol.InsertDate = DateTime.Now;
            ol.Owner      = "Vishu";
            db.OrderLogs.Add(ol);
            db.SaveChanges();
            return(orderid);
        }
Пример #32
0
        public List <string> CrearDocumento(long OrderID, string TipoDoc)
        {
            List <string> ls = new List <string>();

            try
            {
                #region Variables Modelo
                Tickets              tck = contexdb.Get <Tickets>(x => x.TicketId == OrderID);
                QuickServeCustomers  quickServeCustomers = contexdb.Get <QuickServeCustomers>(x => x.TicketId == tck.TicketId);
                CustomerDetails      customerDetails     = contexdb.Get <CustomerDetails>(x => x.CustomerID == tck.CustomerDetailsId);
                OrderTypes           tipoOrden           = contexdb.Get <OrderTypes>(x => x.OrderTypeId == tck.OrderTypeId);
                SeatingChartDetails  mesa      = contexdb.Get <SeatingChartDetails>(x => x.SeatingChartId == tck.SeatingChartId);
                List <TicketDetails> detaOrden = contexdb.GetAll <TicketDetails>(x => x.TicketID == tck.TicketId && x.ItemStatusId != 3 && x.Price != 0).OrderBy(x => x.TicketDetailsId).ToList();
                var detalle = detaOrden.GroupBy(x => x.ItemName)
                              .Select(g => new
                {
                    DetaID   = g.Key,
                    Cantidad = g.Sum(y => y.Quantity),
                    Producto = g.Key,
                    Total    = g.Sum(y => y.Quantity * y.Price)
                });
                #endregion

                ls.Add(Texto.Centrar(Config.Obtener.NomComer, Config.Obtener.CantCar_Tck));
                ls.Add("");
                ls.Add(Texto.Centrar(Config.Obtener.NomEmpre, Config.Obtener.CantCar_Tck));
                foreach (string s in Config.Obtener.Encabezado)
                {
                    ls.Add(Texto.Centrar(s, Config.Obtener.CantCar_Tck));
                }
                ls.Add(Texto.Centrar("GIRO: " + Config.Obtener.Giro, Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("CAJA: " + 0, Config.Obtener.CantCar_Tck));
                ls.Add("");
                ls.Add(Texto.Centrar("RES. Nº: ", "0", Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("FECHA RESOL.: ", "0", Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("SERIE: ", "0", Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("RANGO : ", "0", Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar(" ", Config.Obtener.CantCar_Tck));


                ls.Add(Texto.Centrar("ATENDIO: " + tck.Users.FirstName + " " + tck.Users.LastName, "ESTACIÓN: " + tck.TerminalId, Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Repetir('*', Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("TICKET Nº : " + 0, "ESTACIÓN: " + tipoOrden.OrderType, Config.Obtener.CantCar_Tck));
                if (mesa != null)
                {
                    ls.Add(Texto.Centrar("MESA : " + mesa.TableCaption, "PERSONAS: " + tck.Guests, Config.Obtener.CantCar_Tck));
                }
                ls.Add(Texto.Repetir('*', Config.Obtener.CantCar_Tck));
                ls.Add(Texto.EncabDetalle("CNT", "PRODUCTO", "TOTAL", Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Repetir('.', Config.Obtener.CantCar_Tck));

                foreach (var d in detalle)
                {
                    ls.Add(Texto.Detalle(d.Cantidad.ToString(), d.Producto, d.Total.ToString(), Config.Obtener.CantCar_Tck));
                }

                ls.Add(Texto.Repetir('.', Config.Obtener.CantCar_Tck));
                ls.Add(Texto.Centrar("TOTAL VENTAS:", tck.Subtotal.ToString(), Config.Obtener.CantCar_Tck));



                return(ls);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Пример #33
0
        public async Task <int> ProcessSuccessTransaction(CheckOutResponseUpdate updateRequest)
        {
            try
            {
                OrderDataAccess _orderAccess = new OrderDataAccess(_iconfiguration);

                DatabaseResponse sourceTyeResponse = new DatabaseResponse();

                sourceTyeResponse = await _orderAccess.GetSourceTypeByMPGSSOrderId(updateRequest.MPGSOrderID);

                if (sourceTyeResponse.ResponseCode == (int)DbReturnValue.RecordExists)
                {
                    if (((OrderSource)sourceTyeResponse.Results).SourceType == CheckOutType.ChangeRequest.ToString())
                    {
                        var details = await _messageQueueDataAccess.GetMessageDetails(updateRequest.MPGSOrderID);

                        if (details != null)
                        {
                            MessageBodyForCR msgBody = new MessageBodyForCR();

                            string topicName = string.Empty, pushResult = string.Empty;

                            try
                            {
                                Dictionary <string, string> attribute = new Dictionary <string, string>();

                                msgBody = await _messageQueueDataAccess.GetMessageBodyByChangeRequest(details.ChangeRequestID);

                                DatabaseResponse changeRequestTypeResponse = await _orderAccess.GetChangeRequestTypeFromID(details.ChangeRequestID);

                                if (((string)changeRequestTypeResponse.Results) == NotificationEvent.ReplaceSIM.ToString())
                                {
                                    if (msgBody.SlotDate != null)
                                    {
                                        CustomerDetails customer = new CustomerDetails
                                        {
                                            Name                  = msgBody.Name,
                                            DeliveryEmail         = msgBody.Email,
                                            ShippingContactNumber = msgBody.ShippingContactNumber,
                                            OrderNumber           = msgBody.OrderNumber,
                                            SlotDate              = msgBody.SlotDate ?? DateTime.Now,
                                            SlotFromTime          = msgBody.SlotFromTime ?? DateTime.Now.TimeOfDay,
                                            SlotToTime            = msgBody.SlotToTime ?? DateTime.Now.TimeOfDay
                                        };

                                        string status = await SendOrderSuccessSMSNotification(customer, NotificationEvent.ReplaceSIM.ToString());
                                    }
                                }

                                if (details.RequestTypeID == (int)Core.Enums.RequestType.ReplaceSIM)
                                {
                                    topicName = ConfigHelper.GetValueByKey(ConfigKey.SNS_Topic_ChangeRequest.GetDescription(), _iconfiguration).Results.ToString().Trim();
                                    attribute.Add(EventTypeString.EventType, Core.Enums.RequestType.ReplaceSIM.GetDescription());
                                    pushResult = await _messageQueueDataAccess.PublishMessageToMessageQueue(topicName, msgBody, attribute);
                                }
                                if (pushResult.Trim().ToUpper() == "OK")
                                {
                                    MessageQueueRequest queueRequest = new MessageQueueRequest
                                    {
                                        Source           = Source.ChangeRequest,
                                        NumberOfRetries  = 1,
                                        SNSTopic         = topicName,
                                        CreatedOn        = DateTime.Now,
                                        LastTriedOn      = DateTime.Now,
                                        PublishedOn      = DateTime.Now,
                                        MessageAttribute = Core.Enums.RequestType.ReplaceSIM.GetDescription(),
                                        MessageBody      = JsonConvert.SerializeObject(msgBody),
                                        Status           = 1
                                    };
                                    await _messageQueueDataAccess.InsertMessageInMessageQueueRequest(queueRequest);
                                }
                                else
                                {
                                    MessageQueueRequest queueRequest = new MessageQueueRequest
                                    {
                                        Source           = Source.ChangeRequest,
                                        NumberOfRetries  = 1,
                                        SNSTopic         = topicName,
                                        CreatedOn        = DateTime.Now,
                                        LastTriedOn      = DateTime.Now,
                                        PublishedOn      = DateTime.Now,
                                        MessageAttribute = Core.Enums.RequestType.ReplaceSIM.GetDescription(),
                                        MessageBody      = JsonConvert.SerializeObject(msgBody),
                                        Status           = 0
                                    };
                                    await _messageQueueDataAccess.InsertMessageInMessageQueueRequest(queueRequest);
                                }
                            }
                            catch (Exception ex)
                            {
                                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                                MessageQueueRequestException queueRequest = new MessageQueueRequestException
                                {
                                    Source                                      = Source.ChangeRequest,
                                    NumberOfRetries                             = 1,
                                    SNSTopic                                    = string.IsNullOrWhiteSpace(topicName) ? null : topicName,
                                    CreatedOn                                   = DateTime.Now,
                                    LastTriedOn                                 = DateTime.Now,
                                    PublishedOn                                 = DateTime.Now,
                                    MessageAttribute                            = Core.Enums.RequestType.ReplaceSIM.GetDescription().ToString(),
                                    MessageBody                                 = msgBody != null?JsonConvert.SerializeObject(msgBody) : null,
                                                                      Status    = 0,
                                                                      Remark    = "Error Occured in ProcessSuccessTransaction",
                                                                      Exception = new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical)
                                };

                                await _messageQueueDataAccess.InsertMessageInMessageQueueRequestException(queueRequest);
                            }
                        }

                        return(3);
                    }

                    else if (((OrderSource)sourceTyeResponse.Results).SourceType == CheckOutType.Orders.ToString())
                    {
                        try
                        {
                            LogInfo.Information("Calling SendEmailNotification");
                            string emailStatus = await SendEmailNotification(updateRequest.MPGSOrderID, ((OrderSource)sourceTyeResponse.Results).SourceID);

                            LogInfo.Information("Email Send status for : " + emailStatus);
                        }

                        catch (Exception ex)
                        {
                            LogInfo.Information("Email Send failed");
                            LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                        }

                        ProcessOrderQueueMessage(((OrderSource)sourceTyeResponse.Results).SourceID);

                        BuddyHelper buddyHelper = new BuddyHelper(_iconfiguration, _messageQueueDataAccess);

                        // Proess VAS bundles added to Order

                        DatabaseResponse getVASToProcessResponse = await _orderAccess.GetOrderedVASesToProcess(((OrderSource)sourceTyeResponse.Results).SourceID);

                        LogInfo.Information("Processing VASes for Order:" + ((OrderSource)sourceTyeResponse.Results).SourceID);

                        if (getVASToProcessResponse.ResponseCode == (int)DbReturnValue.RecordExists && getVASToProcessResponse.Results != null)
                        {
                            List <VasToProcess> vasListToProcess = (List <VasToProcess>)getVASToProcessResponse.Results;

                            LogInfo.Information(" VAS list to Process for Order:" + +((OrderSource)sourceTyeResponse.Results).SourceID + " - " + JsonConvert.SerializeObject(vasListToProcess));

                            DatabaseResponse customerResponse = await _orderAccess.GetCustomerIdFromOrderId(((OrderSource)sourceTyeResponse.Results).SourceID);

                            if (customerResponse != null && customerResponse.ResponseCode == (int)DbReturnValue.RecordExists)
                            {
                                int customerID = ((OrderCustomer)customerResponse.Results).CustomerId;

                                foreach (VasToProcess vas in vasListToProcess)
                                {
                                    BuyVASStatus vasProcessStatus = await buddyHelper.ProcessVas(customerID, vas.MobileNumber, vas.BundleID, 1);
                                }
                            }
                        }

                        return(3); // not buddy plan; MQ send
                    }

                    else if (((OrderSource)sourceTyeResponse.Results).SourceType == CheckOutType.AccountInvoices.ToString())
                    {
                        //send invoice queue message

                        ProcessAccountInvoiceQueueMessage(((OrderSource)sourceTyeResponse.Results).SourceID);

                        return(3);
                    }

                    else
                    {
                        return(5); // incorrect CheckOutType, no chance to reach here, but just to do
                                   //returnn from all code path, because in all of the above I need to keep CheckOutType check
                    }
                }

                else
                {
                    // unable to get sourcetype form db

                    return(4);
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                return(0);
            }
        }
Пример #34
0
        private void SaveCustDetails(object ignored)
        {

            string ValidationMessage = ValidateMandatoryFields();

            if (ValidationMessage == string.Empty)
            {
                bool isInputValid = CheckForValidInputs();
                if (isInputValid)
                {
                    IsBusy = true;
                    SelectedCustomer.PmtMethod = SelPayMethod;
                    SelectedCustomer.IsAlertExpires = IsAlertExpires;
                    ServiceAgent.SaveCustomerDetails(SelectedCustomer, (s, e) =>
                    {
                        if (e.Error != null)
                        {
                            HandleError(e.Error);
                        }
                        else
                        {
                            _tempCustomer = Utilities<CustomerDetails>.DeepCopy(this.SelectedCustomer);
                            GetCustomerDetails(_seqPartyId);
                        }

                        IsBusy = false;
                    });
                }
            }
            else
            {
                ValidationMessage = string.Concat(ApplicationResources.GetString(ConstantResources.LTPLEASEENTER), "  ", ValidationMessage.Remove(ValidationMessage.Length - 1));
                Message = ValidationMessage;
            }

        }
Пример #35
0
        public BaseResponse FeeCharge(CustomerDetails customerDetails, AuditInfo auditInfo)
        {
            List <IProductPrintField> printFields = _cardManService.GetProductPrintFields(customerDetails.ProductId, null, null);

            _log.Trace(t => t("Looking up account in Core Banking System."));
            // IntegrationController _integration = IntegrationController.Instance;
            Veneka.Indigo.Integration.Config.IConfig config;
            Veneka.Indigo.Integration.External.ExternalSystemFields externalFields;
            _integration.CoreBankingSystem(customerDetails.ProductId, InterfaceArea.ISSUING, out externalFields, out config);

            InterfaceInfo interfaceInfo = new InterfaceInfo
            {
                Config        = config,
                InterfaceGuid = config.InterfaceGuid.ToString()
            };

            CardObject _object = new CardObject();

            _object.CustomerAccount = new AccountDetails();
            _object.CustomerAccount.AccountNumber = customerDetails.AccountNumber;
            _object.PrintFields = printFields;
            var response = _comsCore.CheckBalance(customerDetails, externalFields, interfaceInfo, auditInfo);

            if (response.ResponseCode == 0)
            {
                // var accountLookupLogic = new Logic.AccountLookupLogic(_cardManService, _comsCoreInstance, _integration);

                //Validate returned account
                //   if (accountLookupLogic.ValidateAccount(customerDetails.ProductId, response.Value, out responseMessage))

                {
                    try
                    {
                        string feeResponse = String.Empty;

                        // Charge Fee if it's greater than 0 and has not already been charged for.
                        if (customerDetails.FeeCharge != null && customerDetails.FeeCharge.Value > 0 && String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                        {
                            _log.Trace(t => t("calling Charge the fee."));
                            string feeReferenceNumber = string.Empty;

                            var response_fee = _comsCore.ChargeFee(customerDetails, externalFields, interfaceInfo, auditInfo);

                            if (response_fee.ResponseCode == 0)
                            {
                                // customerDetails.FeeReferenceNumber = feeReferenceNumber;
                                _log.DebugFormat("FeeReferenceNumber " + customerDetails.FeeReferenceNumber);


                                _log.DebugFormat("Fee  charged: Ref{0}", customerDetails.FeeReferenceNumber);

                                return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                            }
                            else
                            {
                                _log.Trace(t => t(feeResponse));

                                return(new BaseResponse(ResponseType.UNSUCCESSFUL, feeResponse, feeResponse));
                            }
                        }
                        else
                        {
                            if (!String.IsNullOrWhiteSpace(customerDetails.FeeReferenceNumber))
                            {
                                if (_log.IsDebugEnabled)
                                {
                                    _log.DebugFormat("Fee already charged: Ref{0}", customerDetails.FeeReferenceNumber);
                                }
                                else
                                {
                                    _log.Trace(t => t("Fee already charged."));
                                }
                            }
                            return(new BaseResponse(ResponseType.SUCCESSFUL, feeResponse, feeResponse));
                        }
                    }
                    catch (NotImplementedException nie)
                    {
                        _log.Warn(nie);
                        return(new BaseResponse(ResponseType.ERROR,
                                                nie.Message,
                                                nie.Message));
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex);
                        return(new BaseResponse(ResponseType.ERROR,
                                                ex.Message,
                                                _log.IsDebugEnabled || _log.IsTraceEnabled ? ex.Message : ""));
                    }
                }
            }

            return(new BaseResponse(ResponseType.UNSUCCESSFUL, response.ResponseMessage, response.ResponseMessage));
        }
Пример #36
0
        public FinanceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            this._regionManager = regionManager;

            _loadSearchCommand = new DelegateCommand<object>(NavigateToSearch, CanLoad);
            _searchCustNoCommand = new DelegateCommand<object>(SearchCustNo, CanLoad);
            _deleteCustomerCommand = new DelegateCommand<object>(DeleteCustomer, CanLoad);
            _firstCommand = new DelegateCommand<object>(LoadFirstCustomerDetails, CanLoad);
            _lastCommand = new DelegateCommand<object>(LoadLastCustomerDetails, CanLoad);
            _nextCommand = new DelegateCommand<object>(LoadNextCustomerDetails, CanLoad);
            _previousCommand = new DelegateCommand<object>(LoadPreviousCustomerDetails, CanLoad);
            _saveCustDetailsCommand = new DelegateCommand<object>(SaveCustDetails, CanSave);
            CustomerSummaryDetails = new CustomerSummary();
            SelectedCustomer = new CustomerDetails();
        }
 public static List <CustomerDetails> GetListOfCustomerDetails()
 {
     return(CustomerDetails.LoadList());
 }
Пример #38
0
 public void SetUp()
 {
     _database = new CustomerDatabase();
     _customer = null;
 }
 public static void DeleteCustomerDetail(int id)
 {
     CustomerDetails.DeleteCustomerDetail(id);
 }
Пример #40
0
 private void Given_a_new_customer()
 {
     _customer = new CustomerDetails();
 }
Пример #41
0
 public void SaveCustomerDetails(CustomerDetails customerDetails, EventHandler<SaveCustomerDetailsCompletedEventArgs> callback)
 {
     _proxy.SaveCustomerDetailsCompleted -= callback;
     _proxy.SaveCustomerDetailsCompleted += callback;
     _proxy.SaveCustomerDetailsAsync(customerDetails);
 }
Пример #42
0
 private void When_customer_ID_is_entered()
 {
     _customer = _database.GetById(_customerId);
 }
 public ReturnMeForKeyValuePair()
 {
     CustomerDetails = new CustomerDetails();
     Permissions     = new ReturnMePermissions();
     MembershipFlags = new ReturnMeMembershipFlags();
 }
Пример #44
0
        //private void UpdateCaptchaText()
        //{
        //    txtCaptchaText.Text = string.Empty;
        //    lblStatus.Visible = false;
        //    Session["Captcha"] = Guid.NewGuid().ToString().Substring(0, 6);
        //    var string1 = Session["Captcha"];
        //}
        protected void btnSignUp_Click(object sender, EventArgs e)
        {
            if (!Isvalididate())
                return;
            if (!ValidationSummary1.ShowMessageBox)
            {
                Guid userGuid1 = Guid.NewGuid();
                String userGuid = userGuid1.ToString();
                if (!SendEmail1(userGuid))
                {
                    return;
                }
                CustomerDetails newCustomer = new CustomerDetails();
                //TODO: use calendar control
                newCustomer.DateOfBirth = DateTime.Parse(txtDOB.Text);
                newCustomer.Email = txtEmail.Text;
                newCustomer.FirstName = txtFirstName.Text;
                newCustomer.LastName = txtLastName.Text;
                newCustomer.Password = txtPassword.Text;
               // newCustomer.PhoneNumber = txtPhoneNumber.Text;
                newCustomer.PhoneNumber=txtPhNumberPart1.Text+'-'+txtPhNumberPart2.Text+'-'+txtPhNumberPart3.Text;
                newCustomer.Gender = rbtnMale.Checked ? "M" : "F";
                int len = ImageUpload.PostedFile.ContentLength;
                byte[] pic = new byte[len];
                ImageUpload.PostedFile.InputStream.Read(pic, 0, len);
                newCustomer.Image = pic;
                newCustomer.ActivationToken = userGuid.ToString();
                newCustomer.CreatedDate = DateTime.Now;

                bool result = BusinessLogic.CreateNewTempCustomer(newCustomer);
                if (result)
                {
                    //TODO: set login user name. FormsAuthentication.SetCookies
                    //string user;

                    //Session["roleID"] = 1;

                    //int userID = BusinessLogic.GetNewUserID();
                    //Session["userID"] = userID;
                    //if ((user = BusinessLogic.GetLoggedInUserName(txtEmail.Text, txtPassword.Text)) != null)
                    //{
                    //    Session["userName"] = user;
                        Response.Redirect("~/CPA/VerifyEmail.aspx?Email=" + txtEmail.Text);

                }
            }
        }