public static ConsigneeVm GetConsigneeInfo(int id) { ConsigneeVm carrVmObj = new ConsigneeVm(); if (id == 0) { ContactPersonVm contactVm = new ContactPersonVm(); carrVmObj.ContactPersons.Add(contactVm); } else { EasyFreightEntities db = new EasyFreightEntities(); Consignee carrDbObj = db.Consignees.Include("ConsigneeContacts") .Where(x => x.ConsigneeId == id).FirstOrDefault(); Mapper.CreateMap <Consignee, ConsigneeVm>().IgnoreAllNonExisting(); Mapper.Map(carrDbObj, carrVmObj); Mapper.CreateMap <ConsigneeContact, ContactPersonVm>().IgnoreAllNonExisting() .ForMember(x => x.FkValue, opts => opts.MapFrom(scr => scr.ConsigneeId)); ContactPersonVm contactVm; foreach (var item in carrDbObj.ConsigneeContacts) { contactVm = new ContactPersonVm(); Mapper.Map(item, contactVm); carrVmObj.ContactPersons.Add(contactVm); } } return(carrVmObj); }
public ActionResult AddOrEditConsignee(VT_GetConsigneeWithArea_Result con) { if (con.ID == 0) { Consignee c = new Consignee(); c.Address = con.Address; c.Name = con.Name; c.AreaID = con.aid; c.ShortName = con.ShortName; db.Consignees.Add(c); db.SaveChanges(); return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet)); } else { Consignee c = db.Consignees.Where(x => x.ID == con.ID).FirstOrDefault(); c.Address = con.Address; c.Name = con.Name; c.TaxCode = con.TaxCode; c.AreaID = con.aid; c.ShortName = con.ShortName; db.Entry(c).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet)); } }
public static int AddConsigneeQuick(string code, string name) { Consignee consigneeObj = new Consignee(); consigneeObj.ConsigneeCode = code; consigneeObj.ConsigneeNameEn = name; EasyFreightEntities db = new EasyFreightEntities(); string isSaved = "true"; db.Consignees.Add(consigneeObj); try { db.SaveChanges(); } catch (DbEntityValidationException e) { isSaved = "false " + e.Message; } catch (Exception e) { isSaved = "false " + e.InnerException.InnerException; } return(consigneeObj.ConsigneeId); }
private Consignee setConsignee(DataTable dt) { Consignee cons1 = new Consignee(); if (dt.Rows.Count > 0) { //stf1.staff_id = dt.Rows[0][cus.staff_id].ToString(); cons1.cons_id = dt.Rows[0][cons.cons_id].ToString(); cons1.cons_code = dt.Rows[0][cons.cons_code].ToString(); cons1.cons_name_t = dt.Rows[0][cons.cons_name_t].ToString(); cons1.cons_name_e = dt.Rows[0][cons.cons_name_e].ToString(); cons1.active = dt.Rows[0][cons.active].ToString(); cons1.address_t = dt.Rows[0][cons.address_t].ToString(); cons1.address_e = dt.Rows[0][cons.address_e].ToString(); cons1.addr = dt.Rows[0][cons.addr].ToString(); cons1.amphur_id = dt.Rows[0][cons.amphur_id].ToString(); cons1.district_id = dt.Rows[0][cons.district_id].ToString(); cons1.province_id = dt.Rows[0][cons.province_id].ToString(); cons1.zipcode = dt.Rows[0][cons.zipcode].ToString(); cons1.sale_id = dt.Rows[0][cons.sale_id].ToString(); cons1.sale_name_t = dt.Rows[0][cons.sale_name_t].ToString(); cons1.fax = dt.Rows[0][cons.fax].ToString(); cons1.tele = dt.Rows[0][cons.tele].ToString(); cons1.email = dt.Rows[0][cons.email].ToString(); cons1.tax_id = dt.Rows[0][cons.tax_id].ToString(); cons1.remark = dt.Rows[0][cons.remark].ToString(); cons1.contact_name1 = dt.Rows[0][cons.contact_name1].ToString(); cons1.contact_name2 = dt.Rows[0][cons.contact_name2].ToString(); cons1.contact_name1_tel = dt.Rows[0][cons.contact_name1_tel].ToString(); cons1.contact_name2_tel = dt.Rows[0][cons.contact_name2_tel].ToString(); cons1.status_company = dt.Rows[0][cons.status_company].ToString(); cons1.status_vendor = dt.Rows[0][cons.status_vendor].ToString(); cons1.date_create = dt.Rows[0][cons.date_create].ToString(); cons1.date_modi = dt.Rows[0][cons.date_modi].ToString(); cons1.date_cancel = dt.Rows[0][cons.date_cancel].ToString(); cons1.user_create = dt.Rows[0][cons.user_create].ToString(); cons1.user_modi = dt.Rows[0][cons.user_modi].ToString(); cons1.user_cancel = dt.Rows[0][cons.user_cancel].ToString(); cons1.remark2 = dt.Rows[0][cons.remark2].ToString(); cons1.po_due_period = dt.Rows[0][cons.po_due_period].ToString(); cons1.taddr1 = dt.Rows[0][cons.taddr1].ToString(); cons1.taddr2 = dt.Rows[0][cons.taddr2].ToString(); cons1.taddr3 = dt.Rows[0][cons.taddr3].ToString(); cons1.taddr4 = dt.Rows[0][cons.taddr4].ToString(); cons1.eaddr1 = dt.Rows[0][cons.eaddr1].ToString(); cons1.eaddr2 = dt.Rows[0][cons.eaddr2].ToString(); cons1.eaddr3 = dt.Rows[0][cons.eaddr3].ToString(); cons1.eaddr4 = dt.Rows[0][cons.eaddr4].ToString(); } return(cons1); }
public ActionResult DeleteConsignee(int id) { Consignee con = db.Consignees.Where(x => x.ID == id).FirstOrDefault <Consignee>(); db.Consignees.Remove(con); db.SaveChanges(); return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet)); }
public IActionResult CreateConsignee(Consignee model) { if (ModelState.IsValid) { _consigneeRepo.SaveConsignee(model); return(Redirect(nameof(Index))); // chèn xong thì chuyển hướng lại trang Index } // khi còn nhập thiếu input return(View(model)); }
public static Consignee GetConsignee(this Consignee c) { return(new Consignee() { code = c.code, name = c.name, description = c.description, id_consignee = c.id_consignee, auxiliary = c.auxiliary, }); }
private void initConfig() { cons = new Consignee(); cons.cons_id = "cons_id"; cons.cons_code = "cons_code"; cons.cons_name_t = "cons_name_t"; cons.cons_name_e = "cons_name_e"; cons.active = "active"; cons.address_t = "address_t"; cons.address_e = "address_e"; cons.addr = "addr"; cons.amphur_id = "amphur_id"; cons.district_id = "district_id"; cons.province_id = "province_id"; cons.zipcode = "zipcode"; cons.sale_id = "sale_id"; cons.sale_name_t = "sale_name_t"; cons.fax = "fax"; cons.tele = "tele"; cons.email = "email"; cons.tax_id = "tax_id"; cons.remark = "remark"; cons.contact_name1 = "contact_name1"; cons.contact_name2 = "contact_name2"; cons.contact_name1_tel = "contact_name1_tel"; cons.contact_name2_tel = "contact_name2_tel"; cons.status_company = "status_company"; cons.status_vendor = "status_vendor"; cons.date_create = "date_create"; cons.date_modi = "date_modi"; cons.date_cancel = "date_cancel"; cons.user_create = "user_create"; cons.user_modi = "user_modi"; cons.user_cancel = "user_cancel"; cons.remark2 = "remark2"; cons.po_due_period = "po_due_period"; cons.taddr1 = "taddr1"; cons.taddr2 = "taddr2"; cons.taddr3 = "taddr3"; cons.taddr4 = "taddr4"; cons.eaddr1 = "eaddr1"; cons.eaddr2 = "eaddr2"; cons.eaddr3 = "eaddr3"; cons.eaddr4 = "eaddr4"; cons.status_cons = "status_cons"; cons.table = "b_consignee"; cons.pkField = "cons_id"; lCons = new List <Consignee>(); lSupp = new List <Consignee>(); //getlCons(); //getlSupp(); }
public IActionResult Index(string numero) { var trakingDbContext = _context.Bls.FirstOrDefault(b => b.BlNumber == numero); dynamic consignee = JsonConvert.DeserializeObject <dynamic>(trakingDbContext.JsonRastreio); Consignee consig = new Consignee { name = consignee.consignee.name }; //Consignee consignee = JsonConvert.DeserializeObject<Consignee>(json); return(View(trakingDbContext)); }
public Consignee selectByPk1(String copId) { Consignee cop1 = new Consignee(); DataTable dt = new DataTable(); String sql = "select cons.* " + "From " + cons.table + " cons " + //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " + "Where cons." + cons.pkField + " ='" + copId + "' "; dt = conn.selectData(conn.conn, sql); cop1 = setConsignee(dt); return(cop1); }
public String insertConsignee(Consignee p) { String re = ""; if (p.cons_id.Equals("")) { re = insert(p); } else { re = update(p); } return(re); }
public override bool Equals(object obj) { var response = obj as TrackingInformationResponse; if (response == null) { return(false); } return (EstimatedTimeOfArrival == response.EstimatedTimeOfArrival && Events.Count() == response.Events.Count() && Consignor.Equals(response.Consignor) && Consignee.Equals(response.Consignee) && Status.Equals(response.Status)); }
public void getlCons() { //lDept = new List<Department>(); lCons.Clear(); DataTable dt = new DataTable(); dt = selectConsigneeAll(); foreach (DataRow row in dt.Rows) { Consignee jim1 = new Consignee(); jim1.cons_id = row[cons.cons_id].ToString(); jim1.cons_code = row[cons.cons_code].ToString(); lCons.Add(jim1); } }
public IActionResult CreateOrderDetail([FromBody] OrderFormModel orderdata) { BookingModel bookingModel = new BookingModel(); Consignee consignee = new Consignee(); Shipper shipper = new Shipper(); if (ModelState.IsValid) { Guid bookingobj = Guid.NewGuid(); Guid consigneeobj = Guid.NewGuid(); Guid shipperobj = Guid.NewGuid(); bookingModel.BookingId = bookingobj; consignee.ConsigneeId = consigneeobj; shipper.ShipperId = shipperobj; shipper.Name = orderdata.ShipperName; shipper.Address1 = orderdata.ShipperAddress1; shipper.Address2 = orderdata.ShipperAddress2; shipper.Contact1 = orderdata.ShipperContactNo; shipper.Email = orderdata.ShipperEmail; consignee.Name = orderdata.ConsigneeName; consignee.Address1 = orderdata.ConsigneeAddress1; consignee.Address2 = orderdata.ConsigneeAddress2; consignee.ContactNumber = orderdata.ConsigneeContactNo; consignee.Email = orderdata.ConsigneeEmail; bookingModel.CreatedDate = DateTime.Now; bookingModel.UpdatedDate = DateTime.Now; consignee.CreatedDate = DateTime.Now; consignee.UpdatedDate = DateTime.Now; shipper.CreatedDate = DateTime.Now; shipper.UpdatedDate = DateTime.Now; bookingModel.ClientId = orderdata.ClientId; bookingModel.CreatedBy = "User"; consignee.CreatedBy = "User"; shipper.CreatedBy = "User"; bookingModel.Consignee = consignee; bookingModel.Shipper = shipper; _dataAccessProvider.AddOrderDetails(bookingModel.Consignee, bookingModel.Shipper, bookingModel); SendOrderToWMSModel sendOrderToWMS = new SendOrderToWMSModel(); sendOrderToWMS = _dataAccessProvider.SendOrderDataToWMS(orderdata, bookingobj); return(Ok(sendOrderToWMS)); } return(BadRequest(ModelState)); }
public static string Delete(int id) { string isDeleted = "true"; EasyFreightEntities db = new EasyFreightEntities(); Consignee carrObj = db.Consignees.Where(x => x.ConsigneeId == id).FirstOrDefault(); db.Consignees.Remove(carrObj); try { db.SaveChanges(); } catch (Exception ex) { isDeleted = "false " + ex.Message; } return(isDeleted); }
public IActionResult EditConsignee(Consignee model) { if (ModelState.IsValid) { var consignee = _consigneeRepo.GetAllConsignee().FirstOrDefault(csn => csn.Id == model.Id); if (consignee == null) { TempData["message"] = $"Không tồn tại Consignee với Id: {model.Id}"; return(RedirectToAction(nameof(Index))); } else { _consigneeRepo.SaveConsignee(model); TempData["message"] = $"Đã cập nhật thành công Consignee"; return(RedirectToAction(nameof(Index))); } } else { TempData["message"] = $"Vui lòng nhập vào các trường còn thiếu"; return(View(model)); } }
public void AddOrderDetails(Consignee consignee, Shipper shipper, BookingModel booking) { _context.AddRange(consignee, shipper, booking); _context.SaveChanges(); }
public async Task <bool> RegistrarOrdenVenta(int ANIO, int MES, int SEMANA, CustomerGroup Customer, Consignee consignee, Notify Notify, ShippingLine Naviera, FinalClient Cliente, Country PaisDescarga, Port PuertoDescarga, Country PaisDestino, Vessel Nave, Country PaisEmbarque, Port PuertoEmbarque, SalesTerms TerminosVenta, TypeOfShipment TipoCarga, Brand Marca, BoxType TipoCaja, ExportedBy Exportador, Beneficiarios CiaFacturar, ArchivoBaseRow fila) { try { var op = _context.OrdenVentas.FirstOrDefault(c => c.Activo && c.cplan == fila.CPLAN && c.NumInvoiceSRI == fila.NFacturaSRI); if (op != null) { return(false); } OrdenVenta NuevoRegistro = new OrdenVenta(); var paisEC = _context.Countries.FirstOrDefault(c => c.Activo && c.Nombre.ToUpper() == "ECUADOR"); var tipoDoc = _context.TypeOfDocuments.FirstOrDefault(c => c.Activo && c.Nombre.ToUpper() == "COMMERCIAL INVOICE"); NuevoRegistro.FechaOrden = DateTime.Now; NuevoRegistro.ANIO = ANIO; NuevoRegistro.MES = MES; //NuevoRegistro.SEMANA = WeeksInYear(NuevoRegistro.FechaOrden); NuevoRegistro.SEMANA = SEMANA; NuevoRegistro.IdSalesTerms = TerminosVenta.IdSalesTerms; if (fila.TIPOCLIENTE == "CONTRATO") { NuevoRegistro.ContractTerms = true; } else { NuevoRegistro.ContractTerms = false; } NuevoRegistro.IdFDLorOtherInvoiceTo = Cliente.IdFinalClient; NuevoRegistro.IdCustomerGroup = Customer.IdCustomerGroup; NuevoRegistro.IdConsignee = consignee.IdConsignee; NuevoRegistro.IdNotify = Notify.IdNotify; NuevoRegistro.IdExportedBy = Exportador.IdExportedBy; NuevoRegistro.IdCiaFacturar = CiaFacturar.IdBeneficiario; NuevoRegistro.IdShippingLine = Naviera.IdShippingLine; NuevoRegistro.IdCountryFinalDestination = PaisDestino.IdCountry; NuevoRegistro.IdDischargePort = PuertoDescarga.IdPort; NuevoRegistro.IdCountryDiscargePort = PaisDescarga.IdCountry; NuevoRegistro.IdVessel = Nave.IdVessel; NuevoRegistro.Num_DAE = fila.DAE; NuevoRegistro.Num_BL = fila.No_BL; NuevoRegistro.NumInvoiceSRI = fila.NFacturaSRI; NuevoRegistro.IdTypeOfShipment = TipoCarga.IdTypeOfShipment; int c1 = 0; int c2 = 0; int.TryParse(fila.NUM_CTNRS.ToString(), out c1); int.TryParse(fila.CAJASTARJA.ToString(), out c2); NuevoRegistro.NumBOXES = c2; NuevoRegistro.NumCNTRS = c1; NuevoRegistro.INV_1_FDL_OR_OTHER_EXPORTERS_FOB_PRICE_SRI = fila.PRECIO_FOB; //NuevoRegistro.FDL_OR_OTHER_EXPORTERS_FOB_AMOUNT_PRICE = fila.PRECIO_FOB; //NuevoRegistro.FDL_OR_OTHER_EXPORTERS_FOB_PRICE_REAL = fila.PRECIO_FOB; NuevoRegistro.FINAL_SALES_PRICE = 0; NuevoRegistro.FINAL_SALES_PRICE_AMOUNT = 0; NuevoRegistro.DateOfInvoice = fila.FECHA_EMISION_FACT_EXPORT; NuevoRegistro.IdBrand = Marca.IdBrand; NuevoRegistro.IdBoxType = TipoCaja.IdBoxType; NuevoRegistro.DescripcionProducto = fila.PRODUCTO; NuevoRegistro.ReleaseDate = fila.FECHA_RELEASE; NuevoRegistro.TotalKiloBruto = fila.KILOBRUTO; NuevoRegistro.TotalKiloNeto = fila.KILONETO; NuevoRegistro.cplan = fila.CPLAN; NuevoRegistro.FechaCreacion = DateTime.Now; NuevoRegistro.Activo = true; NuevoRegistro.IdCountry = paisEC.IdCountry; NuevoRegistro.IdTypeOfDocument = tipoDoc.IdTypeOfDocument; NuevoRegistro.UsuarioCreacion = "SYSTEM"; _context.OrdenVentas.Add(NuevoRegistro); _context.SaveChanges(); return(true); } catch (Exception) { throw; } }
public void CreateOrder() { Shipper shipper = new Shipper() { shipper_name = "易酷", shipper_countrycode = "CN", shipper_street = "福建省莆田市工业园", shipper_telephone = "18650805022", shipper_mobile = "18650805022" }; Consignee consignee = new Consignee() { consignee_name = "Marie Denise Medard Francois", /// <summary> /// 收件人国家二字代码 /// </summary> consignee_countrycode = "US", /// <summary> /// 收件人省 /// </summary> consignee_province = "US-FL", /// <summary> /// 收件人城市 /// </summary> consignee_city = "Mattapan", /// <summary> /// 收件人地址 /// </summary> consignee_street = "760 Cummins HWY Apt11", /// <summary> /// 收件人邮编 /// </summary> consignee_postcode = "02126", /// <summary> /// 收件人电话 /// </summary> consignee_telephone = "862-235-2637", /// <summary> /// 收件人手机 /// </summary> consignee_mobile = "", /// <summary> /// 税号 /// </summary> consignee_tariff = "", }; List <Invoice> invoiceList = new List <Invoice>(); Invoice invoice = new Invoice(); invoice.invoice_enname = "Dresses"; invoice.invoice_cnname = "是否是"; invoice.invoice_quantity = "1"; invoice.invoice_unitcharge = "2.34"; invoice.consignee_street = "760 Cummins HWY Apt11"; invoice.consignee_postcode = "02126"; invoiceList.Add(invoice); var start = consignee.consignee_province.IndexOf("-") + 1; var cons = consignee.consignee_province.Substring(start); CreateOrderReqModel model = new CreateOrderReqModel() { reference_no = "LB20121891902", shipping_method = "EUBYD", order_weight = "10", consignee = consignee, shipper = shipper, invoice = invoiceList }; CreateOrderReq req = new CreateOrderReq(model); YDHClient yDHClient = new YDHClient(); var response = yDHClient.PostRequestAsync(req); Assert.Equal(true, 1 > 0); }
public static ConsigneeModel ToModel(this Consignee entity) { return(AutoMapperConfiguration.Mapper.Map <Consignee, ConsigneeModel>(entity)); }
public String update(Consignee p) { String re = ""; String sql = ""; p.date_modi = p.date_modi == null ? "" : p.date_modi; p.date_cancel = p.date_cancel == null ? "" : p.date_cancel; p.user_create = p.user_create == null ? "" : p.user_create; p.user_modi = p.user_modi == null ? "" : p.user_modi; p.user_cancel = p.user_cancel == null ? "" : p.user_cancel; p.eaddr4 = p.eaddr4 == null ? "" : p.eaddr4; p.eaddr3 = p.eaddr3 == null ? "" : p.eaddr3; p.eaddr2 = p.eaddr2 == null ? "" : p.eaddr2; p.eaddr1 = p.eaddr1 == null ? "" : p.eaddr1; p.taddr1 = p.taddr1 == null ? "" : p.taddr1; p.taddr2 = p.taddr2 == null ? "" : p.taddr2; p.taddr3 = p.taddr3 == null ? "" : p.taddr3; p.taddr4 = p.taddr4 == null ? "" : p.taddr4; p.po_due_period = p.po_due_period == null ? "" : p.po_due_period; p.amphur_id = p.amphur_id == null ? "" : p.amphur_id; p.district_id = p.district_id == null ? "" : p.district_id; p.province_id = p.province_id == null ? "" : p.province_id; p.addr = p.addr == null ? "" : p.addr; p.address_t = p.address_t == null ? "" : p.address_t; p.address_e = p.address_e == null ? "" : p.address_e; p.sale_id = p.sale_id == null ? "" : p.sale_id; p.sale_name_t = p.sale_name_t == null ? "" : p.sale_name_t; p.zipcode = p.zipcode == null ? "" : p.zipcode; p.status_company = p.status_company == null ? "" : p.status_company; p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; //p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; //p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; sql = "Update " + cons.table + " Set " + " " + cons.cons_code + " = '" + p.cons_code.Replace("'", "''") + "'" + "," + cons.cons_name_t + " = '" + p.cons_name_t.Replace("'", "''") + "'" + "," + cons.cons_name_e + " = '" + p.cons_name_e + "'" + "," + cons.address_t + " = '" + p.address_t.Replace("'", "''") + "'" + "," + cons.address_e + " = '" + p.address_e.Replace("'", "''") + "'" + "," + cons.addr + " = '" + p.addr.Replace("'", "''") + "'" + "," + cons.amphur_id + " = '" + p.amphur_id.Replace("'", "''") + "'" + "," + cons.district_id + " = '" + p.district_id.Replace("'", "''") + "'" + "," + cons.province_id + " = '" + p.province_id.Replace("'", "''") + "'" + "," + cons.zipcode + " = '" + p.zipcode + "'" + "," + cons.sale_id + " = '" + p.sale_id + "'" + "," + cons.sale_name_t + " = '" + p.sale_name_t + "'" + "," + cons.fax + " = '" + p.fax + "'" + "," + cons.tele + " = '" + p.tele + "'" + "," + cons.email + " = '" + p.email + "'" + "," + cons.tax_id + " = '" + p.tax_id.Replace("'", "''") + "'" + "," + cons.date_modi + " = now()" + "," + cons.remark + " = '" + p.remark + "'" + "," + cons.contact_name1 + " = '" + p.contact_name1 + "' " + "," + cons.contact_name2 + " = '" + p.contact_name2 + "' " + "," + cons.contact_name1_tel + " = '" + p.contact_name1_tel + "' " + "," + cons.contact_name2_tel + " = '" + p.contact_name2_tel + "' " + "," + cons.status_company + " = '" + p.status_company + "' " + "," + cons.status_vendor + " = '" + p.status_vendor + "' " + "," + cons.user_modi + " = '" + p.user_modi + "' " + "," + cons.remark2 + " = '" + p.remark2 + "' " + "," + cons.po_due_period + " = '" + p.po_due_period + "' " + "," + cons.taddr1 + " = '" + p.taddr1 + "' " + "," + cons.taddr2 + " = '" + p.taddr2 + "' " + "," + cons.taddr3 + " = '" + p.taddr3 + "' " + "," + cons.taddr4 + " = '" + p.taddr4 + "' " + "," + cons.eaddr1 + " = '" + p.eaddr1 + "' " + "," + cons.eaddr2 + " = '" + p.eaddr2 + "' " + "," + cons.eaddr3 + " = '" + p.eaddr3 + "' " + "," + cons.eaddr4 + " = '" + p.eaddr4 + "' " + //"," + cons.user_modi + " = '" + p.user_modi + "' " + "Where " + cons.pkField + "='" + p.cons_id + "'" ; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
public String insert(Consignee p) { String re = ""; String sql = ""; p.active = "1"; //p.ssdata_id = ""; int chk = 0; p.date_modi = p.date_modi == null ? "" : p.date_modi; p.date_cancel = p.date_cancel == null ? "" : p.date_cancel; p.user_create = p.user_create == null ? "" : p.user_create; p.user_modi = p.user_modi == null ? "" : p.user_modi; p.user_cancel = p.user_cancel == null ? "" : p.user_cancel; p.eaddr4 = p.eaddr4 == null ? "" : p.eaddr4; p.eaddr3 = p.eaddr3 == null ? "" : p.eaddr3; p.eaddr2 = p.eaddr2 == null ? "" : p.eaddr2; p.eaddr1 = p.eaddr1 == null ? "" : p.eaddr1; p.taddr1 = p.taddr1 == null ? "" : p.taddr1; p.taddr2 = p.taddr2 == null ? "" : p.taddr2; p.taddr3 = p.taddr3 == null ? "" : p.taddr3; p.taddr4 = p.taddr4 == null ? "" : p.taddr4; p.po_due_period = p.po_due_period == null ? "" : p.po_due_period; p.amphur_id = p.amphur_id == null ? "" : p.amphur_id; p.district_id = p.district_id == null ? "" : p.district_id; p.province_id = p.province_id == null ? "" : p.province_id; p.addr = p.addr == null ? "" : p.addr; p.address_t = p.address_t == null ? "" : p.address_t; p.address_e = p.address_e == null ? "" : p.address_e; p.sale_id = p.sale_id == null ? "" : p.sale_id; p.sale_name_t = p.sale_name_t == null ? "" : p.sale_name_t; p.zipcode = p.zipcode == null ? "" : p.zipcode; p.status_company = p.status_company == null ? "" : p.status_company; p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; //p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; //p.status_vendor = p.status_vendor == null ? "" : p.status_vendor; sql = "Insert Into " + cons.table + "(" + cons.cons_code + "," + cons.cons_name_t + "," + cons.cons_name_e + "," + cons.active + "," + cons.address_t + "," + cons.address_e + "," + cons.addr + "," + cons.amphur_id + "," + cons.district_id + "," + cons.province_id + "," + cons.zipcode + "," + cons.sale_id + "," + cons.sale_name_t + "," + cons.fax + "," + cons.tele + "," + cons.email + "," + cons.tax_id + "," + cons.remark + "," + cons.contact_name1 + "," + cons.contact_name2 + "," + cons.contact_name1_tel + "," + cons.contact_name2_tel + "," + cons.status_company + ", " + cons.status_vendor + ", " + cons.date_create + "," + cons.date_modi + ", " + cons.date_cancel + ", " + cons.user_create + "," + cons.user_modi + ", " + cons.user_cancel + ", " + cons.remark2 + "," + cons.po_due_period + ", " + cons.taddr1 + ", " + cons.taddr2 + "," + cons.taddr3 + ", " + cons.taddr4 + ", " + cons.eaddr1 + "," + cons.eaddr2 + ", " + cons.eaddr3 + ", " + cons.eaddr4 + "," + cons.status_cons + " " + ") " + "Values ('" + p.cons_code.Replace("'", "''") + "','" + p.cons_name_t.Replace("'", "''") + "','" + p.cons_name_e.Replace("'", "''") + "'," + "'" + p.active + "','" + p.address_t.Replace("'", "''") + "','" + p.address_e.Replace("'", "''") + "'," + "'" + p.addr.Replace("'", "''") + "','" + p.amphur_id + "','" + p.district_id + "'," + "'" + p.province_id + "','" + p.zipcode + "','" + p.sale_id + "'," + "'" + p.sale_name_t.Replace("'", "''") + "','" + p.fax + "','" + p.tele + "'," + "'" + p.email + "','" + p.tax_id + "','" + p.remark.Replace("'", "''") + "'," + "'" + p.contact_name1.Replace("'", "''") + "','" + p.contact_name2.Replace("'", "''") + "','" + p.contact_name1_tel + "', " + "'" + p.contact_name2_tel + "','" + p.status_company + "','" + p.status_vendor + "', " + "'" + p.date_create + "','" + p.date_modi + "','" + p.date_cancel + "', " + "'" + p.user_create + "','" + p.user_modi + "','" + p.user_cancel + "', " + "'" + p.remark2.Replace("'", "''") + "','" + p.po_due_period + "','" + p.taddr1.Replace("'", "''") + "', " + "'" + p.taddr2.Replace("'", "''") + "','" + p.taddr3.Replace("'", "''") + "','" + p.taddr4.Replace("'", "''") + "', " + "'" + p.eaddr1.Replace("'", "''") + "','" + p.eaddr2.Replace("'", "''") + "','" + p.eaddr3.Replace("'", "''") + "', " + "'" + p.eaddr4.Replace("'", "''") + "', '" + p.status_cons + "' " + ")"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
public IActionResult CreateNewBookingDetails([FromBody] BookingFormModel booking) { if (ModelState.IsValid) { BookingModel bookingmodel = new BookingModel(); BookingDetailModel bookingDetailModel = new BookingDetailModel(); Consignee consignee = new Consignee(); Shipper shipper = new Shipper(); bookingmodel.Consignee = consignee; bookingmodel.Shipper = shipper; if (_dataAccessProvider.noOfSlotsTaken(booking.BookingTime) > 10) { bookingDetailModel.BookingStatus = "Pending"; bookingDetailModel.IsActive = false; bookingmodel.IsActive = false; } else { bookingDetailModel.BookingStatus = "Approved"; bookingDetailModel.IsActive = true; bookingmodel.IsActive = true; } DateTime date = DateTime.Now; Guid bookingobj = Guid.NewGuid(); Guid consigneeobj = Guid.NewGuid(); Guid shipperobj = Guid.NewGuid(); bookingDetailModel.CreatedBy = "Test"; bookingmodel.CreatedBy = "Test"; bookingmodel.Consignee.CreatedBy = "Test"; bookingmodel.Shipper.CreatedBy = "Test"; bookingDetailModel.BookingDetailId = bookingobj; bookingmodel.BookingId = bookingobj; bookingmodel.ClientId = booking.ClientId; bookingmodel.Consignee.ConsigneeId = consigneeobj; bookingmodel.Shipper.ShipperId = shipperobj; bookingDetailModel.CreatedDate = DateTime.Now; bookingDetailModel.UpdatedDate = DateTime.Now; bookingmodel.CreatedDate = DateTime.Now; bookingmodel.UpdatedDate = DateTime.Now; bookingmodel.Consignee.CreatedDate = DateTime.Now; bookingmodel.Consignee.UpdatedDate = DateTime.Now; bookingmodel.Shipper.CreatedDate = DateTime.Now; bookingmodel.Shipper.UpdatedDate = DateTime.Now; bookingmodel.Shipper.IsActive = true; bookingmodel.Consignee.IsActive = true; bookingDetailModel.BookingDate = booking.BookingDate; bookingDetailModel.BookingTime = booking.BookingTime; bookingDetailModel.BillOfLading = booking.BillOfLading; bookingDetailModel.ExportDeclarationNumber = booking.ExportDeclarationNumber; bookingmodel.Shipper.Name = booking.ShipperName; bookingmodel.Shipper.Address1 = booking.ShipperAddress1; bookingmodel.Shipper.Address2 = booking.ShipperAddress2; bookingmodel.Shipper.Contact1 = booking.ShipperContactNo; bookingmodel.Shipper.Email = booking.ShipperEmail; bookingmodel.Consignee.Name = booking.ConsigneeName; bookingmodel.Consignee.Address1 = booking.ConsigneeAddress1; bookingmodel.Consignee.Address2 = booking.ConsigneeAddress2; bookingmodel.Consignee.ContactNumber = booking.ConsigneeContactNo; bookingmodel.Consignee.Email = booking.ConsigneeEmail; bookingDetailModel.BookingType = booking.BookingType; bookingDetailModel.VoyageDetails = booking.VoyageDetails; bookingDetailModel.CountryOrigin = booking.CountryOrigin; bookingDetailModel.CountryFinalDestination = booking.CountryFinalDestination; bookingDetailModel.PortLoading = booking.PortOfLoading; bookingDetailModel.PortDischarge = booking.PortOfDischarge; bookingDetailModel.DateDeparture = booking.DateDeparture; bookingDetailModel.FinalDestination = booking.FinalDestination; bookingDetailModel.DeclaredWeight = booking.Weight; bookingDetailModel.DeclaredWidth = booking.Width; bookingDetailModel.DeclaredLength = booking.Length; bookingDetailModel.DeclaredHeight = booking.Height; _dataAccessProvider.AddBookingDetails(bookingmodel.Consignee, bookingmodel.Shipper, bookingmodel, bookingDetailModel); SendBookingToWmsModel sendBookingToWMS = new SendBookingToWmsModel(); sendBookingToWMS = _dataAccessProvider.SendBookingDataToWMS(booking, bookingobj); return(Ok(sendBookingToWMS)); return(Ok(new { })); } return(BadRequest(ModelState)); }
public static string AddEditConsignee(ConsigneeVm carrVm) { int carrId = carrVm.ConsigneeId; string isSaved = "true"; EasyFreightEntities db = new EasyFreightEntities(); Consignee carrDb; List <ConsigneeContact> dbContactList = new List <ConsigneeContact>(); if (carrId == 0) //Add new case { carrDb = new Consignee(); } else { carrDb = db.Consignees.Include("ConsigneeContacts").Where(x => x.ConsigneeId == carrId).FirstOrDefault(); //delete any removed contact on the screen dbContactList = carrDb.ConsigneeContacts.ToList(); try { //Get contact Ids sent from the screen List <int> contactVmIds = carrVm.ContactPersons.Select(x => x.ContactId).ToList(); var contactDel = dbContactList.Where(x => !contactVmIds.Contains(x.ContactId)).ToList(); foreach (var item in contactDel) { db.ConsigneeContacts.Remove(item); } } catch { } } Mapper.CreateMap <ConsigneeVm, Consignee>().IgnoreAllNonExisting(); Mapper.Map(carrVm, carrDb); if (carrId == 0) { Random rand = new Random(); carrDb.ConsigneeCode = rand.Next(10000).ToString(); db.Consignees.Add(carrDb); } Mapper.CreateMap <ContactPersonVm, ConsigneeContact>().IgnoreAllNonExisting() .ForMember(x => x.ConsigneeId, opts => opts.MapFrom(scr => scr.FkValue)); ConsigneeContact carrContactDb; if (carrVm.ContactPersons != null && carrVm.ContactPersons.Count > 0) { foreach (var item in carrVm.ContactPersons.Where(x => !string.IsNullOrEmpty(x.ContactName))) { if (item.ContactId == 0) { carrContactDb = new ConsigneeContact(); } else { int contVmId = item.ContactId; carrContactDb = dbContactList.Where(x => x.ContactId == contVmId).FirstOrDefault(); } Mapper.Map(item, carrContactDb); if (item.ContactId == 0) { carrDb.ConsigneeContacts.Add(carrContactDb); } } } try { db.SaveChanges(); } catch (DbEntityValidationException e) { isSaved = "false " + e.Message; } catch (Exception e) { isSaved = "false " + e.Message; } return(isSaved); }
private Seller BindInvoice(DataSet dsInvoice) { Seller obj = new Seller(); // Invoice inv = new Invoice(); obj.CreateInvoice(obj, InvoiceType.B2BInvoice.ToString()); #region B2B if (dsInvoice.Tables.Count > 0) { if (dsInvoice.Tables.Contains("SellerDtls")) { if (dsInvoice.Tables[0].Rows.Count > 0) { // // lblInvoiceNumber.Text = "Serial No. of Invoice : " + Convert.ToString(ds.Tables[0].Rows[0][0]); // // lblInvoiceDate.Text = "Invoice Date : " + Convert.ToString(ds.Tables[0].Rows[0][1]); // lblSellerGSTIN.Text = "GSTIN : " + Convert.ToString(ds.Tables[0].Rows[0][2]); // lblSellerName.Text = "Name : " + Convert.ToString(ds.Tables[0].Rows[0][3]); // // lblSellerAddress.Text = "Address : " + Convert.ToString(ds.Tables[0].Rows[0][4]); //// hdnSellerGSTN.Value = Convert.ToString(ds.Tables[0].Rows[0][2]); obj.SellerInvoice = Convert.ToString(ds.Tables[0].Rows[0][0]); obj.DateOfInvoice = Convert.ToString(ds.Tables[0].Rows[0][1]); obj.GSTIN = Convert.ToString(ds.Tables[0].Rows[0][2]); obj.NameAsOnGST = Convert.ToString(ds.Tables[0].Rows[0][3]); obj.Address = Convert.ToString(ds.Tables[0].Rows[0][8]); // obj.SellerStateCode = Convert.ToString(ds.Tables[0].Rows[0][6]); obj.SellerStateName = Convert.ToString(ds.Tables[0].Rows[0][10]); obj.Invoice.Freight = Convert.ToDecimal(ds.Tables[0].Rows[0][14]); obj.Invoice.PackingAndForwadingCharges = Convert.ToDecimal(ds.Tables[0].Rows[0][16]); } } else { //lblMsg.Text = "System error occured during data population of SellerDtls table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } if (ds.Tables.Contains("ReceiverDtls")) { if (ds.Tables[1].Rows.Count > 0) { Reciever rec = new Reciever(); rec.GSTIN = Convert.ToString(ds.Tables[1].Rows[0][1]); rec.NameAsOnGST = Convert.ToString(ds.Tables[1].Rows[0][2]); rec.Address = Convert.ToString(ds.Tables[1].Rows[0][3]); rec.StateCode = Convert.ToString(ds.Tables[1].Rows[0][6]); rec.StateName = Convert.ToString(ds.Tables[1].Rows[0][5]); obj.Reciever = rec; } } else { //lblMsg.Text = "System error occured during data population of ReceiverDtls table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } if (ds.Tables.Contains("ConsigneeDtls")) { if (ds.Tables[2].Rows.Count > 0) { Consignee con = new Consignee(); con.GSTIN = Convert.ToString(ds.Tables[2].Rows[0][1]); con.NameAsOnGST = Convert.ToString(ds.Tables[2].Rows[0][2]); con.Address = Convert.ToString(ds.Tables[2].Rows[0][3]); con.StateCode = Convert.ToString(ds.Tables[2].Rows[0][6]); con.StateName = Convert.ToString(ds.Tables[2].Rows[0][5]); obj.Consignee = con; } } else { //lblMsg.Text = "System error occured during data population of ConsigneeDtls table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } if (ds.Tables.Contains("InvoiceDtls")) { //LineID,Description,HSN,Qty,Unit,Rate,Total,Discount,AmountWithTax,CGSTRate,CGSTAmt,SGSTRate,SGSTAmt,IGSTRate,IGSTAmt DataTable dt = ds.Tables["InvoiceDtls"]; HSN hsn = new HSN(); var leItem = (from item in dt.AsEnumerable() select new LineEntry { LineID = Convert.ToInt32(item.Field <string>("LineID")), //HSN=item..Select(new HSN{Description}) //HSN = new HSN().Description = item.Field<string>("Description"), //HSN = new HSN().HSNNumber = item.Field<string>("HSN"), HSN = ConvertItemToHSN(item), Qty = Convert.ToInt32(item.Field <string>("Qty")), //Unit = Convert.ToInt32(item.Field<string>("Unit")), PerUnitRate = Convert.ToDecimal(item.Field <string>("Rate")), TotalLineIDWise = Convert.ToDecimal(item.Field <string>("Total")), Discount = Convert.ToDecimal(item.Field <string>("Discount")), TaxValue = Convert.ToDecimal(item.Field <string>("TaxableValue")), AmountWithTax = Convert.ToDecimal(item.Field <string>("AmountWithTax")), AmtCGSTLineIDWise = Convert.ToDecimal(item.Field <string>("CGSTAmt")), AmtSGSTLineIDWise = Convert.ToDecimal(item.Field <string>("SGSTAmt")), AmtIGSTLineIDWise = Convert.ToDecimal(item.Field <string>("IGSTAmt")) }).ToList(); obj.Invoice.LineEntry = leItem; } else { //lblMsg.Text = "System error occured during data population of InvoiceDtls table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } if (ds.Tables.Contains("AmountDtls")) { obj.TotalAmount = Convert.ToDecimal(ds.Tables[4].Rows[0][6]); obj.TotalDiscount = Convert.ToDecimal(ds.Tables[4].Rows[0][7]); obj.TotalAmountWithTax = Convert.ToDecimal(ds.Tables[4].Rows[0][8]); obj.TotalCGSTAmount = Convert.ToDecimal(ds.Tables[4].Rows[0][10]); obj.TotalSGSTAmount = Convert.ToDecimal(ds.Tables[4].Rows[0][12]); obj.TotalIGSTAmount = Convert.ToDecimal(ds.Tables[4].Rows[0][14]); if (ds.Tables[4].Rows.Count > 0) { HtmlTableRow tRow = new HtmlTableRow(); for (int j = 0; j <= 14; j++) { HtmlTableCell tb = new HtmlTableCell(); tb.InnerText = Convert.ToString(ds.Tables[4].Rows[0][j]); tRow.Controls.Add(tb); } tblPreview.Rows.Add(tRow); } } else { //lblMsg.Text = "System error occured during data population of AmountDtls table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } if (ds.Tables.Contains("AmountInWords")) { if (ds.Tables[5].Rows.Count > 0) { obj.Invoice.TotalInvoiceValue = Convert.ToDecimal(ds.Tables[5].Rows[0][0]); obj.Invoice.TotalInvoiceWords = Convert.ToString(ds.Tables[5].Rows[0][1]); } } else { //lblMsg.Text = "System error occured during data population of AmountInWords table !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } } else { //lblMsg.Text = "System Error !!!"; //this.InvoicePreviewModalPopupExtender.Show(); //return; } return(obj); #endregion }
public static Consignee ToEntity(this ConsigneeModel model, Consignee destination) { return(AutoMapperConfiguration.Mapper.Map(model, destination)); }
public int Upt(Consignee m) { return(bll.Upt(m)); }
//修改收货地址 public int Upt(Consignee m) { string sql = string.Format("Update Consignee set ConName='{0}',ConMobile='{1}',Consite='{2}',postcode='{3}' where ConsigneeId='{4}'", m.ConName, m.ConMobile, m.Consite, m.postcode, m.ConsigneeId); return(db.ExecuteNonQuery(sql)); }