public ActionResult PoniCity(string countryName) { string connectionString = ConfigurationManager .ConnectionStrings["LiteCommerceDB"] .ConnectionString; ISupplierDAL dal = new SupplierDAL(connectionString); Supplier s = new Supplier() { SupplierName = "Ton That Pho", ContactName = "t1", Address = "t2", City = "t3", PostalCode = "t4", Country = "t5", Phone = "t6" }; var data = dal.Add(s); return(Json(data, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 验证并新增 /// </summary> /// <param name="info"></param> /// <returns></returns> public long InsertInfo(SupplierInfo info) { ///供应商代码①、邓白氏码②、供应商名称③、供应商简称④单字段全表范围不允许重复 int cnt = dal.GetCounts("[SUPPLIER_NUM] = N'" + info.SupplierNum + "'"); if (cnt > 0) { throw new Exception("MC:0x00000689"); ///供应商代码重复 } cnt = dal.GetCounts("[SUPPLIER_NAME] = N'" + info.SupplierName + "'"); if (cnt > 0) { throw new Exception("MC:0x00000691");///供应商名称重复 } if (!string.IsNullOrEmpty(info.Duns)) { cnt = dal.GetCounts("[DUNS] = N'" + info.Duns + "'"); if (cnt > 0) { throw new Exception("MC:0x00000690");///邓白氏码重复 } } if (!string.IsNullOrEmpty(info.SupplierSname)) { cnt = dal.GetCounts("[SUPPLIER_SNAME] = N'" + info.SupplierSname + "'"); if (cnt > 0) { throw new Exception("MC:0x00000692");///供应商简称重复 } } ///未选中供应商类型则默认为物料供应商 if (info.SupplierType.GetValueOrDefault() == 0) { info.SupplierType = (int)SupplierTypeConstants.MaterialSupplier; } return(dal.Add(info)); }
static public bool Add(Suppliers suppliers, out string msg) { return(SupplierDAL.Add(suppliers, out msg)); }
public int Add(Supplier supplier) { return(supplierDAL.Add(supplier.Name, supplier.PhoneNumber, supplier.Address)); }