public ActionResult SendEmail(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(HttpNotFound()); } var Prodectid = db.OrderTs.Find(id).ProdectID; ProdectT Prodect = db.ProdectTs.Find(Prodectid); var UserTid = db.OrderTs.Find(id).UserID; UserT UserT = db.UserTs.Find(UserTid); var FullName = UserT.FullName; var ProdectName = Prodect.ProdectName; var Price = Prodect.Price; var Phone = UserT.Phone; var Address = UserT.Address; var Country = UserT.Country; var City = UserT.City; var Email = UserT.Email; ViewBag.msg = "Hi Plese diver the Prodect :- " + ProdectName + " To the Cotomar :- " + FullName + " ,the Prodect Price is :- " + Price + " ,the Cotomar Phone :- " + Phone + " ,the Cotomar Email is:- " + Email + " and the Cotomar Address is:- " + Address + " , " + Country + " , " + City; return(View(orderT)); }
public IHttpActionResult PutOrderT(int id, OrderT orderT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != orderT.OrderID) { return(BadRequest()); } db.Entry(orderT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OrderTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetOrderT(int id) { OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(NotFound()); } return(Ok(orderT)); }
public IHttpActionResult PostOrderT(OrderT orderT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.OrderTs.Add(orderT); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = orderT.OrderID }, orderT)); }
public override async Task Execute(OrganismData model, OrganismDbContext _context) { OrderT oldOrder = _context.Kingdoms .Include(i => i.Phylums).ThenInclude(i => i.Classes).ThenInclude(i => i.Orders) .Single(i => i.KingdomTID == model.KingdomID).Phylums .Single(i => i.PhylumTID == model.PhylumID).Classes .Single(i => i.ClassTID == model.ClassID).Orders .Single(i => i.OrderTID == model.OrderID); oldOrder.Name = model.Name; await _context.SaveChangesAsync(); }
public ActionResult Edit([Bind(Include = "OrderID,ProdectID,UserID")] OrderT orderT) { if (ModelState.IsValid) { db.Entry(orderT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProdectID = new SelectList(db.ProdectTs, "ProdectID", "ProdectName", orderT.ProdectID); ViewBag.UserID = new SelectList(db.UserTs, "UserID", "FullName", orderT.UserID); return(View(orderT)); }
public ActionResult Create([Bind(Include = "OrderID,ProdectID,UserID")] OrderT orderT) { if (ModelState.IsValid) { db.OrderTs.Add(orderT); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProdectID = new SelectList(db.ProdectTs, "ProdectID", "ProdectName", orderT.ProdectID); ViewBag.UserID = new SelectList(db.UserTs, "UserID", "FullName", orderT.UserID); return(View(orderT)); }
public IHttpActionResult DeleteOrderT(int id) { OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(NotFound()); } db.OrderTs.Remove(orderT); db.SaveChanges(); return(Ok(orderT)); }
// GET: OrdersMcv/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(HttpNotFound()); } return(View(orderT)); }
// GET: OrdersMcv/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(HttpNotFound()); } ViewBag.ProdectID = new SelectList(db.ProdectTs, "ProdectID", "ProdectName", orderT.ProdectID); ViewBag.UserID = new SelectList(db.UserTs, "UserID", "FullName", orderT.UserID); return(View(orderT)); }
public override async Task <int> Execute(OrganismData model, OrganismDbContext _context) { OrderT newOrder = new OrderT() { Name = model.Name }; _context.Kingdoms .Include(i => i.Phylums).ThenInclude(i => i.Classes).ThenInclude(i => i.Orders) .Single(i => i.KingdomTID == model.KingdomID).Phylums .Single(i => i.PhylumTID == model.PhylumID).Classes .Single(i => i.ClassTID == model.ClassID).Orders .Add(newOrder); await _context.SaveChangesAsync(); return(newOrder.OrderTID); }
public ActionResult DeleteConfirmed(int id, string msg) { OrderT orderT = db.OrderTs.Find(id); ProdectT prodect = db.ProdectTs.Find(orderT.ProdectID); UserT user = db.UserTs.Find(orderT.UserID); CategoriesT categories = db.CategoriesTs.Find(prodect.CategorieID); oldOrder old = new oldOrder(); old.OrderNumber = orderT.OrderID; old.UserID = user.UserID; old.FullName = user.FullName; old.UserName = user.UserName; old.Password = user.Password; old.Email = user.Email; old.Phone = user.Phone; old.Address = user.Address; old.City = user.City; old.State = user.State; old.Country = user.Country; old.CategorieID = categories.CategorieName; old.ProdectID = prodect.ProdectID; old.ProdectName = prodect.ProdectName; old.ProdectNameAR = prodect.ProdectNameAR; old.Descriotion = prodect.Descriotion; old.DescriotionAR = prodect.DescriotionAR; old.Price = prodect.Price; old.Rating = prodect.Rating; old.CancelMassage = msg; db.oldOrders.Add(old); db.OrderTs.Remove(orderT); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult SendEmail(string receiver, string subject, string message, string orderId) { try { if (ModelState.IsValid) { var senderEmail = new MailAddress("*****@*****.**", "AnsBedoor"); var receiverEmail = new MailAddress(receiver, "Receiver"); var password = "******"; var sub = subject; var body = message; SmtpClient Client = new SmtpClient("smtp.gmail.com", 587); Client.EnableSsl = true; Client.Timeout = 100000; Client.DeliveryMethod = SmtpDeliveryMethod.Network; Client.UseDefaultCredentials = false; Client.Credentials = new NetworkCredential(senderEmail.Address, password); MailMessage mailMessage = new MailMessage(senderEmail.Address, receiverEmail.Address, subject, message); mailMessage.IsBodyHtml = true; mailMessage.BodyEncoding = UTF8Encoding.UTF8; using (var mess = new MailMessage(senderEmail, receiverEmail) { Subject = subject, Body = body }) { Client.Send(mailMessage); } var i = Convert.ToInt32(orderId); OrderT orderT = db.OrderTs.Find(i); ProdectT prodect = db.ProdectTs.Find(orderT.ProdectID); UserT user = db.UserTs.Find(orderT.UserID); CategoriesT categories = db.CategoriesTs.Find(prodect.CategorieID); oldOrder old = new oldOrder(); old.OrderNumber = orderT.OrderID; old.UserID = user.UserID; old.FullName = user.FullName; old.UserName = user.UserName; old.Password = user.Password; old.Email = user.Email; old.Phone = user.Phone; old.Address = user.Address; old.City = user.City; old.State = user.State; old.Country = user.Country; old.CategorieID = categories.CategorieName; old.ProdectID = prodect.ProdectID; old.ProdectName = prodect.ProdectName; old.ProdectNameAR = prodect.ProdectNameAR; old.Descriotion = prodect.Descriotion; old.DescriotionAR = prodect.DescriotionAR; old.Price = prodect.Price; old.Rating = prodect.Rating; db.oldOrders.Add(old); db.OrderTs.Remove(orderT); db.SaveChanges(); return(RedirectToAction("Index", "OrdersMcv", null)); } } catch (Exception ex) { ViewBag.Error = "Some Error"; } return(View()); }
public void Click1() { int i = 0; OrderT order1 = new OrderT(); OrderC oc = new OrderC(); MingXi mx = new MingXi(); List <OrderC> olist = new List <OrderC>(); order1.OrdetType(odType); odType = order1.Quexian;//订单类型 string batch = txtbatch.Text.Trim().ToString(); string orderno = textBox1.Text.ToString(); string matnr = textBox2.Text.ToString(); string mold = textBox3.Text.ToString(); string[] splitStrings = txtDate.Text.Split(); string datestr = string.Join("", splitStrings); DateTime date = Convert.ToDateTime(datestr); string jitai1 = txtjitai1.Text.Trim(); string jitai2 = txtjitai2.Text.Trim(); string jitai3 = txtjitai3.Text.Trim(); string jitai4 = txtjitai4.Text.Trim(); string jitai5 = txtjitai5.Text.Trim(); string jitai6 = txtjitai6.Text.Trim(); string jitai7 = txtjitai7.Text.Trim(); string jitai8 = txtjitai8.Text.Trim(); string caozuo1 = txtcz1.Text.Trim(); string caozuo2 = txtcz2.Text.Trim(); string caozuo3 = txtcz3.Text.Trim(); string caozuo4 = txtcz4.Text.Trim(); string caozuo5 = txtcz5.Text.Trim(); string caozuo6 = txtcz6.Text.Trim(); string caozuo7 = txtcz7.Text.Trim(); string caozuo8 = txtcz8.Text.Trim(); int chanliang1 = int.Parse(txtcl1.Text.Trim()); int chanliang2 = int.Parse(txtcl2.Text.Trim()); int chanliang3 = int.Parse(txtcl3.Text.Trim()); int chanliang4 = int.Parse(txtcl4.Text.Trim()); int chanliang5 = int.Parse(txtcl5.Text.Trim()); int chanliang6 = int.Parse(txtcl6.Text.Trim()); int chanliang7 = int.Parse(txtcl7.Text.Trim()); int chanliang8 = int.Parse(txtcl8.Text.Trim()); int banhao = int.Parse(str2.Substring(8, 1)); float gongshi = float.Parse(txtgh.Text.Trim()); int bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8, intqx1, intqx2, intqx3, intqx4, intqx5, intqx6, intqx7, intqx8; int.TryParse(buliang1.Text.Trim().ToString(), out bl1); int.TryParse(buliang2.Text.Trim().ToString(), out bl2); int.TryParse(buliang3.Text.Trim().ToString(), out bl3); int.TryParse(buliang4.Text.Trim().ToString(), out bl4); int.TryParse(buliang5.Text.Trim().ToString(), out bl5); int.TryParse(buliang6.Text.Trim().ToString(), out bl6); int.TryParse(buliang7.Text.Trim().ToString(), out bl7); int.TryParse(buliang8.Text.Trim().ToString(), out bl8); int.TryParse(quexian1.Text.Trim().ToString(), out intqx1); int.TryParse(quexian2.Text.Trim().ToString(), out intqx2); int.TryParse(quexian3.Text.Trim().ToString(), out intqx3); int.TryParse(quexian4.Text.Trim().ToString(), out intqx4); int.TryParse(quexian5.Text.Trim().ToString(), out intqx5); int.TryParse(quexian6.Text.Trim().ToString(), out intqx6); int.TryParse(quexian7.Text.Trim().ToString(), out intqx7); int.TryParse(quexian8.Text.Trim().ToString(), out intqx8); int[] bl = new int[] { bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8 }; int[] intqx = new int[] { intqx1, intqx2, intqx3, intqx4, intqx5, intqx6, intqx7, intqx8 }; string[] jitai = new string[] { jitai1, jitai2, jitai3, jitai4, jitai5, jitai6, jitai7, jitai8 }; string[] caozuo = new string[] { caozuo1, caozuo2, caozuo3, caozuo4, caozuo5, caozuo6, caozuo7, caozuo8 }; int[] changliang = new int[] { chanliang1, chanliang2, chanliang3, chanliang4, chanliang5, chanliang6, chanliang7, chanliang8 }; string[] strqx = new string[8]; int mid = 0; bool x = true; //判断是否添加数据到数据库 string sql = string.Format("select QueXian,Number from Class_Table where Qclass='{0}'", odType); SqlDataReader reader = SqlDB.ExecuteReader(sql); while (reader.Read()) { oc = new OrderC() { Quexian = reader.GetString(0), Number = reader.GetInt32(1) }; olist.Add(oc); i++; } reader.Dispose();//关闭 sql = string.Format("select max(ID) from Master"); reader = SqlDB.ExecuteReader(sql); while (reader.Read()) { mid = reader.GetInt32(0) + 1; break; } reader.Dispose();//关闭 for (int j = 0; j < 8; j++) { if (bl[j] == 0 || jitai[j].Length == 0) { break; } if (olist.Count > 0) { strqx[j] = mx.PiDui(intqx[j], olist); if (strqx[j].Length == 0) { MessageBox.Show("没有找到" + intqx[j] + "所对应的缺陷", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); x = false; } else { sql = string.Format("insert into QueXIanNo(Number1,QueXian,MasterID,Number2,P_No,Number3) values({0},'{1}','{2}','{3}','{4}',{5})", bl[j], strqx[j], mid, jitai[j], caozuo[j], changliang[j]); SqlDB.ExecuteNonQuery(sql); //添加明细表信息 QueXianNo } } else { x = false; } } if (x == true) { DateTime nowdate = DateTime.Now; sql = string.Format("insert into Master(Batch,OrderNo,Matnr,Mold,Date,B_No,Time,Date2,OType) values('{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}','{8}')", batch, orderno, matnr, mold, date, banhao, gongshi, nowdate, odType); SqlDB.ExecuteNonQuery(sql); //添加抬头表信息 Master } }