public async Task <IActionResult> Edit(int id, [Bind("adresID,mahalle,sokak,isYeri,No,ilce,sehir")] adress adress) { if (id != adress.adresID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(adress); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!adressExists(adress.adresID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(adress)); }
public async Task <IActionResult> Create([Bind("adresID,mahalle,sokak,isYeri,No,ilce,sehir")] adress adress) { if (ModelState.IsValid) { _context.Add(adress); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(adress)); }
public ActionResult Contact2(string da, string da2, string ide) { int a = int.Parse(ide); int x = int.Parse(da); int y = int.Parse(da2); adress adr = db.adress.Find(a); adr.X = x; adr.Y = y; db.SaveChanges(); string io = Request["a"]; return(Json(io)); }
public ActionResult Contact1(string da, string da2, string ide) { string a = ide; int x = int.Parse(da); int y = int.Parse(da2); adress adr = db.adress.Find(a); adr.X = x; adr.Y = y; db.SaveChanges(); string io = Request["a"]; list.Add(a); list.Add(x.ToString()); list.Add(y.ToString()); TempData["Message"] = JsonConvert.SerializeObject(list); return(Json(io)); }
public int DispatchOrders(Dictionary <Models.Orders.Order, List <Models.Orders.OrderLine> > orderLines, Models.Vendors.Vendor vendor, AuditLog4Net.Adapter.IAuditLogAdapter log, DataAccess.UnitOfWork.IUnitOfWork uni) { var CustNo = vendor.VendorSettings.GetValueByKey("CopacoCustomerNo", string.Empty); var SenderID = vendor.VendorSettings.GetValueByKey("CopacoSenderID", string.Empty); var FtpUrl = vendor.VendorSettings.GetValueByKey("FtpUrl", string.Empty); var FtpUserName = vendor.VendorSettings.GetValueByKey("Username", string.Empty); var FtpPassword = vendor.VendorSettings.GetValueByKey("Password", string.Empty); var UploadDirectory = vendor.VendorSettings.GetValueByKey("UploadDirectory", string.Empty); Concentrator.Objects.Ordering.XmlClasses.Customer customer = new Concentrator.Objects.Ordering.XmlClasses.Customer(); customer.customerid = CustNo; foreach (var order in orderLines.Keys) { int count = 0; //new order XML_order orderxml = new XML_order(); orderxml.documentsource = "order_in"; orderxml.external_document_id = order.OrderID.ToString(); orderxml.supplier = "COPACO"; //order header with customer and shipping info orderheader header = new orderheader(); header.Customer = customer; // set customer header.completedelivery = "N"; header.requested_deliverydate = ""; header.customer_ordernumber = order.OrderID.ToString(); header.sender_id = SenderID; header.testflag = "Y"; header.recipientsreference = order.CustomerOrderReference; // shipping info ShipTo ship = new ShipTo(); adress adress = new adress(); adress.name1 = order.ShippedToCustomer.CustomerName; //overige ook toevoegen? adress.street = order.ShippedToCustomer.CustomerAddressLine1 + " " + order.ShippedToCustomer.HouseNumber; adress.postalcode = order.ShippedToCustomer.PostCode.Substring(0, 4) + " " + order.ShippedToCustomer.PostCode.Substring(4); adress.city = order.ShippedToCustomer.City; adress.country = order.ShippedToCustomer.Country; ship.Items = new adress[1]; ship.ItemsElementName = new ItemsChoiceType[1]; ship.ItemsElementName[0] = ItemsChoiceType.adress; ship.Items[0] = adress; #region future use //notification notification = new notification(); //ordertext ordertext = new ordertext(); //License_data license_data = new License_data(); //end_user_contact end_user_contact = new end_user_contact(); //header.notification = notification; //header.ordertext = new ordertext[1]; //header.ordertext[0] = ordertext; //header.License_data = license_data; //header.License_data.end_user_contact = end_user_contact; #endregion //orderline array orderxml.orderline = new orderline[order.OrderLines.Count]; //add basic info to xml orderxml.orderheader = header; orderxml.orderheader.ShipTo = ship; foreach (var itemOrder in order.OrderLines) { //add orderline orderline orderline = new orderline(); orderline.linenumber = itemOrder.OrderLineID.ToString(); orderline.item_id = new item_id[1]; orderline.item_id[0] = new item_id(); orderline.item_id[0].tag = "PN"; orderline.item_id[0].Value = itemOrder.Product.VendorAssortments.FirstOrDefault(x => x.VendorID == vendor.VendorID).CustomItemNumber; orderline.quantity = new quantity(); orderline.quantity.unit = "ST"; orderline.quantity.Value = itemOrder.GetDispatchQuantity().ToString(); //orderline.deliverydate = "";//DateTime.Today.AddDays(1).ToString("DD-MM-YYYY"); orderline.price = new price(); orderline.price.currency = "EUR"; orderline.price.Value = itemOrder.Price.Value.ToString().Replace(',', '.'); orderxml.orderline[count] = orderline; count++; } string fileName = string.Format("Order_{0}.xml", order.OrderID.ToString()); StringBuilder requestString = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; using (XmlWriter xw = XmlWriter.Create(requestString, settings)) { xw.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); XmlSerializer serializer = new XmlSerializer(orderxml.GetType()); XmlSerializerNamespaces nm = new XmlSerializerNamespaces(); nm.Add("", ""); serializer.Serialize(xw, orderxml, nm); XmlDocument xml = new XmlDocument(); xml.LoadXml(requestString.ToString()); xml.DocumentElement.RemoveAttribute("xmlns:xsi"); xml.DocumentElement.RemoveAttribute("xmlns:xsd"); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] file = encoding.GetBytes(xml.InnerXml.ToString()); SimpleFtp ftp = new SimpleFtp(FtpUrl, FtpUserName, FtpPassword, log, true); ftp.UploadFile(file, fileName, UploadDirectory); LogOrder(xml, vendor.VendorID, fileName, log); } } return(0); }