public JsonResult CreateEntry([FromBody] ContactRequestModel data)
        {
            string retval = "ok";

            DriveApiService service = new DriveApiService();


            service.UpdateQueriesSheet(data.Name,
                                       data.EmailAddress,
                                       data.PhoneNumber,
                                       data.Subject,
                                       data.Message,
                                       data.RequestSource);


            //"*****@*****.**"
            string OwnerContactEmailBodyString =
                GetOwnerContactEmailBodyString(data);

            string CustomerContactEmailBodyString =
                GetCustomerContactEmailBodyString(data);

            List <string> owneremails = new List <string>();

            owneremails.Add("*****@*****.**");

            List <string> receipientemails = new List <string>();

            receipientemails.Add(data.EmailAddress);

            service.SendEmail(OwnerContactEmailBodyString,
                              "Enquiry Received",
                              owneremails,
                              new List <AttachmentItem>());

            service.SendEmail(CustomerContactEmailBodyString,
                              "Enquiry Received",
                              receipientemails,
                              new List <AttachmentItem>());


            return(new JsonResult(new { result = retval }));;
        }
        public JsonResult CreateEntry([FromBody] WarrantyClaimModel data)
        {
            string retval = "ok";

            if (!ProductIdValidationController.ValidateProductId(data.SerialNumber))
            {
                retval = "Invalid ProductId";
                return(new JsonResult(new { result = retval }));
            }


            string details =
                System.IO.File.ReadAllText(@"D:\home\site\wwwroot\" + "private.p12");


            using (MemoryStream receiptimage = ConvertFromBase64(data.ReceiptImageString))
                using (MemoryStream serialnumberimage = ConvertFromBase64(data.SerialNumberImageString))
                {
                    //saving data in google drive.
                    try
                    {
                        DriveApiService service = new DriveApiService();

                        string receiptfilename = "Receipt"
                                                 + "-" + data.SerialNumber
                                                 + "-" + data.LastName
                                                 + "-" + data.EmailAddress
                                                 + "-" + data.ReceiptFileName;

                        string serialnumberfilename = "SerialNumber"
                                                      + "-" + data.SerialNumber
                                                      + "-" + data.LastName
                                                      + "-" + data.EmailAddress
                                                      + "-" + data.ReceiptFileName;

                        string receipturllink =
                            service.UploadWarrantyClaimDocument(receiptimage,
                                                                receiptfilename);

                        string serialnumlink =
                            service.UploadWarrantyClaimDocument(serialnumberimage,
                                                                serialnumberfilename);


                        service.UpdateWarrantyClaimSheet(data.SerialNumber,
                                                         data.PurchaseDate,
                                                         data.FirstName,
                                                         data.LastName,
                                                         data.DateofBirth,
                                                         data.EmailAddress,
                                                         data.AddressLine1,
                                                         data.AddressLine2,
                                                         data.City,
                                                         data.State,
                                                         data.ZipCode,
                                                         data.Country,
                                                         data.ClaimReason,
                                                         receipturllink,
                                                         serialnumlink,
                                                         DateTime.Now.ToShortDateString());

                        //"*****@*****.**"
                        string ownerwarrantyemailbodystring =
                            GetOwnerWarrantyEmailBodyString(data, receipturllink, serialnumlink);
                        string customerwarrantyemailbodystring =
                            GetCustomerWarrantyEmailBodyString(data, receipturllink, serialnumlink);

                        AttachmentItem itemreceipt      = PackageImage(receiptimage, receiptfilename);
                        AttachmentItem itemserialnumber = PackageImage(serialnumberimage, serialnumberfilename);

                        List <AttachmentItem> items = new List <AttachmentItem>();
                        items.Add(itemreceipt);
                        items.Add(itemserialnumber);

                        List <string> owneremails = new List <string>();

                        owneremails.Add("*****@*****.**");

                        List <string> receipientemails = new List <string>();

                        receipientemails.Add(data.EmailAddress);

                        service.SendEmail(ownerwarrantyemailbodystring,
                                          "Warranty Claim Received",
                                          owneremails,
                                          items);
                        service.SendEmail(customerwarrantyemailbodystring,
                                          "Warranty Claim Received",
                                          receipientemails,
                                          new List <AttachmentItem>());
                    }

                    catch (Exception ex)
                    {
                        retval = "Error";
                    }
                }

            return(new JsonResult(new { result = retval }));
        }
Beispiel #3
0
        public JsonResult CreateEntry([FromBody] ACHPaymentUploadModel data)
        {
            string retval = "ok";

            string details =
                System.IO.File.ReadAllText("private.p12");

            string voidcheckfilename = "voidcheck"
                                       + "-" + System.DateTime.Now.Ticks
                                       + "-" + data.FEIN
                                       + "-" + data.CompanyName
                                       + "-" + data.VoidCheckFileName;

            try
            {
                using (MemoryStream voidcheck = ImageHelpers.ConvertFromBase64(data.VoidCheckImageString))
                {
                    DriveApiService service = new DriveApiService();

                    string voidcheckfileurl =
                        service.UploadVoidCheckDocument(voidcheck, voidcheckfilename);

                    service.UploadACHPaymentRequest(data.CompanyName,
                                                    data.ContactName,
                                                    data.BankName,
                                                    data.AccountType,
                                                    data.BankRoutingNumber,
                                                    data.BankRoutingVerified,
                                                    data.BankAccountNumber,
                                                    data.EmailAddress,
                                                    data.AddressLine1,
                                                    data.AddressLine2,
                                                    data.City,
                                                    data.State,
                                                    data.PrintedName,
                                                    data.TitleName,
                                                    data.FEIN,
                                                    data.datesigned,
                                                    data.ZipCode,
                                                    voidcheckfileurl,
                                                    data.CommentsOrMessage,
                                                    data.Source);


                    string ownerachemailbodystring =
                        GetOwnerACHEmailBodyString(data, voidcheckfileurl);
                    string customerachemailbodystring =
                        GetCustomerACHEmailBodyString(data);

                    AttachmentItem itemvoidcheck = PackageImage(ImageHelpers.ConvertFromBase64(data.VoidCheckImageString),
                                                                data.VoidCheckFileName);

                    List <AttachmentItem> items = new List <AttachmentItem>();
                    items.Add(itemvoidcheck);

                    List <string> owneremails = new List <string>();

                    owneremails.Add("*****@*****.**");

                    List <string> receipientemails = new List <string>();

                    receipientemails.Add(data.EmailAddress);

                    service.SendEmail(ownerachemailbodystring,
                                      "ACH Request Received",
                                      owneremails,
                                      items);
                    service.SendEmail(customerachemailbodystring,
                                      "ACH Request Received",
                                      receipientemails,
                                      new List <AttachmentItem>());
                }
            }

            catch (Exception ex)
            {
                retval = "Error";
            }

            return(new JsonResult(new { result = retval }));
        }
        public JsonResult CreateEntry([FromBody] RegistrationModel data)
        {
            string retval = "ok";

            if (!ProductIdValidationController.ValidateProductId(data.SerialNumber))
            {
                retval = "Invalid ProductId";
                return(new JsonResult(new { result = retval }));
            }


            string details =
                System.IO.File.ReadAllText(@"D:\home\site\wwwroot\" + "private.p12");

            MemoryStream image = ConvertFromBase64(data.ImageString);

            //saving data in google drive.
            //try
            //{
            DriveApiService service = new DriveApiService();

            string filename1 = data.SerialNumber
                               + "-" + data.LastName
                               + "-" + data.EmailAddress
                               + "-" + data.FileName;

            string urllink =
                service.UploadRegistrationDocument(image,
                                                   filename1);

            service.UpdateRegistrationSheet(data.SerialNumber,
                                            data.PurchaseDate,
                                            data.FirstName,
                                            data.LastName,
                                            data.DateofBirth,
                                            data.EmailAddress,
                                            data.AddressLine1,
                                            data.AddressLine2,
                                            data.City,
                                            data.State,
                                            data.ZipCode,
                                            data.Country,
                                            urllink,
                                            DateTime.Now.ToShortDateString());

            //"*****@*****.**"
            string ownerregistrationemailbodystring =
                GetOwnerRegistrationEmailBodyString(data, urllink);
            string customerregistrationemailbodystring =
                GetCustomerRegistrationEmailBodyString(data, urllink);

            AttachmentItem item = PackageImage(image, data);

            List <AttachmentItem> items = new List <AttachmentItem>();

            items.Add(item);

            List <string> owneremails = new List <string>();

            owneremails.Add("*****@*****.**");

            List <string> receipientemails = new List <string>();

            receipientemails.Add(data.EmailAddress);

            service.SendEmail(ownerregistrationemailbodystring,
                              "Registration Received",
                              owneremails,
                              items);
            service.SendEmail(customerregistrationemailbodystring,
                              "Registration Received",
                              receipientemails,
                              new List <AttachmentItem>());

            //}

            // catch(Exception ex)
            // {
            //     retval = "Error";
            // }



            return(new JsonResult(new { result = retval }));;
        }
Beispiel #5
0
        public JsonResult CreateEntry([FromBody] WholesalersRequestModel data)
        {
            string retval = "ok";

            DriveApiService service = new DriveApiService();

            if (!ModelState.IsValid)
            {
                new JsonResult(new { result = "Bad Data" });
            }

            List <StateTaxRegistrationInternal> internalregs =
                new  List <StateTaxRegistrationInternal>();


            // this.InternalFilename =
            //            DateTime.Now.Ticks
            //           + "-"
            //           + fedtaxid
            //           + "-"
            //           + registration.StateSalesTaxId
            //           + "-"
            //           + registration.StateSelected
            //           + "-"
            //           + businessname
            //           + "-"
            //           + registration.FileName;

            string feinfilename = DateTime.Now.Ticks
                                  + "-"
                                  + data.FederalBusinessTaxId
                                  + "-"
                                  + data.BusinessName
                                  + "-"
                                  + data.FEINFileName;
            string feinfileurl = string.Empty;

            using (MemoryStream ms = ImageHelpers.ConvertFromBase64(data.FEINImageString))
            {
                feinfileurl = service.UploadWholesalerDocument(ms, feinfilename);
            }

            foreach (StateTaxRegistration reg in data.StateRegistrations)
            {
                StateTaxRegistrationInternal internalreg =
                    new StateTaxRegistrationInternal(reg,
                                                     data.FederalBusinessTaxId,
                                                     data.BusinessName);

                internalregs.Add(internalreg);
            }


            foreach (StateTaxRegistrationInternal inregs in internalregs)
            {
                inregs.UploadedUrl =
                    service.UploadWholesalerDocument(inregs.InternalMemStream, inregs.InternalFilename);
            }


            service.UpdateWholesalerQueriesSheet(data, internalregs, feinfileurl);


            //"*****@*****.**"
            string OwnerContactEmailBodyString =
                GetOwnerContactEmailBodyString(data, internalregs);

            string CustomerContactEmailBodyString =
                GetCustomerContactEmailBodyString(data);

            List <string> owneremails = new List <string>();

            owneremails.Add("*****@*****.**");

            List <string> receipientemails = new List <string>();

            receipientemails.Add(data.EmailAddress);

            List <AttachmentItem> attachments = PackageImages(internalregs);

            service.SendEmail(OwnerContactEmailBodyString,
                              "Wholesaler Enquiry Received",
                              owneremails,
                              attachments);

            service.SendEmail(CustomerContactEmailBodyString,
                              "Wholesaler Enquiry Received",
                              receipientemails,
                              new List <AttachmentItem>());


            return(new JsonResult(new { result = retval }));
        }