예제 #1
0
        public int SearchByName(string Name)
        {
            HttpResponseMessage response = GlobalHttp.WebApiClient.GetAsync("Customers/Search/" + Name).Result;
            mvcCustomerModel    customer = response.Content.ReadAsAsync <mvcCustomerModel>().Result;

            return(customer.CustId);
        }
예제 #2
0
        public ActionResult AddModal(string CustName, string CustEmail, string CustCategory)
        {
            //Initialize the HTML to PDF converter
            HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);

            WebKitConverterSettings settings = new WebKitConverterSettings();

            //Set WebKit path
            settings.WebKitPath = @"D:/Data/7th Semester/IPT/Project/WEB APP/SmartPOS_CRUD/packages/Syncfusion.HtmlToPdfConverter.QtWebKit.AspNet.17.3.0.26/lib/QtBinaries";

            //Assign WebKit settings to HTML converter
            htmlConverter.ConverterSettings = settings;

            //Convert URL to PDF
            PdfDocument document = htmlConverter.Convert("http://*****:*****@gmail.com");
                msg.To.Add(new MailAddress(CustEmail));
                msg.Subject = "Thank You For Shopping";
                msg.Body    = "Please check the Invoice Attached below.";
                Attachment attachment;
                attachment      = new Attachment("D:/Data/7th Semester/IPT/Project/WEB APP/SmartPOS_CRUD/MVC/Invoice/" + CustName + ".pdf");
                attachment.Name = "Invoice.pdf";
                msg.Attachments.Add(attachment);

                SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", Convert.ToInt32(587));
                System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("*****@*****.**", "TijaratPOS000");
                smtpClient.Credentials = credentials;
                smtpClient.EnableSsl   = true;
                smtpClient.Send(msg);

                mvcCustomerModel cust = new mvcCustomerModel();
                cust.CustName     = CustName;
                cust.CustEmail    = CustEmail;
                cust.CustCategory = CustCategory;
                HttpResponseMessage response = GlobalHttp.WebApiClient.PostAsJsonAsync("Customers", cust).Result;
                TempData["SuccessMessage"] = "Shopping Receipt Has Been Send To Customer";
            }
            catch (Exception ex)
            {
                TempData["AlertMessage"] = "Something Went Wrong Please Check Your Connection Or Enter Valid Email Address";
            }


            return(RedirectToAction("Index"));
        }
예제 #3
0
 public ActionResult AddOrEdit(int id = 0)
 {
     if (id == 0)
     {
         return(View(new mvcCustomerModel()));
     }
     else
     {
         HttpResponseMessage response = GlobalHttp.WebApiClient.GetAsync("Customers/" + id.ToString()).Result;
         mvcCustomerModel    customer = response.Content.ReadAsAsync <mvcCustomerModel>().Result;
         return(View(customer));
     }
 }
예제 #4
0
 public ActionResult AddOrEdit(mvcCustomerModel cus)
 {
     if (cus.CustomerID == 0)
     {
         HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("Customer", cus).Result;
         TempData["SuccessMessage"] = "Uspješno spremljeno";
     }
     else
     {
         HttpResponseMessage response = GlobalVariables.WebApiClient.PutAsJsonAsync("Customer/" + cus.CustomerID, cus).Result;
         TempData["SuccessMessage"] = "Uspješno ažurirano";
     }
     return(RedirectToAction("Index"));
 }
예제 #5
0
 public ActionResult AddOrEdit(mvcCustomerModel cust)
 {
     if (cust.CustomerID == 0)
     {
         HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("Customer", cust).Result;
         TempData["SuccessMessage"] = "Saved Record Successfully";
     }
     else
     {
         HttpResponseMessage response = GlobalVariables.WebApiClient.PutAsJsonAsync("Customer/" + cust.CustomerID, cust).Result;
         TempData["SuccessMessage"] = "Updated Record Successfully";
     }
     return(RedirectToAction("Index"));
 }
예제 #6
0
        public ActionResult AddOrEdit(mvcCustomerModel customer)
        {
            if (customer.CustId == 0)
            {
                HttpResponseMessage response = GlobalHttp.WebApiClient.PostAsJsonAsync("Customers", customer).Result;

                TempData["SuccessMessage"] = customer.CustName + " Record Added Successfully";
            }
            else
            {
                HttpResponseMessage response = GlobalHttp.WebApiClient.PutAsJsonAsync("Customers/" + customer.CustId, customer).Result;
                TempData["SuccessMessage"] = customer.CustName + " Record Updated Successfully";
            }
            return(RedirectToAction("Index"));
        }
예제 #7
0
        public ActionResult AddOrderByValues(int prodId, string custName, int orderQuantity, int imageId)
        {
            //Image
            ImageController imageController = new ImageController();

            HttpResponseMessage response = GlobalHttp.WebApiClient.GetAsync("Customers/Search/" + custName).Result;
            mvcCustomerModel    customer = response.Content.ReadAsAsync <mvcCustomerModel>().Result;

            mvcOrderModel order = new mvcOrderModel();

            order.ProdId        = prodId;
            order.ImagePath     = imageController.ImageView(imageId);
            order.OrderQuantity = orderQuantity;
            order.CustId        = customer.CustId;
            order.OrderDate     = DateTime.Now.ToString();
            HttpResponseMessage Prodresponse = GlobalHttp.WebApiClient.PostAsJsonAsync("Orders", order).Result;

            return(View("Index", "Product"));
        }
예제 #8
0
        public ActionResult Modal()
        {
            mvcCustomerModel customer = new mvcCustomerModel();

            return(View(customer));
        }