public bool updateSupplier(Supplier s) { BusinessLogic.SupplierController BL = new BusinessLogic.SupplierController(); if (BL.updateSupplier(s)) { OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse; response.StatusCode = HttpStatusCode.OK; return true; } else { OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse; response.StatusCode = HttpStatusCode.NotFound; return false; } }
} //orderList Edit public string Edit(Model.Supplier supplier) { string sqlStr = "update Supplier set name=@name,area=@area,telephone=@telephone where supID=@supID"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@supID", supplier.SupID), new SqlParameter("@name", supplier.Name), new SqlParameter("@area", supplier.Area), new SqlParameter("@telephone", supplier.Telephone) }; if (userDao.Edit(sqlStr, paras)) { return("Success"); } else { return("Fail"); } } //supplier Edit
} //machine Insert public string Insert(Model.Supplier supplier) { string sqlStr = "insert into Supplier(supID,name,area,telephone) values(@supID,@name,@area,@telephone)"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@supID", supplier.SupID), new SqlParameter("@name", supplier.Name), new SqlParameter("@area", supplier.Area), new SqlParameter("@telephone", supplier.Telephone) }; if (userDao.Insert(sqlStr, paras)) { return("Success"); } else { return("Fail"); } } //supplier Insert