public ActionResult OrderDetails(int stitchingjobid) { CustomerHistory customerhistory = new CustomerHistory(_context); HistoryItem item = customerhistory.getOrderDetails(stitchingjobid); return(View(item)); }
public async void SendSms(int stitchingjobid) { CustomerHistory customerhistory = new CustomerHistory(_context); HistoryItem item = customerhistory.getOrderDetails(stitchingjobid); StitchingJob stitchingjob = _context.StitchingJob.Find(stitchingjobid); Users customer = _context.Users.Find(stitchingjob.CustomerId); string phonenumber = customer.UserId; if (phonenumber[0] == '0') { phonenumber = "+92" + phonenumber.TrimStart(new char[] { '0' }); } string statusname = null; if (item.sj.WarehouseStatus == 1) { int status = -1; foreach (ProductionActivity pa in item.sj.ProductionActivity) { if (status < pa.ProgressStatus) { status = pa.ProgressStatus; } } switch (status) { case 1: statusname = "Cutting کٹنگ"; break; case 2: statusname = "Embroidary کڑھائی"; break; case 3: statusname = "Stitching سلائی"; break; case 4: statusname = "Quality Assurance کوالٹی اشورینس"; break; case 5: statusname = "Packing پیکنگ"; break; case 6: statusname = "Finished تیار"; break; default: break; } } else { statusname = "Warehouse Processing ویئرہاؤس پراسیسنگ"; } string jobname = null; if (item.sj.JobType.JobName == "Kurta") { jobname = "Kurta کرتا"; } else if (item.sj.JobType.JobName == "Shalwar") { jobname = "Shalwar شلوار "; } else if (item.sj.JobType.JobName == "Blazer") { jobname = "Blazer بلیزر"; } else if (item.sj.JobType.JobName == "Suit") { jobname = "Suit سوٹ"; } else if (item.sj.JobType.JobName == "Shirt") { jobname = "Shirt شرٹ"; } else if (item.sj.JobType.JobName == "KameezShalwar") { jobname = "KameezShalwar قمیض شلوار"; } else if (item.sj.JobType.JobName == "Pant") { jobname = "Pant پینٹ"; } string message = "Your order has passed " + statusname + ", " + "Invoice Number انوائس نمبر:" + item.invoice.InvoiceId; /*string ordername = "Order Name آرڈر کا نام:" + jobname + ","; * string invoicenumber = "Invoice Number انوائس نمبر:" + item.invoice.InvoiceId + ","; * string orderdate = "Order Date آرڈر کی تاریخ:" + item.invoice.Date.ToString("dd/MM/yyyy") + ","; * string expecteddate = "Expected Date متوقع تاریخ:" + item.sj.ExpectedDate.Value.ToString("dd/MM/yyyy");*/ using (var client = new HttpClient { BaseAddress = new Uri("https://api.twilio.com") }) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($"{"AC2371684484ff1369244789f5b99d84cd"}:{"bcb8ebb17ed4d204dcb1c4f9630f030e"}"))); var content = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("To", phonenumber), new KeyValuePair <string, string>("From", "+12013081067"), new KeyValuePair <string, string>("Body", message) }); try { await client.PostAsync("/2010-04-01/Accounts/AC2371684484ff1369244789f5b99d84cd/Messages.json", content).ConfigureAwait(false); } catch (Exception ex) { } } }