// // GET: /Shippingitems/Delete/5 public ActionResult Delete(int id) { Shippingitem model = new Shippingitem(); model = model.GetById(id); model.Delete(model); return(View(model)); }
public ActionResult CreateAjaxDev(int shipping_id, int devmodel_id, int count) { Shippingitem theItem = new Shippingitem(); theItem.Shipping = (new Shipping()).GetById(shipping_id); theItem.Devmodel = (new Devmodel()).GetById(devmodel_id); theItem.Count = count; theItem.Save(theItem); return(View(theItem)); }
void SendEmailNotification(int shipping_id) { IEnumerable <string> shippingitem_numbers = (new Shippingitem()).GetAll("SHIPPING_ID=" + shipping_id.ToString()).Select(a => a.ID.ToString()); string str_shippingitem_numbers = string.Join(", ", shippingitem_numbers); IEnumerable <string> storeid_numbers = (new Shippingitemdistribute()).GetAll("SHIPPINGITEM_ID in (" + str_shippingitem_numbers + ")").Select(a => a.StoreID.ToString()).Distinct(); string str_storeid_numbers = string.Join(", ", storeid_numbers); foreach (var store in (new Store()).GetAll("ID in (" + str_storeid_numbers + ")")) { string strEmail = ""; string strEmail2 = ""; if (store.User != null) { strEmail = store.User.Email; } if (store.User2 != null) { strEmail2 = store.User2.Email; } string strMsg = ""; strMsg = "<b>Новое поступление на склад " + store.Name + "</b><br/><br/><br/>"; strMsg += "<table class=\"table table-bordered\">"; string strDistribute = ""; foreach (var distribute in (new Shippingitemdistribute()).GetAll("STATUS=2 AND STORE_ID=" + store.ID + " AND SHIPPINGITEM_ID in (" + str_shippingitem_numbers + ")")) { strDistribute += "<tr>"; string str = ""; Shippingitem theShippingitem = new Shippingitem(); theShippingitem = theShippingitem.GetById(distribute.ShippingitemID); if (theShippingitem.Devmodel != null) { str += "<td>" + theShippingitem.Devmodel.FullName + "</td>"; str += "<td>" + distribute.Count + "</td>"; } if (theShippingitem.Matmodel != null) { str += "<td>" + theShippingitem.Matmodel.FullName + "</td>"; str += "<td>" + distribute.Count + "</td>"; } strDistribute += str; strDistribute += "</tr>"; } if (strDistribute.Length > 0) { strMsg += strDistribute + "</table>" + " <p><a href=\"http://hardx.dv.rt.ru/Shippingitemdistribute/details\">Смотреть</a></p> "; try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("10.198.1.200"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(strEmail); mail.To.Add(strEmail2); mail.Subject = "Склад поступление"; mail.IsBodyHtml = true; mail.Body = strMsg; SmtpServer.Port = 25; SmtpServer.EnableSsl = false; SmtpServer.Send(mail); } catch (Exception ex) { } } } }